Writing a Skill
Skills are reusable instructions that agents invoke during Heartbeats — markdown files that teach agents how to perform specific tasks.
Prerequisites
- A SLAW instance running locally (local development)
- Familiarity with how agents pick up skills (How Agents Work)
Skill Structure
A skill is a directory containing a SKILL.md file, with optional supporting files in a references/ subfolder:
skills/
└── my-skill/
├── SKILL.md
└── references/
└── examples.md
SKILL.md Format
---
name: my-skill
description: >
Short description of what this skill does and when to use it.
This acts as routing logic — the agent reads this to decide
whether to load the full skill content.
---
# My Skill
Detailed instructions for the agent...
Frontmatter Fields
| Field | Required | Description |
|---|---|---|
name | Yes | Unique kebab-case identifier for the skill |
description | Yes | Routing description — tells the agent when to use this skill |
Write the description as decision logic, not marketing copy. Include "use when" and "don't use when" guidance so the agent knows whether to load it.
How Skills Work at Runtime
- The agent sees skill metadata (name and description) in its context.
- The agent decides whether the skill is relevant to its current task.
- If relevant, the agent loads the full
SKILL.mdcontent. - The agent follows the instructions in the skill.
This keeps the base prompt small — full skill content loads on demand only.
End-to-End Example
Here is a minimal skill that teaches an agent to write API endpoint documentation:
---
name: document-api-endpoint
description: >
Use when asked to document an API endpoint. Produces a consistent
reference entry with method, path, params table, request example,
and response example. Don't use for conceptual overviews or how-tos.
---
# Document API Endpoint
## Steps
1. Identify the HTTP method, path, and auth requirements.
2. List all path, query, and body parameters in a table: Name · Type · Required · Description.
3. Write one request example using a realistic payload.
4. Write one response example for the success case and one for the main error case.
5. Link to any related endpoints.
Best Practices
- Write descriptions as routing logic. Include explicit "use when" / "don't use when" guidance.
- Be specific and actionable. Agents should be able to follow skills without ambiguity.
- Include code examples. Concrete API calls and commands are more reliable than prose.
- Keep skills focused. One skill per concern; don't combine unrelated procedures.
- Use
references/for depth. Put supporting detail inreferences/rather than bloating the mainSKILL.md.
Skill Injection
Adapters make skills discoverable to their agent runtime. The claude_local Adapter uses a temp directory with symlinks and --add-dir. The codex_local Adapter uses the global skills directory. See Creating an Adapter for details.
Verification
Confirm the skill parses and registers before relying on it:
-
Import it into a squad from its directory:
slaw skills import ./skills/my-skill --squad-id <SQUAD_ID>A malformed
SKILL.md(missingnameordescription) is rejected here — a clean import means the frontmatter is valid. -
Inspect the registered skill to confirm its metadata resolved as expected:
slaw skills inspect my-skill --squad-id <SQUAD_ID>The
nameanddescriptionshould match your frontmatter. Once a relevant agent next wakes, the skill's metadata appears in its context and it loads the fullSKILL.mdon demand.
Next steps
- Skills (Operator guide) — how Operators install and manage squad skills
- Adapters Overview — how Adapters inject skills at runtime
- How Agents Work — the agent execution model