···1+---
2+name: spec
3+description: Draft design documents and specs with research-informed questioning
4+disable-model-invocation: true
5+---
6+7+# Spec Writing
8+9+## When to Use
10+11+Use this skill when the user explicitly requests a spec, design document, or similar planning artifact. Do not auto-trigger for routine tasks.
12+13+## Process
14+15+### 1. Initial Scoping
16+17+When starting a spec:
18+- Ask the user for a brief description of what they want to build/change
19+- Reason about which question categories matter for this particular work—derive these from the problem, not a checklist
20+21+### 2. Interrogation Loop
22+23+Conduct open-ended questioning until the designer signals completion:
24+25+**Research-informed questions**: Before asking about an area, do just-in-time codebase research. Find relevant files, understand current patterns, identify constraints. Reference specific files and functions in questions when it adds clarity.
26+27+**Adaptive scope**: When the designer marks something as out of scope, update your mental model and don't revisit. However, flag when you believe there are gaps that could cause problems:
28+- "This approach assumes X—is that intentional?"
29+- "The current implementation of Y in `src/foo.ts:42` handles Z differently. Should we align or diverge?"
30+31+**Question style**:
32+- Ask one focused question at a time, or a small related cluster
33+- Ground questions in what you've learned from the codebase
34+- Avoid hypotheticals that don't apply to this codebase
35+- When presenting options, describe tradeoffs without recommending unless asked
36+37+### 3. Spec Writing
38+39+When the designer indicates readiness, produce the spec document.
40+41+## Output
42+43+Save to: `/specs/YYYY-MM-DD-short-name.md`
44+45+### Required Elements
46+47+**Title and status** (draft | approved | implemented)
48+49+**Goal**: What this achieves and why. 1-3 sentences.
50+51+**Design**: The substance of what will be built/changed. For each significant component or concern:
52+- Describe the approach
53+- State key decisions with their rationale inline
54+- Reference specific files, functions, and types where relevant
55+- Structure subsections to fit the problem—no fixed format
56+57+**Implementation**: Ordered steps that an agent or developer can execute. Each step should:
58+- Be concrete and actionable
59+- Reference specific files/functions to modify or create
60+- Be sequenced correctly (dependencies before dependents)
61+62+### Optional
63+64+- Background context (only if necessary for understanding)
65+- Open questions (only if unresolved items remain)
66+67+Add other sections if the problem demands it.
68+69+## Writing Style
70+71+- No filler, hedging, or preamble
72+- No "This document describes..." or "In this spec we will..."
73+- Start sections with substance, not meta-commentary
74+- Use precise technical language
75+- Keep decisions and rationale tight—one sentence each when possible
76+- Code references use `file/path.ts:lineNumber` or `functionName` in backticks
77+- Prefer concrete over abstract; specific over general
78+79+## Status Lifecycle
80+81+- **draft**: Work in progress. Should not be merged to main.
82+- **approved**: Designer has signed off. Ready for implementation.
83+- **implemented**: Work is complete. Spec is now historical record.
84+85+Update status in the document as it progresses. Specs are point-in-time snapshots—do not update content after implementation begins except to change status.