write-a-skill
- 信任分
- 88/100
- 兼容 Agent
- 1
- 领域
- 效率工具
- 兼容 Agent
- Claude Code
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @mattpocock · 未声明 license
- 安装命令数
- 1 条
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
想读作者英文原文? ↓ 滚到正文区切换 · 在 GitHub 查看 ↗
write-a-skill 把「写一个 skill」做成一份 step-by-step 工作流:先收需求、再起草、再 review。它是给「想写一个新 skill 但不知从何下手」的人用的、相对入门的入口;与 skill-creator(评估驱动的元 skill)和 writing-skills(写作语调)互补。
设计思路
作者把 skill 写作的关键放在两件事——目录骨架与description。前者决定 skill 在文件系统里能不能被路由发现;后者决定 agent 在系统提示里到底会不会拉这份 skill。其他文件(REFERENCE / EXAMPLES / scripts)都是按需扩展。
工作流
1 Gather requirements — 问清楚:这个 skill 覆盖什么任务 / 域?要处理哪些具体 use case?需要 executable script 还是只要 instruction?有什么参考材料要带?2 Draft the skill — 起草:SKILL.md 含 concise instructions;超过 500 行就拆 REFERENCE.md / EXAMPLES.md;有确定性操作就加 utility script。3 Review with user — 把草稿给用户看,问:覆盖了你的 use case 吗?哪里缺 / 不清晰?哪一节要更详细 / 更精简?
目录骨架
skill-name/
├── SKILL.md # 主指令(必须)
├── REFERENCE.md # 详细文档(按需)
├── EXAMPLES.md # 用例(按需)
└── scripts/ # 工具脚本(按需)
└── helper.js
Description 是命脉
作者反复强调:description 是 agent 选 skill 时唯一看到的东西——和所有已装 skill 一起出现在 system prompt,agent 据此决定是否加载。要给 agent 足够信息回答两件事:① 这 skill 提供什么能力;② 何时 / 为何触发它(关键词、上下文、文件类型)。格式:≤ 1024 字、第三人称、第一句说做什么、第二句 "Use when [specific triggers]"。好示例:「Extract text and tables from PDF files, fill forms, merge documents. Use when working with PDF files or when user mentions PDFs, forms, or document extraction.」坏示例:「Helps with documents.」——这句话让 agent 没法把它跟其他 document skill 区分开。
何时加 script
确定性操作(验证、格式化);同样的代码会被反复生成;错误需要明确处理——这些情况下 script 比让 LLM 现写更省 token、更可靠。
适合谁
- 第一次写 skill 的人
- 想把已有的「内部 playbook」沉淀为 skill
- 团队希望统一所有新 skill 的目录结构与 description 格式
何时不要用
- 已经有现成同类 skill 可改:直接
cp -r改字段更省事 - 内容只是一段 prompt 模板:写在
writing-fragments里更轻量
配套
skill-creator(评估驱动的元流程)、template-skill(最小骨架)、writing-skills(写作语调)、skillify(从抓取原型沉淀为 browser-skill)。
Writing Skills
Process
Gather requirements - ask user about:
- What task/domain does the skill cover?
- What specific use cases should it handle?
- Does it need executable scripts or just instructions?
- Any reference materials to include?
Draft the skill - create:
- SKILL.md with concise instructions
- Additional reference files if content exceeds 500 lines
- Utility scripts if deterministic operations needed
Review with user - present draft and ask:
- Does this cover your use cases?
- Anything missing or unclear?
- Should any section be more/less detailed?
Skill Structure
skill-name/
├── SKILL.md # Main instructions (required)
├── REFERENCE.md # Detailed docs (if needed)
├── EXAMPLES.md # Usage examples (if needed)
└── scripts/ # Utility scripts (if needed)
└── helper.js
SKILL.md Template
---
name: skill-name
description: Brief description of capability. Use when [specific triggers].
---
# Skill Name
## Quick start
[Minimal working example]
## Workflows
[Step-by-step processes with checklists for complex tasks]
## Advanced features
[Link to separate files: See [REFERENCE.md](REFERENCE.md)]
Description Requirements
The description is the only thing your agent sees when deciding which skill to load. It's surfaced in the system prompt alongside all other installed skills. Your agent reads these descriptions and picks the relevant skill based on the user's request.
Goal: Give your agent just enough info to know:
- What capability this skill provides
- When/why to trigger it (specific keywords, contexts, file types)
Format:
- Max 1024 chars
- Write in third person
- First sentence: what it does
- Second sentence: "Use when [specific triggers]"
Good example:
Extract text and tables from PDF files, fill forms, merge documents. Use when working with PDF files or when user mentions PDFs, forms, or document extraction.
Bad example:
Helps with documents.
The bad example gives your agent no way to distinguish this from other document skills.
When to Add Scripts
Add utility scripts when:
- Operation is deterministic (validation, formatting)
- Same code would be generated repeatedly
- Errors need explicit handling
Scripts save tokens and improve reliability vs generated code.
When to Split Files
Split into separate files when:
- SKILL.md exceeds 100 lines
- Content has distinct domains (finance vs sales schemas)
- Advanced features are rarely needed
Review Checklist
After drafting, verify:
- Description includes triggers ("Use when...")
- SKILL.md under 100 lines
- No time-sensitive info
- Consistent terminology
- Concrete examples included
- References one level deep