feat: implement issue 0018 phase 2 — write-docs skill (first factory output)
Produces write-docs via the write-skill factory. First skill authored end-to-end by the factory (SKILL.md via write-skill, eval via write-eval). - Add .agents/skills/write-docs/SKILL.md (category: implement) - Add .agents/evals/implement/write-docs/eval.yaml (6 trigger + 3 output tests) - Remove write-a-skill placeholder (superseded by write-skill) - Extend issue 0018 with Phase 3 (doc convention, grill-first) - Tighten workflow steps 5a and 5d based on session lessons - Update factory-integration-decisions: write-a-skill → write-skill - Add 2 LESSONS.md entries (trigger gate, write-eval sub-agent bypass) - Update docs/spec/overview.md and ROADMAP Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,120 +0,0 @@
|
||||
---
|
||||
name: write-a-skill
|
||||
description: Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, or build a new skill.
|
||||
metadata:
|
||||
category: factory
|
||||
version: "1.1"
|
||||
---
|
||||
|
||||
# Writing Skills
|
||||
|
||||
## Process
|
||||
|
||||
1. **Gather requirements** - ask user about:
|
||||
- What task/domain does the skill cover?
|
||||
- What specific use cases should it handle?
|
||||
- Does it need executable scripts or just instructions?
|
||||
- Any reference materials to include?
|
||||
|
||||
2. **Draft the skill** - create:
|
||||
- SKILL.md with concise instructions
|
||||
- Additional reference files if content exceeds 500 lines
|
||||
- Utility scripts if deterministic operations needed
|
||||
|
||||
3. **Review with user** - present draft and ask:
|
||||
- Does this cover your use cases?
|
||||
- Anything missing or unclear?
|
||||
- Should any section be more/less detailed?
|
||||
|
||||
## Skill Structure
|
||||
|
||||
```
|
||||
skill-name/
|
||||
├── SKILL.md # Main instructions (required)
|
||||
├── REFERENCE.md # Detailed docs (if needed)
|
||||
├── EXAMPLES.md # Usage examples (if needed)
|
||||
└── scripts/ # Utility scripts (if needed)
|
||||
└── helper.js
|
||||
```
|
||||
|
||||
## SKILL.md Template
|
||||
|
||||
```md
|
||||
---
|
||||
name: skill-name
|
||||
description: Brief description of capability. Use when [specific triggers].
|
||||
---
|
||||
|
||||
# Skill Name
|
||||
|
||||
## Quick start
|
||||
|
||||
[Minimal working example]
|
||||
|
||||
## Workflows
|
||||
|
||||
[Step-by-step processes with checklists for complex tasks]
|
||||
|
||||
## Advanced features
|
||||
|
||||
[Link to separate files: See [REFERENCE.md](REFERENCE.md)]
|
||||
```
|
||||
|
||||
## Description Requirements
|
||||
|
||||
The description is **the only thing your agent sees** when deciding which skill to load. It's surfaced in the system prompt alongside all other installed skills. Your agent reads these descriptions and picks the relevant skill based on the user's request.
|
||||
|
||||
**Goal**: Give your agent just enough info to know:
|
||||
|
||||
1. What capability this skill provides
|
||||
2. When/why to trigger it (specific keywords, contexts, file types)
|
||||
|
||||
**Format**:
|
||||
|
||||
- Max 1024 chars
|
||||
- Write in third person
|
||||
- First sentence: what it does
|
||||
- Second sentence: "Use when [specific triggers]"
|
||||
|
||||
**Good example**:
|
||||
|
||||
```
|
||||
Extract text and tables from PDF files, fill forms, merge documents. Use when working with PDF files or when user mentions PDFs, forms, or document extraction.
|
||||
```
|
||||
|
||||
**Bad example**:
|
||||
|
||||
```
|
||||
Helps with documents.
|
||||
```
|
||||
|
||||
The bad example gives your agent no way to distinguish this from other document skills.
|
||||
|
||||
## When to Add Scripts
|
||||
|
||||
Add utility scripts when:
|
||||
|
||||
- Operation is deterministic (validation, formatting)
|
||||
- Same code would be generated repeatedly
|
||||
- Errors need explicit handling
|
||||
|
||||
Scripts save tokens and improve reliability vs generated code.
|
||||
|
||||
## When to Split Files
|
||||
|
||||
Split into separate files when:
|
||||
|
||||
- SKILL.md exceeds 100 lines
|
||||
- Content has distinct domains (finance vs sales schemas)
|
||||
- Advanced features are rarely needed
|
||||
|
||||
## Review Checklist
|
||||
|
||||
After drafting, verify:
|
||||
|
||||
- [ ] Description includes triggers ("Use when...")
|
||||
- [ ] SKILL.md under 100 lines
|
||||
- [ ] No time-sensitive info
|
||||
- [ ] Consistent terminology
|
||||
- [ ] Concrete examples included
|
||||
- [ ] References one level deep
|
||||
103
.agents/skills/write-docs/SKILL.md
Normal file
103
.agents/skills/write-docs/SKILL.md
Normal file
@@ -0,0 +1,103 @@
|
||||
---
|
||||
name: write-docs
|
||||
description: Write documentation for X, document this module, create docs for this feature. Use when the user wants to produce or update technical documentation derived from code, spec, or existing artifacts. Do NOT use when the user wants a PRD, ADR, decision doc, or skill file — those have dedicated skills.
|
||||
version: "1.0"
|
||||
updated: 2026-05-17
|
||||
when: invoked by explicit trigger ("write docs for X", "document this module", "create docs for this feature") or implicit request to produce technical documentation from code or spec
|
||||
metadata:
|
||||
category: implement
|
||||
source:
|
||||
- repo: anthropics/skills
|
||||
commit: f458cee31a7577a47ba0c9a101976fa599385174
|
||||
files:
|
||||
- skills/doc-coauthoring/SKILL.md # Reader Testing stage, surgical-edit constraint, gap-check step
|
||||
updated: 2026-05-17
|
||||
- repo: mattpocock/skills
|
||||
commit: e74f0061bb67222181640effa98c675bdb2fdaa7
|
||||
files:
|
||||
- skills/productivity/write-a-skill/SKILL.md # trigger pattern, review checklist items
|
||||
updated: 2026-05-17
|
||||
- repo: bmad-code-org/BMAD-METHOD
|
||||
commit: 71136bc6af77cbf507d3768494311d5b6ca95cc5
|
||||
files:
|
||||
- src/core-skills/bmad-advanced-elicitation/SKILL.md # confirmation gate before applying changes
|
||||
updated: 2026-05-17
|
||||
---
|
||||
|
||||
## Role
|
||||
|
||||
You are a technical writer that produces documentation by reading code and spec — you derive every claim from a source file or explicit user input and never invent behaviour.
|
||||
|
||||
## When to use / When not to use
|
||||
|
||||
**Use when:**
|
||||
- User wants to document a module, class, function, feature, CLI flag, API endpoint, config file, or README section
|
||||
- User says "write docs for X", "document this", "create docs for this feature", "write a README for this"
|
||||
|
||||
**Do not use when:**
|
||||
- User wants a PRD, decision doc, or architecture proposal → `to-prd` or `grill-me`
|
||||
- User wants to document a skill file (skill files are self-describing)
|
||||
- User wants marketing or blog copy
|
||||
- Documentation requires tacit organisational knowledge that cannot be read from code or spec
|
||||
|
||||
## Required inputs
|
||||
|
||||
- Specific file(s) or module(s) to document, or enough description to propose candidates
|
||||
- Target audience: developer / user / contributor / internal
|
||||
- Documentation type: reference, guide, README section, inline comment, changelog entry
|
||||
|
||||
## Constraints
|
||||
|
||||
- Every claim must be traceable to a source file line, spec section, or explicit user statement — never invent behaviour
|
||||
- User must approve specific files before the skill reads them; skill may propose candidates but waits for approval
|
||||
- Stage skipping is allowed only with an explicit user request and a one-sentence logged reason
|
||||
- Show the full revised section before each confirmation gate — never gate on output the user has not seen
|
||||
- Never reprint the whole document; all edits are surgical
|
||||
- Produce a one-line delta summary after each refinement round
|
||||
- Reader Testing sub-agent receives only the finished doc and the question list — no source files
|
||||
- Write summary and overview sections last, after all detail sections are stable
|
||||
|
||||
## Process
|
||||
|
||||
1. **Identify scope.** User names specific files or sections. If not provided, propose candidates based on the description — wait for explicit approval before reading.
|
||||
|
||||
2. **Read and extract.** Read approved files. Extract: public API surface, described behaviour, visible constraints, non-obvious invariants. Note what the code does NOT explain (caller intent, error handling rationale, non-obvious side effects).
|
||||
|
||||
3. **Gap check.** Present extracted behaviour to the user. Ask them to fill only the gaps — what the code does not explain. Log any explicitly deferred gaps. If the user requests to skip this step, log the reason and proceed.
|
||||
|
||||
4. **Draft section by section.** For each section: state the proposed content and its source (code line / spec section / user input). Show; confirm before moving to the next section.
|
||||
|
||||
5. **Confirmation gate.** Before finalising any section, show the full revised section. Wait for explicit confirmation or correction — never apply changes the user has not seen.
|
||||
|
||||
6. **Delta summary.** After each round of revisions: "Round N: changed [sections], added [X], removed [Y]."
|
||||
|
||||
7. **Reader Testing.** Predict 5–10 questions a target reader would ask. Spawn a scoped sub-agent that receives only the finished doc and the questions — no source files. Report its answers. If any answers fail, loop back to step 4.
|
||||
|
||||
8. **Finalise.** Write summary and overview sections last. Prompt the user to review the complete document before committing.
|
||||
|
||||
## Output format
|
||||
|
||||
- Markdown artifact with section headers; produced one section at a time — never as a single large dump
|
||||
- Delta summary after each refinement round: "Round N: [what changed]"
|
||||
- Reader Testing report: numbered question list with sub-agent answers
|
||||
- Final doc at the user-specified or conventionally appropriate path
|
||||
|
||||
## Failure handling
|
||||
|
||||
- Files not named and description too vague to propose candidates → ask for specific names before reading
|
||||
- Stage skipped without a logged reason → flag and require the one-sentence log before continuing
|
||||
- Code behaviour is undocumentable (internal implementation detail, no public spec) → note as out-of-scope in the doc; do not invent an explanation
|
||||
- Reader Testing sub-agent fails on multiple questions → surface the failures, return to step 4; do not mark complete
|
||||
- Requested output is a PRD, decision doc, or architecture proposal → redirect to `to-prd`, `grill-me`, or `grill-with-docs`
|
||||
|
||||
## Self-check
|
||||
|
||||
- [ ] All claims traceable to a source file or explicit user input
|
||||
- [ ] No invented behaviour — unverifiable claims removed
|
||||
- [ ] User approved specific files before reading
|
||||
- [ ] Any stage skips logged with reason
|
||||
- [ ] Full revised section shown before each confirmation gate
|
||||
- [ ] Delta summary produced after each refinement round
|
||||
- [ ] Reader Testing completed with scoped sub-agent (doc + questions only)
|
||||
- [ ] Summary/overview written last
|
||||
- [ ] User prompted to review before committing
|
||||
Reference in New Issue
Block a user