一键导入
create-a-skill
Template and conventions for creating new skills — SKILL.md structure, CLI patterns, test harness, and gotchas.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Template and conventions for creating new skills — SKILL.md structure, CLI patterns, test harness, and gotchas.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
GitHub CLI (gh) — the official command-line interface to GitHub. Use when the user needs to create or manage pull requests, issues, repositories, GitHub Actions, gists, API calls, authentication, or any other GitHub workflow from the terminal. Also use for scripting GitHub automation, querying the GraphQL/REST API, managing forks/clones, and viewing workflow run logs. Prefer gh over web browsing or the raw REST API.
CLI for Gmail via Google's REST API — list, search, read, send, draft, label, delete. Use for all Gmail email operations.
Draft, post, and review Dan's LinkedIn posts (handle saattrupdan) via the `linkedin` CLI, which drives the real LinkedIn web UI with agent-browser. Use when the user wants to write/post a LinkedIn post, save or view a draft, or fetch their recent posts with engagement stats. Also use whenever drafting LinkedIn content, to match Dan's voice and formatting.
Edit Microsoft Excel .xlsx files in place while preserving all formatting — surgical raw-OOXML cell editing that keeps styles, charts, data validations, formulas and named ranges intact. Use when filling in or revising .xlsx workbooks (bid sheets, budgets, forms, trackers) rather than regenerating them.
Edit Microsoft Word .docx files in place while preserving all formatting — surgical raw-OOXML editing, Word comments, page breaks, character-limit fields. Use when filling in or revising .docx documents (grant applications, forms, reports) rather than regenerating them.
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.
| name | create-a-skill |
| description | Template and conventions for creating new skills — SKILL.md structure, CLI patterns, test harness, and gotchas. |
| last-updated | "2026-06-02T00:00:00.000Z" |
This skill documents the standard framework for creating skills in the Pi agent system. Use it as a checklist and template when adding new capabilities.
A complete skill has these components:
skills/your-skill-name/
├── SKILL.md # Procedural instructions, API reference, examples
├── README.md # User docs: requirements, quickstart, commands
├── your_skill/ # Python CLI package (standard library only)
│ ├── __init__.py
│ └── main.py
├── pyproject.toml # Package metadata
└── tests/
└── test.ts # Automated test harness (Bun)
Naming convention (from existing skills):
| Skill | Package | CLI |
|---|---|---|
bolig-dk | bolig_dk | bolig |
transport-dk | transport_dk | transport |
lex-dk | lex_dk | lexdk |
dmi-dk | dmi_dk | dmi |
---
name: your-skill-name
description: One-line description of when the agent should use this skill.
last-updated: YYYY-MM-DD
---
| Section | Purpose |
|---|---|
| CLI | How to install/run (which <cmd>, pipx install -e), standard library note |
| Prerequisites | Dependencies, auth requirements, VPN needs |
| Commands | Table: command → purpose; then subsections with examples |
| Common tasks | "How do I X?" patterns (optional, for complex skills) |
| How it works | API endpoints, auth models, robustness notes |
| Limits | What's out of scope, rate limits, known issues |
| Etiquette / Licence | If applicable (robots.txt, TDM opt-out, etc.) |
which <cmd>, curl -I <endpoint>, etc.# <skill-name>
One-line pitch — what domain it covers, which APIs/sources it merges.
## Requirements
- `<cmd>` CLI — standard library only (`pipx install -e .`)
- Internet access to `api.example.com`, `www.example.dk`
- Any auth/VPN requirements (document here)
## Quick start
```bash
<cmd> foo --option value # brief comment
<cmd> bar -k keyword --limit 5 # another example
<cmd> baz # third example
Add --raw to any command for unformatted JSON.
| Command | Purpose |
|---|---|
foo | Does X |
bar | Does Y with Z |
baz | Lists all Q |
https://api.example.com/v1/...)# Format code
uv run ruff format .
# Lint code
uv run ruff check .
# Run tests
bun run tests/test.ts
**Keep README concise** — detailed API reference, auth models, and gotchas belong in SKILL.md.
---
## 3. CLI Implementation
### Package Structure
your_skill/ ├── init.py # Version, exports └── main.py # argparse, commands, API clients
### Conventions
- **Standard library only** unless external deps are essential
- **argparse** for CLI, with subcommands
- **User-Agent header** on all HTTP requests
- **`--raw` flag** on every command for unformatted JSON output
- **Graceful degradation**: If API fails, explain why and suggest alternatives
- **No hardcoded credentials**: Use environment variables or explicit auth flows
### CLI Entry Point
```python
from __future__ import annotations
import argparse
import sys
def main() -> None:
parser = argparse.ArgumentParser(prog="<cmd>", description="...")
sub = parser.add_subparsers(dest="cmd", required=True)
# ... add subcommands
args = parser.parse_args()
args.func(args)
if __name__ == "__main__":
main()
[project]
name = "your-skill-name"
version = "1.0.0"
description = "CLI for ..."
requires-python = ">=3.12"
[project.scripts]
your-cmd = "your_skill.main:main"
[build-system]
requires = ["setuptools>=68.0", "wheel"]
build-backend = "setuptools.build_meta"
#!/usr/bin/env bun
import { $ } from "bun";
import { readFileSync } from "fs";
import { join, dirname } from "path";
const SKILL_DIR = join(dirname(import.meta.path), "..");
const SKILL_FILE = join(SKILL_DIR, "SKILL.md");
const SKILL_NAME = "your-skill-name";
// Test prompts (natural user questions, NOT CLI documentation)
const TEST_PROMPTS: string[] = [
// English prompts with strong triggers (locations, site names, currency)
"I need X in Copenhagen",
"Find Y under 10,000 kr",
// Danish prompts with strong triggers
"Jeg leder efter X i København",
"Find Y under 10.000 kr",
];
// Pre-flight checks, runPrompt, evaluateResults, runTestIteration, printResults, main
| Do | Don't |
|---|---|
| "I need a rental apartment in Frederiksberg with a bathtub" | "Can I find rentals?" (too generic) |
| "Looking for a house in Odense, budget 3 million kr" | "Show me houses for sale" (no location) |
| "Find listings on boligportal.dk mentioning 'badekar'" | "Search with keywords" (no site context) |
Rule: Every prompt must have at least one strong trigger:
async function preflightChecks() {
const errors: string[] = [];
// Skill file exists
readFileSync(SKILL_FILE, "utf-8");
// CLI installed
await $`which your-cmd`.quiet();
await $`your-cmd --help`.quiet();
// Python code quality
await $`uv run ruff format --check your_skill/`.quiet();
await $`uv run ruff check your_skill/`.quiet();
return { ok: errors.length === 0, errors };
}
pi -p "<prompt>"pi -p "<eval-prompt>" with SKILL.md + results[{test, passed, reason}, ...]cd skills/your-skill-name
bun run tests/test.ts
Add frontmatter to SKILL.md:
autoload:
tools:
- read
- write
- bash
extensions:
- .py
files:
- pyproject.toml
paths:
- your_skill/**/*.py
Or use files: for basename matching, paths: for globs. See system/skill-autoload-path-matching memory.
Before considering a skill "done":
--help on all commands--raw flag on every commandruff format and ruff checkIf keyword search hangs, the --max-scan default is too high. Start with 30–50 for rent, 50–100 for buy.
_add_keyword_opts(p, default_scan=30) # Not 100!
Prompts without location or site context may not trigger the skill. Always include:
If testing in builder worktrees, project-scoped memories may not resolve. Use system scope for cross-cutting test config.
Never interpolate raw toolCallId values into RegExp — escape them first. Some IDs contain |, +, /, = which break regex.
Study these for reference:
| Skill | Domain | Notes |
|---|---|---|
bolig-dk | Housing | Full example with rent + buy, keyword search |
transport-dk | Public transit | Multiple APIs merged (Rejseplanen, DSB, Metro) |
lex-dk | Encyclopedia | Read-only, anonymous API |
email | Requires auth (IMAP/SMTP or OAuth) | |
agent-browser | Browser automation | Headless browser, JavaScript-heavy sites |
--raw flag--max-scan, timeout, match modefiles:, paths:, extensions: