writing-agent-skills
npx machina-cli add skill msewell/agent-stuff/writing-agent-skills --openclawWriting Agent Skills
Workflow: Creating a new skill
- Clarify scope. Ask what task the skill should teach an agent to perform. Identify what context an agent lacks — that gap is the skill's content.
- Choose a name. Lowercase, hyphens only, 1–64 chars. Prefer gerund form
(e.g.,
processing-pdfsoverpdf-processor). Must match directory name. - Write the description. This is the most important text in the skill — it controls when the skill activates. Write in third person. State both what the skill does AND when to use it. Include keywords matching how users phrase requests. Max 1024 chars.
- Write the body. Use imperative form. Include only what the agent cannot already know. Keep under 500 lines (~5000 tokens).
- Apply progressive disclosure. If content exceeds 500 lines, move
detailed information into
references/files. Link fromSKILL.md— keep all references one level deep (no chains). - Add scripts only if needed. Include bundled scripts when the same code is rewritten repeatedly or deterministic reliability matters.
- Validate. Check against the pre-ship checklist in references/organizing-and-checklist.md.
Workflow: Reviewing an existing skill
- Read the skill's
SKILL.mdand all bundled files. - Check for these common problems:
- Weak description — vague, missing keywords, wrong point-of-view
- Kitchen sink — body over 500 lines without progressive disclosure
- Teaching known things — explaining what the agent already knows
- Too many options — listing alternatives without picking a default
- Nested references — chains deeper than one level from
SKILL.md - Extraneous files — README.md, CHANGELOG.md, etc.
- Inconsistent terminology — mixing synonyms for the same concept
- Propose specific fixes with before/after examples.
Key rules
- The context window is a public good. Every token competes with conversation history. Only include what the agent cannot already know.
- Make choices for the agent. Pick a default approach; offer alternatives only for specific edge cases.
- Set appropriate degrees of freedom. Fragile operations need exact instructions; open-ended tasks need general direction.
- Description drives discovery. "When to use" belongs in the
descriptionfrontmatter, not in the body. - No extraneous files. No README, CHANGELOG, INSTALLATION_GUIDE, or QUICK_REFERENCE inside a skill.
Starter template
---
name: my-skill-name
description: "[What it does]. [What it produces or transforms]. Use when [specific triggers and contexts]."
---
# [Skill Name]
## Workflow
1. [First step]
2. [Second step]
3. [Third step]
## Examples
**Input:** [example input]
**Output:** [example output]
## Edge cases
- [Edge case 1]: [How to handle it]
- [Edge case 2]: [How to handle it]
Reference material
Consult these for detailed guidance on specific topics:
- Format & specification: references/overview-and-format.md
- Core principles: references/core-principles.md — context window economy, degrees of freedom, making choices
- Metadata & body structure: references/metadata-and-structure.md — name/description rules, body sections, terminology
- Progressive disclosure: references/progressive-disclosure.md — three-level loading, reference patterns
- Bundled resources: references/bundled-resources.md — scripts, references, assets guidance
- Design patterns: references/design-patterns.md — template, workflow, feedback loop, routing patterns
- Anti-patterns & testing: references/anti-patterns-and-testing.md — common mistakes, evaluation-driven development, two-instance workflow
- Organizing & checklist: references/organizing-and-checklist.md — scaling skills, pre-ship checklist, quick-start template
Source
git clone https://github.com/msewell/agent-stuff/blob/main/skills/writing-agent-skills/SKILL.mdView on GitHub Overview
Writing Agent Skills provides a practical workflow to scaffold new skill directories, write SKILL.md files with proper frontmatter for the open, cross-platform agent-skills format, and apply progressive disclosure. It also guides reviewing existing skills for anti-patterns and aligning testing workflows, ensuring consistent terminology and structure across skills.
How This Skill Works
You follow a structured workflow: clarify scope, choose a name, write the description, and compose the body in imperative form. If content grows beyond 500 lines, move details to references/ files and link from SKILL.md. When reviewing, audit for weak descriptions, 'kitchen sink' length, teaching known things, too many options, and nested references, then propose concrete before/after fixes.
When to Use It
- You need to create a new skill from scratch and scaffold its directory.
- You are asked to write the SKILL.md and set up frontmatter for an existing skill.
- You want to review a skill for anti-patterns and improve clarity and structure.
- You need to apply progressive disclosure to keep SKILL.md concise.
- You are aligning testing workflows and ensuring consistent terminology across skills.
Quick Start
- Step 1: Clarify the skill’s scope and the task it should teach.
- Step 2: Choose a name that matches the directory and write frontmatter.
- Step 3: Write the body in imperative form, then apply progressive disclosure and validate.
Best Practices
- Define scope clearly before writing to focus content on what the agent cannot already know.
- Write the description in third person and specify when to use the skill with relevant keywords.
- Keep the body concise; aim under 500 lines; move heavy details to references/ when needed.
- Make default choices to reduce decision fatigue; offer alternatives only for edge cases.
- Avoid extraneous files (e.g., NO README.md or INSTALLATION_GUIDE inside a skill) and maintain terminology consistency.
Example Use Cases
- Create a new directory for a skill like processing-pdfs, then draft SKILL.md with frontmatter and a focused description.
- Review an existing skill’s SKILL.md for weak description and nested references, then apply progressive disclosure.
- Draft a clear description that states when to use the skill and the tasks it enables.
- Move detailed guidance over 500 lines into references/ and link from SKILL.md.
- Validate the skill against the pre-ship checklist before release.