Skills & Prompt Templates

Lesson 5: Skills & Prompt Templates

Two complementary ways to package knowledge for the agent. Skills are self-contained capability packages loaded on demand; prompt templates are Markdown snippets that expand into full prompts when you type /name. Pi can even create both for you โ€” just ask it.

Skills: the Agent Skills standard

Pi implements the open Agent Skills standard (agentskills.io), which means skills written for other harnesses mostly work here. A skill is a directory with a SKILL.md file: YAML frontmatter (name, description) plus body content โ€” setup instructions, workflows, helper scripts, reference docs.

~/.pi/agent/skills/        # global
~/.agents/skills/          # global, shared across agents
.pi/skills/                # project-local (after trust)
.agents/skills/            # project-local, shared

# invoke with:
/skill:name

Skills are loaded on demand: pi keeps their description in the model's view and only injects the full content when the task matches. That is their superpower โ€” capability without constant context cost. The docs also cover skill repositories for distributing collections.

Security: Skills can instruct the model to perform any action and may include executable code the model invokes. Review skill content before use.

Prompt templates

A template is a Markdown file whose filename becomes a slash command. Type /review and review.md expands inline into the editor. Frontmatter can add a description and an argument-hint that renders in autocomplete:

---
description: Review staged git changes
argument-hint: "<PR-URL>"
---
Review the staged changes (`git diff --cached`). Focus on:
- Bugs and logic errors
- Security issues
- Error handling gaps

Locations: ~/.pi/agent/prompts/*.md (global), .pi/prompts/*.md (project), package prompts/ dirs, a prompts array in settings, or --prompt-template <path> flags. Discovery is non-recursive; subdirectories need explicit registration. --no-prompt-templates disables them.

Template arguments

$1 $2 ...          positional args
$@ / $ARGUMENTS    all args joined
${1:-default}      arg with fallback
${@:-default}      all args with fallback
${@:N}             args from position N
${@:N:L}           L args starting at N

# usage: /component Button "click handler" "disabled support"
---
description: Create a component
---
Create a React component named $1 with features: $@
๐Ÿช™ Token angle: Skills are the textbook "pay only when used" pattern: a skill's full instructions cost tokens only in the turns where it's actually needed, instead of being baked into every request like a global system prompt. Prompt templates make you (and teammates) send tighter, more consistent prompts โ€” and argument-hint frontmatter plus precise $1/${1:-default} expansion means the model gets exactly the shape of request you intended, no rambling preamble. Both are cheaper than typing the same paragraph by hand each time.

Further Reading

๐Ÿง  Knowledge Check

1. When does pi load a skill's full content into context?

2. What file defines a skill, and in what format?

3. In a prompt template, what does ${1:-default} mean?