返回 Skill 列表
入门必看入门
Skill 最佳实践和踩坑经验
写 Skill 的注意事项:粒度控制、错误处理、性能优化。来自真实项目经验总结。
📋 SKILL.md 完整代码
--- name: skill-best-practices description: >- 写 Skill 的注意事项:粒度控制、错误处理、性能优化。来自真实项目经验总结。 Use when working on skill best practices tasks. allowed-tools: Read,Write,Bash --- # Skill 最佳实践和踩坑经验 ## Quick Start 1. Save as `~/.claude/skills/skill-best-practices/SKILL.md` 2. Restart Claude Code 3. Type `/skill-best-practices` or describe your task naturally 4. Claude auto-triggers when your task matches the description ## Instructions - Understand the user's specific context and needs - Apply domain best practices consistently - Provide actionable, specific guidance with examples - Verify all outputs before presenting to user ## Gotchas - Test with a fresh Claude instance after changes - Keep SKILL.md under 500 lines; use references/ for details - Description is the trigger key — make it specific and keyword-rich
🚀 怎么用
1. 复制上面的 SKILL.md 代码 2. 保存为 ~/.claude/skills/skill-best-practices/SKILL.md 3. 重启 Claude Code 4. 输入 /skill-best-practices 或直接描述任务触发 5. AI 自动按 Skill 流程执行
DO ✅
一个 Skill 只做一件事,做到极致。给明确的输入输出格式。放失败处理逻辑——遇到问题怎么办。用真实例子教 AI。写完先人工测试 3-5 次再正式用。必须有 Gotchas 章节——从真实失败中积累。
DON'T ❌
不要写超过 500 行的 Skill——AI 容易迷失。不要让多个 Skill 功能重叠。不要忽略错误处理。不要写一次就当成品——好 Skill 是用出来的。不要放 README/CHANGELOG——Skill 写给 AI 看,不是写给人看。
常见反模式
Windows 路径 scripts\helper.py→用正斜杠。深层嵌套引用 a→b→c→只允许一层。太多选项无默认值→提供默认+逃生口。术语不一致→全文统一用词。Description 模糊→具体+触发词。