extending-pi/SKILL.md
Guide for changing or extending Pi's behaviour. Use when someone wants to modify how Pi behaves, add capabilities, decide which Pi extension point or artifact to use, build or package an extension, create an Agent Skill, add prompt templates/themes/context/model providers, configure Pi resources, or asks whether a Pi internal patch is needed.
npx skillsauth add tmustier/pi-extensions extending-piInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Help the user choose what to build, scaffold the right artifact, and package it when useful.
This skill is intentionally not an API reference. Pi's docs, examples, and installed TypeScript types are the source of truth for exact signatures and current behavior.
Pi has multiple public extension points: Agent Skills, context files, prompt templates, themes, packages, model configuration, provider extensions, settings, and TypeScript extensions. Assume one of those is the right answer until proven otherwise; do not jump straight to a TypeScript extension or Pi internal patch.
| Goal | Build a… | Key files / locations | Detailed source of truth |
|------|----------|-----------------------|--------------------------|
| Teach an agent a workflow, domain, or how to use a tool/API/CLI | Agent Skill | SKILL.md plus optional scripts/, references/, assets/ in .agents/skills/, .pi/skills/, or a package | Read skill-creator/SKILL.md and Pi docs docs/skills.md |
| Change Pi runtime behavior, add a typed tool, command, keybinding, event hook, UI, resource loader, provider, renderer, safety gate, or session behavior | Extension | TypeScript extension file in .pi/extensions/, ~/.pi/agent/extensions/, or a Pi package | Read Pi docs docs/extensions.md fully plus relevant examples/extensions/ code first |
| Reuse a prompt pattern with variables | Prompt template | Markdown file in .pi/prompts/, ~/.pi/agent/prompts/, or a package | Read docs/prompt-templates.md |
| Set project-wide or user-wide instructions | Context file | AGENTS.md, CLAUDE.md, SYSTEM.md, or APPEND_SYSTEM.md as appropriate | Read the README Context Files / System Prompt sections |
| Change Pi's appearance | Theme | JSON theme in .pi/themes/, ~/.pi/agent/themes/, or a package | Read docs/themes.md |
| Add or route models/providers | models.json or a provider extension | ~/.pi/agent/models.json for supported APIs; extension for OAuth, dynamic discovery, or custom streaming | Read docs/models.md and docs/custom-provider.md |
| Share any of the above | Pi package | package.json with a pi key or conventional extensions/, skills/, prompts/, themes/ directories | Read docs/packages.md |
Use this before touching Pi internals:
Use Agent Skill / Agent Skills when referring to the artifact, rather than client-specific names. Skills follow the Agent Skills standard and can be used by multiple agent clients. It is fine to say "Pi loads Agent Skills from…" when discussing Pi-specific discovery paths.
If instructions plus normal tools are enough, prefer an Agent Skill. If the harness itself must change behavior, prefer an Extension.
Examples:
rm -rf" → Extension (intercept tool calls)db_query tool" → ExtensionUse this when the chosen artifact is a Pi TypeScript extension or provider extension.
Agents often miss existing Pi extension points by reading only the first matching section or doing a heading search. Do the full extension audit:
docs/extensions.md fully. Extension capabilities are spread across hooks, tools, commands, keybindings, resource loaders, renderers, session/compaction events, settings, and linked docs.docs/tui.md, docs/themes.md, docs/models.md, docs/custom-provider.md, docs/packages.md, docs/keybindings.md, docs/session-format.md, or docs/compaction.md.examples/extensions/README.md and at least one matching example under examples/extensions/. Copy current structure rather than inventing from memory.dist/core/extensions/types.d.ts, dist/core/index.d.ts, and the matching src/ files when available.Patch-level changes are extremely rare. They are appropriate only for core bugs, truly missing primitives, or behavior that genuinely cannot be expressed through public Pi extension points. Pi maintainers receive many AI-generated PRs; protect their time by avoiding speculative patches and only proposing changes you understand.
Before working on a patch:
earendil-works/pi: CONTRIBUTING.md and AGENTS.md.pi --no-skills --skill /path/to/skill or invoke /skill:name; if it does not trigger, check name and description frontmatter.pi -e ./path/to/extension.ts; for iterative work, put the extension in .pi/extensions/ or ~/.pi/agent/extensions/ so /reload picks it up./reload or restart where required.package.json with a pi manifest or conventional resource directories, then test with pi install ./path or a git/npm source.tools
Create or update Agent Skills (SKILL.md plus optional scripts, references, or assets). Use when someone asks to design a new Agent Skill, refine an existing one, or structure skills for Pi discovery, packaging, or other Agent Skills-compatible clients.
development
Long-running iterative development loops with pacing control and verifiable progress. Use when tasks require multiple iterations, many discrete steps, or periodic reflection with clear checkpoints; avoid for simple one-shot tasks or quick fixes.
development
Long-running iterative development loops with pacing control and verifiable progress. Use when tasks require multiple iterations, many discrete steps, or periodic reflection with clear checkpoints; avoid for simple one-shot tasks or quick fixes.
tools
Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.