How to Write Your First Agent Skill
说明与用途
将代理技能创建为 SKILL.md 文件可保存规则并消除漂移,确保生成提交消息和其他任务的稳定、可重复流程。
问题
Agents drift from user‑defined house rules because the rules are pasted into the chat each session instead of being stored in a reusable file.
结果
Storing agent rules in a skill file eliminates drift, reduces repetitive pasting, and provides a clear, reusable workflow for generating commit messages and other tasks.
工作流
- Create a folder for the skill and add a file named SKILL.md.
- Add YAML frontmatter with a name and a description that serves as a trigger.
- Write the description as "does X. Use when the user asks for Y.".
- Write the body in plain markdown: the workflow, rules, example, and anti‑patterns.
- Drop the folder into the agent’s skills directory so the agent loads it automatically.
- Use the skill by invoking the agent; it matches the description to trigger the workflow.
证据
A skill is a folder containing one file: SKILL.md. It has two parts.
The description is the trigger: the agent scans the descriptions of its skills to decide which ones apply to your request.
Drop the folder into your agent's skills directory, and the agent picks it up by matching the description — no further configuration.
- 记录日期: 2026-10-06T02:41:09.737Z