Skip to content
This repository was archived by the owner on Apr 11, 2026. It is now read-only.

Commit 3552f14

Browse files
committed
docs: add skill-anatomy.md template specification
- Standardized skill structure: frontmatter, 6 required sections - Anti-rationalization as core principle (Common Rationalizations table) - Red Flags and Verification checklist requirements - Flow-code specifics: flowctl integration, evidence, phase naming - Writing principles: process > knowledge, specific > general, evidence > assumption - References flow-code-debug as native exemplar Task: fn-136-borrow-agent-skills-patterns-anti.1
1 parent 00e8773 commit 3552f14

1 file changed

Lines changed: 169 additions & 0 deletions

File tree

docs/skill-anatomy.md

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# Skill Anatomy
2+
3+
Standard structure for flow-code skill files. Use this when creating or reviewing skills.
4+
5+
## File Location
6+
7+
Every skill lives in its own directory under `skills/`:
8+
9+
```
10+
skills/flow-code-<name>/
11+
SKILL.md # Required: The skill definition (<=500 lines)
12+
workflow.md # Optional: Extended workflow if SKILL.md overflows
13+
templates/ # Optional: Scripts, config templates
14+
```
15+
16+
Prefix all skill directories with `flow-code-`. Main file is always `SKILL.md` (uppercase).
17+
18+
## YAML Frontmatter (Required)
19+
20+
```yaml
21+
---
22+
name: flow-code-<name>
23+
description: Use when [triggering conditions and symptoms only]
24+
---
25+
```
26+
27+
**Rules:**
28+
- `name`: Lowercase, hyphen-separated. Must match directory name. Always starts with `flow-code-`.
29+
- `description`: Starts with "Use when...". Max 500 characters. Third person.
30+
- Include: triggering conditions, symptoms, contexts.
31+
- Exclude: workflow summary, process steps, what the skill does.
32+
33+
**Why:** Descriptions are injected into system prompts for skill discovery. If the description contains process steps, agents follow the summary and skip the actual skill content.
34+
35+
## Required Sections
36+
37+
```markdown
38+
# Skill Title
39+
40+
## Overview
41+
Core principle in 1-2 sentences. What this skill enforces and why it matters.
42+
43+
## When to Use
44+
- Triggering conditions (symptoms, task types, failure patterns)
45+
- **When NOT to use:** exclusions to prevent misapplication
46+
47+
## Core Process
48+
The step-by-step workflow. Numbered phases or steps.
49+
Include inline code examples. Use ASCII flowcharts for decision points.
50+
51+
## Common Rationalizations
52+
53+
| Excuse | Reality |
54+
|--------|---------|
55+
| "Too simple to need this" | Simple things break too |
56+
| "I'll do it properly later" | Later never comes |
57+
58+
## Red Flags
59+
- Observable symptoms indicating the skill is being violated
60+
- Patterns to watch for during self-check and review
61+
62+
## Verification
63+
After completing the process, confirm:
64+
- [ ] Checklist item with verifiable evidence
65+
- [ ] Another checkpoint (test output, build result, etc.)
66+
```
67+
68+
## Section Purposes
69+
70+
### Overview
71+
The elevator pitch. Answers: what does this skill enforce, and why should an agent follow it?
72+
73+
### When to Use
74+
Helps agents decide if this skill applies. Include both positive triggers ("Use when X") and negative exclusions ("NOT for Y"). The flow-code-debug exemplar:
75+
> Test failures, bugs, unexpected behavior, performance problems, build failures.
76+
> **Especially when:** under time pressure, "quick fix" seems obvious.
77+
78+
### Core Process
79+
The heart of the skill. Step-by-step workflow the agent follows. Must be specific and actionable.
80+
81+
**Good:** "Run `cargo test --all` and verify zero failures"
82+
**Bad:** "Make sure the tests work"
83+
84+
For flow-code skills, phases follow the convention: Phase 1, Phase 2, Phase 2.5 (verify), Phase 3 (commit), etc. Reference `flowctl` commands where applicable:
85+
```bash
86+
$FLOWCTL guard # Run all guards
87+
$FLOWCTL invariants check # Check architecture invariants
88+
```
89+
90+
### Common Rationalizations
91+
The most distinctive section. Excuses agents use to skip important steps, paired with factual rebuttals. Think of every time an agent said "I'll add tests later" or "This is simple enough to skip" -- those go here.
92+
93+
This is the core anti-rationalization principle. Every skip-worthy step needs a counter-argument. Without this section, agents reliably talk themselves out of following the process.
94+
95+
### Red Flags
96+
Observable signs the skill is being violated. Phrased as quotes or behaviors:
97+
- "Quick fix for now, investigate later"
98+
- "I don't fully understand but this might work"
99+
- Proposing solutions before completing investigation
100+
- Each fix reveals a new problem in a different place
101+
102+
### Verification
103+
Exit criteria as a checkbox checklist. Every item must be verifiable with evidence (test output, build result, git diff, flowctl output). No subjective items like "code looks good."
104+
105+
## Supporting Files
106+
107+
Create supporting files only when:
108+
- SKILL.md exceeds 500 lines (overflow to `workflow.md` or similar)
109+
- Reusable scripts or templates are needed
110+
- Long checklists justify separate files
111+
112+
Keep patterns and principles inline when under ~50 lines. Most skills need only SKILL.md.
113+
114+
## Writing Principles
115+
116+
1. **Process over knowledge.** Skills are workflows, not reference docs. Steps, not facts.
117+
2. **Specific over general.** `$FLOWCTL guard` beats "verify the code works."
118+
3. **Evidence over assumption.** Every verification checkbox requires proof.
119+
4. **Anti-rationalization is core.** Every skip-worthy step needs a counter-argument in the rationalizations table. This is what separates effective skills from advice.
120+
5. **Token-conscious.** Every section must justify its inclusion. If removing it wouldn't change agent behavior, remove it.
121+
6. **Progressive disclosure.** SKILL.md is the entry point. Supporting files load on demand.
122+
123+
## Flow-Code Specifics
124+
125+
### flowctl Integration
126+
Skills that enforce process should reference flowctl commands:
127+
- `$FLOWCTL guard` for verification gates
128+
- `$FLOWCTL done --summary-file --evidence-json` for evidence-based completion
129+
- `$FLOWCTL invariants check` for architecture invariant enforcement
130+
131+
### Evidence Requirements
132+
Flow-code workers produce evidence JSON. Skills should specify what evidence their process generates:
133+
```json
134+
{"commits": ["abc123"], "tests": ["cargo test --all"], "prs": []}
135+
```
136+
137+
### Phase Naming
138+
Follow the worker agent convention:
139+
- Phase 1: Re-anchor (read spec)
140+
- Phase 2: Implement
141+
- Phase 2.5: Verify & Fix
142+
- Phase 3: Commit
143+
- Phase 4: Review
144+
- Phase 5: Complete
145+
146+
Skills that define their own phases should use this numbering style (Phase 1, Phase 1.5, Phase 2) for consistency with the worker pipeline.
147+
148+
### Cross-Skill References
149+
Reference other skills by name, don't duplicate:
150+
```markdown
151+
If the build breaks, use the `flow-code-debug` skill.
152+
For test-first development, see `flow-code-tdd`.
153+
```
154+
155+
## Exemplar
156+
157+
The `flow-code-debug` skill (`skills/flow-code-debug/SKILL.md`) is the reference implementation. It demonstrates all required sections including the Common Rationalizations table (lines 137-151) and Red Flags list (lines 128-135).
158+
159+
## Checklist for New Skills
160+
161+
- [ ] Directory created as `skills/flow-code-<name>/`
162+
- [ ] SKILL.md has valid YAML frontmatter with `name` and `description`
163+
- [ ] Description starts with "Use when..." (no workflow summary)
164+
- [ ] All six required sections present (Overview, When to Use, Core Process, Common Rationalizations, Red Flags, Verification)
165+
- [ ] Rationalizations table has 3+ entries with factual rebuttals
166+
- [ ] Red flags list has observable symptoms (not vague advice)
167+
- [ ] Verification checklist items are evidence-backed
168+
- [ ] SKILL.md is under 500 lines
169+
- [ ] Registered in plugin.json and README.md skills table

0 commit comments

Comments
 (0)