Get the FREE Ultimate OpenClaw Setup Guide →

writing-agent-skills

npx machina-cli add skill msewell/agent-stuff/writing-agent-skills --openclaw
Files (1)
SKILL.md
4.7 KB

Writing Agent Skills

Workflow: Creating a new skill

  1. 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.
  2. Choose a name. Lowercase, hyphens only, 1–64 chars. Prefer gerund form (e.g., processing-pdfs over pdf-processor). Must match directory name.
  3. 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.
  4. Write the body. Use imperative form. Include only what the agent cannot already know. Keep under 500 lines (~5000 tokens).
  5. Apply progressive disclosure. If content exceeds 500 lines, move detailed information into references/ files. Link from SKILL.md — keep all references one level deep (no chains).
  6. Add scripts only if needed. Include bundled scripts when the same code is rewritten repeatedly or deterministic reliability matters.
  7. Validate. Check against the pre-ship checklist in references/organizing-and-checklist.md.

Workflow: Reviewing an existing skill

  1. Read the skill's SKILL.md and all bundled files.
  2. 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
  3. 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 description frontmatter, 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:

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

  1. Step 1: Clarify the skill’s scope and the task it should teach.
  2. Step 2: Choose a name that matches the directory and write frontmatter.
  3. 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.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers