Skip to main content
Pi can create prompt templates for you. Just ask it to build one for your workflow.
Prompt templates are Markdown snippets that expand into full prompts. Type /name in the editor to invoke a template, where name is the filename without .md.

Template Locations

Pi loads prompt templates from: Global:
  • ~/.pi/agent/prompts/*.md
Project:
  • .pi/prompts/*.md
Packages:
  • prompts/ directories in pi packages
  • pi.prompts entries in package.json
Settings:
  • prompts array with files or directories
CLI:
  • --prompt-template <path> (repeatable)
Disable discovery with --no-prompt-templates.

Template Format

Rules:
  • The filename becomes the command name. review.md becomes /review
  • description is optional. If missing, the first non-empty line is used
  • Everything after the frontmatter is the template content

Basic Usage

Type / followed by the template name:
The template content replaces the /review text in the editor, then you can submit or edit further.

Arguments

Templates support positional arguments and simple slicing:
string
Positional arguments
string
All arguments joined with spaces
string
Arguments from the Nth position (1-indexed)
string
L arguments starting at position N

Example: Component Template

File: ~/.pi/agent/prompts/component.md
Usage:
Expands to:

Examples

Code Review

File: ~/.pi/agent/prompts/review.md
Usage:

Test Generation

File: ~/.pi/agent/prompts/test.md
Usage:

Documentation

File: ~/.pi/agent/prompts/doc.md
Usage:

Refactoring

File: ~/.pi/agent/prompts/refactor.md
Usage:

Bug Analysis

File: ~/.pi/agent/prompts/debug.md
Usage:

Advanced Usage

Conditional Content

Use argument presence to include conditional content:
The ${3:+text} syntax includes with authentication only if argument 3 is provided.

Multiple Files

Reference multiple files:
Usage:

Loading Rules

Template discovery in prompts/ is non-recursive. Only files directly in the directory are loaded.
For templates in subdirectories, add them explicitly:
Or use a pi package manifest:

Naming Collisions

If multiple templates have the same name:
  1. Project templates override global templates
  2. Later paths in settings override earlier ones
  3. A warning is shown in verbose startup

Creating Templates

1

Create File

2

Add Frontmatter

3

Write Template

4

Test

Sharing Templates

Package templates for others:
1

Create Package

2

Add Templates

3

Publish

4

Users Install

See Pi Packages for full details.

Best Practices

Be Specific

Write focused templates for specific tasks rather than generic prompts

Use Arguments

Leverage $1, $2, $@ for flexibility without creating many similar templates

Include Context

Provide enough context in the template for the model to understand requirements

Show Examples

Include example usage in comments or description for other users

Keep It Short

Templates should be reusable snippets, not complete instructions. Save complex workflows for Skills.

Name Clearly

Use descriptive filenames that clearly indicate the template’s purpose

Templates vs Skills

Use templates for:
  • Quick prompts and reminders
  • Common review patterns
  • Standard questions
  • Short, reusable text
Use skills for:
  • Multi-step workflows
  • External tool integration
  • Complex setup procedures
  • On-demand documentation
See Skills for more information.

Next Steps

Skills

Create Agent Skills for complex workflows

Pi Packages

Package and share templates via npm or git