プロンプトテンプレート
pi はプロンプトテンプレートを作成できます。ワークフロー用のテンプレートを構築するよう依頼してください。
プロンプトテンプレート
Section titled “プロンプトテンプレート”プロンプトテンプレートは完全なプロンプトに展開される Markdown スニペットです。エディターで /name と入力してテンプレートを呼び出します。name は .md を除いたファイル名です。
Pi は次の場所からプロンプトテンプレートを読み込みます:
- グローバル:
~/.pi/agent/prompts/*.md - プロジェクト:
.pi/prompts/*.md(プロジェクトが信頼された後) - パッケージ:
prompts/ディレクトリまたはpackage.jsonのpi.promptsエントリ - 設定:ファイルまたはディレクトリを含む
prompts配列 - CLI:
--prompt-template <path>(繰り返し可能)
--no-prompt-templates で発見を無効化。
---description: Review staged git changes---Review the staged changes (`git diff --cached`). Focus on:- Bugs and logic errors- Security issues- Error handling gaps- ファイル名がコマンド名になります。
review.mdは/reviewになります。 descriptionは任意。ない場合は最初の非空行を使用。argument-hintは任意。設定すると、オートコンプリートドロップダウンで description の前にヒントが表示されます。
フロントマターで argument-hint を使い、オートコンプリートで期待される引数を表示。必須引数は <角括弧>、任意引数は [角括弧]:
---description: Review PRs from URLs with structured issue and code analysisargument-hint: "<PR-URL>"---オートコンプリートドロップダウンでは次のように表示:
→ pr <PR-URL> — Review PRs from URLs with structured issue and code analysis is <issue> — Analyze GitHub issues (bugs or feature requests) wr [instructions] — Finish the current task end-to-end cl — Audit changelog entries before releaseエディターで / の後にテンプレート名を入力。オートコンプリートで利用可能なテンプレートと説明を表示。
/review # Expands review.md/component Button # Expands with argument/component Button "click handler" # Multiple argumentsテンプレートは位置引数、デフォルト、簡単なスライスをサポート:
$1、$2、… 位置引数$@または$ARGUMENTSで全引数を結合${1:-default}は引数 1 が存在/非空ならそれを使用、そうでなければdefault${@:N}は N 番目(1 始まり)以降の引数${@:N:L}は N から L 個の引数
例:
---description: Create a component---Create a React component named $1 with features: $@デフォルト値は任意引数に便利:
Summarize the current state in ${1:-7} bullet points.使用例:/component Button "onClick handler" "disabled support"
読み込みルール
Section titled “読み込みルール”prompts/でのテンプレート発見は非再帰。- サブディレクトリのテンプレートは
prompts設定またはパッケージマニフェストで明示的に追加。