Skills
Pi advertises each skill by name and description and loads its full instructions on demand; here is how to write the description that makes routing work.
/review from chapter 12 expands when you invoke it. The problem it solves has a sibling: work that the model should recognise as relevant to a task without you naming a command first. Skill selection is model-driven, not a guaranteed trigger.
That is a skill, and the entire mechanism turns on one field you are tempted to rush.
What a skill actually is
skills.md opens with the definition: skills give Pi specialized instructions and supporting files for a particular kind of work. Pi advertises each eligible skill by name and description. The model may then read its SKILL.md when it considers the skill relevant; Pi does not automatically execute the skill on a matching task.
The load side says the same thing: at startup, Pi scans configured skill locations and adds each skill’s name, description, and path to the system prompt. It does not add the full instructions.
flowchart TD
A["startup"] --> B["system prompt carries name, description, path"]
B --> C{"does the model choose to load it?"}
C -->|no| D["body not loaded"]
C -->|yes| E["model reads SKILL.md"]
F["you type /skill:name"] --> G["skill instructions supplied explicitly"]
E --> G2["body enters model context"]
G --> H["model follows instructions"]
G2 --> H
H --> I["supporting files read or scripts run if needed"]
Two properties follow. For skills advertised to the model, the metadata is present before selection; the body is not. This reduces the standing context cost, though many advertised skills still consume tokens. The description is the main signal for model-driven selection, not a guarantee that the model will load the skill.
Wrong: "Pi runs a skill when the task calls for it."
Correct: "Pi advertises the description. The model matches it against the task, and only then reads the body."
The directory
review-guard/
├── SKILL.md
├── scripts/
│ └── run-checks.sh
├── references/
│ └── checklist.md
└── assets/
└── review-template.md
A skill is a directory containing SKILL.md. Pi implements the Agent Skills specification, and most invalid fields produce warnings rather than stopping startup.
SKILL.md
---
name: review-guard
description: Reviews changed code against this repository's conventions and runs its own checks. Use when reviewing a diff, a pull request, or uncommitted changes.
---
# Review guard
1. Run `scripts/run-checks.sh` and read the output before reviewing anything.
2. Read `references/checklist.md` and apply it to the diff.
3. Report findings ordered by severity, each with a file path.
Do not summarise the diff back to the user; report only findings.
The frontmatter is followed by direct instructions. That is the whole file format.
The description is the routing mechanism
skills.md is unusually explicit:
The description determines when the model considers loading the skill. State both what the skill does and when it applies. Avoid descriptions such as “Helps with PDFs,” which do not provide enough routing information.
Compare three descriptions of the same skill:
description: Helps with reviews. # what: vaguely; when: never
description: Reviews code. # what: yes; when: never
description: Reviews changed code against this repository's conventions. Use when reviewing a diff, a pull request, or uncommitted changes. # both
The third gives the model the clearest selection signal. “Reviews code” could plausibly match an implementation task, while “reviews changed code … when reviewing a diff, a pull request, or uncommitted changes” narrows the intended use. It still does not guarantee that the model will select the skill correctly.
This is also why chapter 11’s procedure puts the skill above the template. The wording
that survives scrutiny: the description is text, but it is text delivered through a
routing convention — the model receives it and decides whether to load the body. That
is a real mechanism and it is not the same as /review, which runs because you asked.
Say “routing is a convention the model applies to a description” rather than “routing is
a capability text cannot have”; the second is an absolute, and the description is itself
text doing the routing.
The description will sometimes miss
skills.md says a model might fail to load a relevant skill, and gives the override:
/skill:review-guard
Arguments after /skill:name are appended to the loaded instructions as a user request:
/skill:review-guard src/auth only
Both paths can supply the skill instructions, but they take different routes: model-driven selection requires the model to read SKILL.md, whereas /skill:name explicitly expands the skill instructions into the user request. Neither route guarantees that the model will follow every instruction. If you invoke a skill manually every time, reconsider its description and whether an explicitly invoked template would serve the task better.
Opting out of automatic selection
Set disable-model-invocation: true in frontmatter when a skill should be available only through its explicit command. The enableSkillCommands setting, default true, controls whether skill commands appear in interactive command discovery; manually entered /skill:name commands still work.
That gives you three states worth choosing deliberately:
| State | Frontmatter / setting | Advertised for model selection? | Explicit /skill:name? |
|---|---|---|---|
| Routed and listed | default | Yes | Yes |
| Routed but hidden from discovery menu | enableSkillCommands: false |
Yes | Yes, when entered manually |
| Explicit only | disable-model-invocation: true |
No | Yes |
Portable frontmatter
The Agent Skills specification defines the first six fields below. disable-model-invocation is a Pi-supported selection control, not a field defined by that portable specification.
| Field | Purpose |
|---|---|
name |
Skill name (must match its parent directory in the specification) |
description |
What the skill does and when to use it |
license |
License name or bundled license file |
compatibility |
Environment requirements |
metadata |
Additional key-value metadata |
allowed-tools |
Experimental pre-approved tool list; support varies by implementation |
disable-model-invocation |
Pi-specific: hide the skill from automatic model selection |
Names use lowercase letters, numbers, and hyphens, with no leading, trailing, or consecutive hyphens, at most 64 characters; descriptions at most 1024.
Two behaviours to know. The Agent Skills specification requires the declared name to match the parent directory. Pi 1.0.4 may accept a mismatch without warning, but do not rely on that when writing a portable skill. Pi skips malformed skills and skills without a description; inspect diagnostics rather than assuming the skill loaded. The reported test below establishes that a missing-description skill was not advertised, not that every invalid skill fails silently.
Name collisions keep the first discovered skill and produce a warning. If two skills both claim “review”, the discovery order decides which one you get.
Where skills load from
Place the skill in your user or project skills directory. Directories containing SKILL.md are discovered recursively, so nesting is fine here — unlike prompt templates, which load direct .md children only.
Pi also supports the Agent Skills locations ~/.agents/skills/ and .agents/skills/. Project .agents/skills/ directories are discovered from the working directory through its ancestors, stopping at the repository root when one exists.
Pi accepts some standalone Markdown skills, but a directory containing SKILL.md is the portable form and should be preferred.
Iterate on it
Run Pi from a location where the skill is discoverable, then inspect the startup diagnostics and the /skill:name command. Run /reload after editing a skill during an active session.
The startup header lists the instructions and resources Pi loaded, which is where you confirm the description made it in.
The running example: /review grows a skill
Chapter 11 said the release checklist was the case that outgrew a template. Here is the smaller version, the review guard, at skill scope:
---
name: review-guard
description: Reviews changed code against this repository's conventions and runs its own checks. Use when reviewing a diff, a pull request, or uncommitted changes.
---
# Review guard
1. Run `scripts/run-checks.sh` and read the output before reviewing.
2. Read `references/checklist.md`.
3. Report findings ordered by severity, each with a file path.
Same review task as the template, with a different entry point: the model can choose to load the skill from its advertised description without you typing /review. That selection is not deterministic, and its full SKILL.md enters context only when loaded or explicitly invoked.
The full SKILL.md consumes context when loaded, so a long checklist need not live in the main body. Keep a short set of instructions there and put detailed references in separate files that the model reads when needed. Chapter 14 shows that layout.
What was run
examples/ch13-skills/ creates skills in the user skills directory and inspects the system prompt the provider receives:
- the prompt carries each skill’s name, description and path, and not its body: a marker string placed in the body never appeared;
- a skill with no
descriptionis not advertised; /skill:nameloads the body as the request, with the arguments appended;disable-model-invocation: trueremoves the skill from what the model is told but leaves/skill:nameworking;- skills are discovered recursively, unlike prompt templates;
- of two skills with the same name, exactly one is advertised.
One thing to know when writing your own tests: a skill from the machine running them (~/.agents/skills) is also discovered, so a test that lists every skill will include it.