| name | writing-specs |
| description | Writes and manages spec files in specs/ with mandatory duplicate search, conflict detection, and a structured final report. Use when user asks to create a spec, update a spec, write a spec, or mentions ์คํ ์์ฑ, ์คํ ์
๋ฐ์ดํธ, ์คํ ์์ฑ, ์คํ ๋ง๋ค์ด์ค. Proactively trigger whenever the request involves specification documents, even if the user never says spec. |
| allowed-tools | Read, Write, Glob, Grep, Bash, AskUserQuestion |
| context | fork |
| agent | general-purpose |
Writing Specs
Manage spec files in specs/ with conflict detection and a concise final report.
Hard Rules
- Template-driven. Every spec follows templates/spec-template.md exactly. No extra sections, no freestyle content.
- Search before write. Never create or update a spec without running Phase 1.
- One spec = one task. A request spanning multiple concerns becomes multiple specs.
- Never auto-modify outdated specs. Propose updates, then wait for confirmation.
- Always end with the report. No silent operations.
Directory Rules
- Specs live in
specs/ at the project root. Filenames are lowercase-with-hyphens.
- Default path:
specs/phase-N/NN-name.md โ the convention writing-tasks consumes; using it makes the specโtask handoff zero-friction.
phase-N: 1-indexed milestone number, monotonically increasing across the project, never reset.
NN: 2-digit index within the phase, starting at 01. Example: specs/phase-1/01-jwt-authentication.md.
- Alternatives (
specs/{name}.md, specs/{subdir}/{name}.md) only when no writing-tasks integration is planned.
- Max 1-depth subdirectories. Create subdirs or new phases only on explicit request, or when 5+ specs share a clear category.
Auto-pick phase + NN when the user does not specify:
Glob specs/phase-*/ โ no phases โ phase-1.
- Use the highest existing phase, unless the user signals a new milestone โ create
phase-{N+1}.
Glob specs/phase-N/*.md โ new spec gets highest existing NN + 1, zero-padded.
- Spec belongs to a clearly different milestone? Ask via
AskUserQuestion before creating a new phase.
Phase 0 โ Resolve the input
| Argument shape | Resolution |
|---|
brain-storm/**.md path | Read it. Summary / Motivation / Proposed Approach become the spec source; the idea title becomes the spec H1. |
| Any other markdown path | Read it; its content is the spec source. |
| Bare title or keyword | Glob brain-storm/**/*.md, match H1 (case-insensitive) then filename slug. One match โ use it. Multiple โ AskUserQuestion. Zero โ treat as freestyle. |
| Freestyle text, or no argument | Use conversation context. Empty โ ask via AskUserQuestion. |
From a brain-storm source: Summary seeds Purpose; Proposed Approach bullets seed Requirements (prune to 3-5 concrete items) and the prose Approach. Wireframe and Open Questions are NOT copied โ list them under "Carried over" in the report.
Phase 1 โ Search (mandatory)
Glob specs/**/*.md to list all spec files.
- Extract 3-5 key nouns from the request (skip generic words like "system", "feature", "add", "update").
Grep each keyword across the found specs.
- Classify: Exact match (same topic) ยท Related (2+ shared keywords or adjacent topic) ยท Outdated (references files that no longer exist โ verify with
Glob).
No specs/ directory yet โ skip to Phase 3.
Phase 2 โ Decide
- No related specs โ proceed to create.
- Exact match โ ask: "์ด๋ฏธ ๋์ผํ ์คํ์ด ์กด์ฌํฉ๋๋ค:
{path}. ์
๋ฐ์ดํธํ ๊น์, ์๋ก ์์ฑํ ๊น์, ์๋๋ฉด ์ทจ์ํ ๊น์?"
- Related specs โ show the list and ask: "๊ด๋ จ ์คํ์ด ๋ฐ๊ฒฌ๋์์ต๋๋ค. ์ด๋ป๊ฒ ์งํํ ๊น์?"
- Outdated specs โ "๋ค์ ์คํ์ด outdated ์ํ์
๋๋ค (์ฐธ์กฐ ํ์ผ ์์). ํจ๊ป ์
๋ฐ์ดํธํ ๊น์?"
All decisions go through AskUserQuestion.
Phase 3 โ Write
- Read templates/spec-template.md and fill it strictly.
- Resolve the destination with the auto-pick rules above; write under
specs/.
- On update, preserve every section the user did not ask to change.
Section limits (enforced, not suggested): Purpose 1-2 sentences, no bullets ยท Requirements 3-5 bullets, one concrete requirement each ยท Approach 2-5 sentences, no code ยท Verification 2-5 testable bullets.
Phase 4 โ Outdated cleanup
For each outdated spec found in Phase 1: identify the broken references, propose specific updates, apply only after user confirmation. Never auto-modify.
Phase 5 โ Report
Fill templates/report-template.md and output it as the final message: Action (Created/Updated), File (relative path), Title (spec H1), Search Results (each related/outdated spec, or "No related specs found"), Changes ("New spec created" or update summary), Next Steps (one actionable suggestion).
Non-interactive mode
If AskUserQuestion is unavailable (auto mode, headless, scheduled), apply the defaults in non-interactive.md and echo every defaulted decision in the Phase 5 report.