Prompt templates allow you to define reusable prompts with arguments.
Templates are Markdown files loaded from:
- Global:
~/.pi/agent/prompts/*.md - Project:
.pi/prompts/*.md - Packages: Installed packages can also provide templates.
A template is a Markdown file, optionally with YAML frontmatter.
---
description: "Review code for security issues"
---
Review the following code for security vulnerabilities. Focus on XSS and SQL injection.
Code:
$1If description is omitted, the first line of the file is used. The filename (without extension) becomes the command name (e.g. review.md -> /review).
Call templates using / followed by the name:
/review src/main.rsArguments are split on spaces; single or double quotes keep arguments together:
/review "src/main.rs src/lib.rs" --strictTemplates support bash-like variable expansion:
| Variable | Description |
|---|---|
$1, $2, ... |
Positional arguments |
$@, $ARGUMENTS |
All arguments joined by spaces |
${@:N} |
Arguments from index N onwards (1-based) |
${@:N:L} |
Slice of L arguments starting at N |
Missing positional arguments expand to an empty string.
commit.md:
Write a commit message for the following changes.
Context: $1
Diff:
${@:2}Usage:
/commit "Refactor auth" src/auth.rs src/main.rsExpands to:
Write a commit message for the following changes.
Context: Refactor auth
Diff:
src/auth.rs src/main.rs