Pi Agent: Skills System
Last updated: 2026-08-31
Skills are the Agent's "professional certificates" — load code review, it's a reviewer; load translation, it's a translator.
1. What Are Skills
A Skill is a combination package of tools, prompt templates, and configuration that defines an Agent's complete capability in a domain:
TEXT
📖 Display only
Skill = Prompt Template + Tool List + Config Parameters + Examples
Example:
code_review skill =
Prompt ("You are a code review expert...") +
Tools (file_reader, search) +
Config (temperature=0.3, max_tokens=2048)
2. Built-in Skills
| Skill | Description | Tools |
|---|---|---|
| code_review | Code review | file_reader |
| bug_fix | Bug fixing | file_reader, search |
| test_gen | Test generation | file_reader, shell |
| doc_gen | Documentation generation | file_reader |
| translate | Multi-language translation | — |
| summarize | Content summarization | file_reader |
| search_assistant | Search assistant | search |
| data_analyst | Data analysis | file_reader, calculator |
(1) Using Built-in Skills
PYTHON
from pi_agent import Agent
agent = Agent(name="reviewer")
result = agent.run(skill="code_review", code="def add(a,b): return a+b")
(2) CLI Skill Usage
BASH
pi-agent chat --skill code_review "Review main.py"
pi-agent run --skill translate --lang ja "Translate this text"
3. Custom Skills
(1) YAML Definition
Create ~/.pi-agent/skills/api_designer.yaml:
YAML
name: api_designer
description: "REST API design expert"
version: "1.0"
system_prompt: |
You are a REST API design expert.
Follow these principles:
1. Use plural nouns for resource paths
2. Express operations with HTTP methods
3. Return appropriate HTTP status codes
4. Design consistent error response formats
tools:
- file_reader
- search
parameters:
temperature: 0.3
max_tokens: 4096
(2) Python Definition
PYTHON
from pi_agent import Agent, Skill
api_skill = Skill(
name="api_designer",
description="REST API design expert",
system_prompt="You are a REST API design expert following best practices",
tools=["file_reader", "search"],
parameters={"temperature": 0.3, "max_tokens": 4096}
)
agent = Agent(name="api_guy", skills=[api_skill])
result = agent.run(skill="api_designer", prompt="Design a blog system API")
4. Skill Composition
Multiple skills can be used together:
Example 1: Full-Stack Dev Skill Pack (Difficulty: ⭐⭐)
PYTHON
from pi_agent import Agent, Skill
review_skill = Skill(name="code_review", tools=["file_reader"])
fix_skill = Skill(name="bug_fix", tools=["file_reader", "shell"])
test_skill = Skill(name="test_gen", tools=["file_reader", "shell"])
agent = Agent(
name="full_stack",
skills=[review_skill, fix_skill, test_skill]
)
review = agent.run(skill="code_review", code=source_code)
fix = agent.run(skill="bug_fix", code=source_code, issues=review)
tests = agent.run(skill="test_gen", code=fix)
5. Skill Parameters
Skills can define custom parameters:
YAML
name: translator
parameters:
temperature: 0.5
max_tokens: 4096
custom_params:
source_lang:
type: string
default: "en"
target_lang:
type: string
required: true
style:
type: string
default: "formal"
enum: ["formal", "casual", "technical"]
PYTHON
result = agent.run(
skill="translator",
text="Hello World",
target_lang="ja",
style="technical"
)
6. Skill Management
BASH
pi-agent skills list
pi-agent skills show code_review
pi-agent skills install community/web-scraper
pi-agent skills create my_skill --tools file_reader,shell
FAQ
Q Difference between skills and tools?
A A tool is a single capability (e.g., "read file"), while a skill is a combo of tool + prompt + config (e.g., "code review" = file_reader tool + review prompt + low temperature).
Q Can skills be switched dynamically?
A Yes. Use
/skill in interactive mode, or agent.run(skill=...) to specify different skills per call.Q Is there a skill marketplace?
A Pi Agent has a community skill repo. Use
pi-agent skills search <keyword> to find them. See Lesson 17 for packages.Summary
- Skill = prompt + tools + config combination
- 8 built-in skills; custom via YAML or Python
- Skills are composable, parameterizable, and shareable
- Manage skills through CLI and API
Exercises
- Basic (Difficulty: ⭐): Use the built-in code_review skill to review some code.
- Intermediate (Difficulty: ⭐⭐): Create a custom "SQL Optimization Advisor" skill with appropriate prompts and tools.
- Advanced (Difficulty: ⭐⭐⭐): Design a "DevOps Engineer" skill pack with log analysis, deployment check, and monitoring config sub-skills.