干货教程:怎么写一个好用的 Skill
TL;DR - A practical tutorial on authoring Agent Skills — the SKILL.md-based, portable capability packages used by Claude Code, Cursor, OpenCode and similar agent tools — covering file layout, metadata format, context-budget design, and installation workflows.
- Structure: A Skill is a folder with a required
SKILL.md(YAML frontmatter for routing + Markdown body for execution) plus optionalscripts/,references/, andassets/. Required fields arename(kebab-case) anddescription; optionalversion,author,tags. - Progressive disclosure: Three loading tiers to conserve context — metadata only at startup (~100 tokens/skill), full SKILL.md on match (~1k–5k tokens), and scripts/reference docs loaded on demand during execution.
- Tooling: Each agent tool has its own skills directory (
~/.claude/skills/,~/.cursor/skills/,~/.opencode/skills/,~/.joycode/skills/);openskills(npm) installs and syncs skill packs across tools and generates anAGENTS.mdfor discovery. OpenClaw usesnpx clawhub install <skill>plus per-agent YAML enablement. - Authoring rules: Single responsibility per skill, descriptions that state WHAT + WHEN, omit knowledge the model already has, push edge cases into
references/, use specific names, and build in self-correction/verification steps in the workflow.