Pi 구성, 확장, 플랫폼 설정 및 API 참조.

프롬프트 템플릿

pi는 prompt templates을 생성할 수 있습니다. 귀하의 작업 흐름을 위한 하나를 구축하도록 요청하십시오.

프롬프트 템플릿은 전체 프롬프트로 확장되는 Markdown 스니펫입니다. 템플릿을 호출하려면 편집기에 /name를 입력하세요. 여기서 name.md가 없는 파일 이름입니다.

위치

Pi는 다음에서 prompt templates을 로드합니다.

  • 글로벌: ~/.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는 선택사항입니다. 설정하면 자동 완성 드롭다운의 설명 앞에 힌트가 표시됩니다.

인수 힌트

자동 완성에 예상되는 인수를 표시하려면 머리말에 argument-hint를 사용하세요. 필수 인수에는 <angle brackets>를 사용하고 선택 인수에는 [square brackets]를 사용하세요.

---
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
  • ${@:-default} 또는 ${ARGUMENTS:-default}는 존재하거나 비어 있지 않은 경우 모든 인수를 사용하고, 그렇지 않은 경우 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 설정이나 패키지 매니페스트를 통해 명시적으로 추가하세요.