Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Pi Agent Skills System

Pi Agent Skills System

Skills are self-contained capability packages that let AI load workflow instructions and tool scripts for specialized domains on demand.

Pi Agent implements the Agent Skills standard。


What is a Skill

A Skill is simply a directory containing a SKILL.md file.

SKILL.md contains the skill's name, description, and detailed usage instructions, which AI reads and follows when needed.

You can think of a Skill as an AI's "professional training manual" — it takes up no context space normally and is loaded only when needed.


How Skills work

The loading process has four steps; the core idea is "look at the directory first, then read the full text".

  1. At startup, Pi Agent scans all Skill locations and extracts names and descriptions
  2. Descriptions of all available Skills are embedded in the system prompt in XML format
  3. When a user's task matches a Skill's description, AI automatically uses the read tool to load the full SKILL.md
  4. AI works according to the instructions in SKILL.md, referencing scripts and resources in the skill directory with relative paths

Note that the model may not read proactively; when necessary, state it explicitly in the prompt or force loading with /skill:name.

This design is called "progressive disclosure" — only descriptions stay in context at all times, while full instructions are loaded on demand.


Skill directory structure

Only SKILL.md is required; other directories are created as needed.



my-skill/

├── SKILL.md              # 必需:Frontmatter + 指令

├── scripts/              # 辅助脚本

│   └── process.sh

├── references/           # 详细参考文档(按需加载)

│   └── api-reference.md

└── assets/

    └── template.json


SKILL.md format

SKILL.md uses YAML Frontmatter to define metadata, followed by instruction body in Markdown format:

Example


name: my-skill

description: What this skill does and when to use it. Be specific and clear.

My Skill

Installation

Run before first use:

 cd ~/projects/brave-search-skill && npm install      

Use

 bash scripts/process.sh       

Reference

See details in

Reference guide

When referencing files in the skill directory, use relative paths.


Frontmatter fields

Only name and description are required; other fields are added as needed.

Field Required Description
name Is Up to 64 characters, lowercase letters/digits/hyphens only. Pi Agent does not require the name to match the parent directory
description Is Up to 1024 characters. Describes what the skill does and when to use it; this is the basis on which AI decides whether to load the skill
license No License name
compatibility No Up to 500 characters, environment requirements
metadata No Custom key-value pairs
allowed-tools No Pre-approved tool list (experimental)
disable-model-invocation No When set to true, the Skill is hidden from the system prompt and can only be invoked manually via /skill:name

description is the key basis on which AI decides whether to load your Skill, so write it specifically and clearly.

A vague description can cause the Skill to trigger in inappropriate scenarios or be ignored when it is needed.


Skill loading locations

Pi Agent scans for Skills at both global and project levels; discovery rules differ slightly by location.

Position Scope Load rules
~/.pi/agent/skills/ Global Root-level .md files and directories containing SKILL.md are discovered recursively
~/.agents/skills/ Global Only directories containing SKILL.md are discovered recursively; root-level .md files are ignored
.pi/skills/ Projects Root-level .md files and directories containing SKILL.md are discovered recursively
.agents/skills/ Projects Only directories containing SKILL.md are discovered recursively
Pi Packages Global or project The skills/ directory or the pi.skills entry in package.json
CLI Current run --skill path explicitly loads a skill; can be passed multiple times

One more note: in ~/.agents/skills/ and the project's .agents/skills/, nested .md files in grouped subdirectories that declare valid Frontmatter are also recognized, while top-level .md files without Frontmatter are ignored.

The CLI argument --no-skills disables automatic skill discovery, but explicitly given --skill paths are still loaded.


Validation and naming conflicts

Pi Agent validates Skills against the Agent Skills standard; most issues only produce a warning and the Skill still loads.

A SKILL.md without a description is not loaded; malformed files likewise only produce a warning and are not loaded.

When Skills with the same name come from different locations, a warning is issued and the first discovered one is kept.


Skill commands

Each Skill is automatically registered as a /skill:name command:



/skill:brave-search

/skill:pdf-tools extract

Arguments after the command are appended to the Skill content in the form "User: arguments".

Taking /skill:pdf-tools extract report.pdf as an example, the expanded content looks roughly like this:



/skill:pdf-tools extract report.pdf



User: extract report.pdf

After receiving this content, AI follows the instructions in SKILL.md to find and execute scripts in the scripts/ directory.

Skill command registration can be disabled via a setting:

Example

// File path: ~/.pi/agent/settings.json

{

  "enableSkillCommands": false

}

You can also use disable-model-invocation in settings so that certain Skills can only be invoked manually and do not appear automatically in the system prompt.


Importing Skills from other tools

Pi Agent can load Skills from Claude Code or OpenAI Codex:

The two configurations below write to the global and project settings.json respectively; adjust the paths to your actual directories.

Example

// File path: ~/.pi/agent/settings.json (global import)

{

  "skills": [

    "~/.claude/skills",

    "~/.codex/skills"

  ]

}

For project-level Claude Code Skills:

Example

// File path: .pi/settings.json (project-level import)

{

  "skills": ["../.claude/skills"]

}

Instructions in Skills can ask AI to perform arbitrary actions, including running executables.

Before using a third-party Skill, it is recommended to review its content.


Complete Skill example

Here is a complete example of a web search Skill:

Example


name: brave-search

description: Web search and content extraction via the Brave Search API. Suitable for searching documentation, fact queries, or any web content retrieval.

Brave Search

Installation

Install dependencies before first use:

 cd ~/projects/brave-search-skill && npm install      

Search

 # 用 node 执行,无需可执行权限      

 node scripts/search.js "查询关键词"              # 基础搜索      

 node scripts/search.js "查询关键词" --content    # 包含页面内容      

       

 # If permissions are already set (chmod +x scripts/search.js), you can execute it directly

 ./scripts/search.js "查询关键词"      

Extract page content

 node scripts/content.js https://example.com      


Recommended Skill repositories

These two repositories provide a large number of ready-to-use Skills; it is still recommended to read through the content before installing.

Repository Content focus Applicable scenarios
Anthropic Skills Document processing (docx, pdf, pptx, xlsx), web development Batch processing of everyday office documents, front-end page building
Pi Skills Web search, browser automation, Google API, audio transcription Tasks requiring online data retrieval, automated operations, and multimedia transcription