コンテンツにスキップ

プロンプトテンプレート

pi はプロンプトテンプレートを作成できます。ワークフロー用のテンプレートを構築するよう依頼してください。

プロンプトテンプレートは完全なプロンプトに展開される Markdown スニペットです。エディターで /name と入力してテンプレートを呼び出します。name.md を除いたファイル名です。

Pi は次の場所からプロンプトテンプレートを読み込みます:

  • グローバル:~/.pi/agent/prompts/*.md
  • プロジェクト:.pi/prompts/*.md(プロジェクトが信頼された後)
  • パッケージ:prompts/ ディレクトリまたは package.jsonpi.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 analysis
argument-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"

  • prompts/ でのテンプレート発見は非再帰。
  • サブディレクトリのテンプレートは prompts 設定またはパッケージマニフェストで明示的に追加。