This skill should be used when the user asks to "create a spec", "write a specification", "create a feature specification", "build a requirements document", "gather requirements", "develop user stories", "start discovery process", or mentions needing help with requirements analysis or product specification. Guides users through a structured discovery process where stories emerge from problem understanding rather than being predefined.
From spec-writernpx claudepluginhub aaronbassett/agent-foundry --plugin spec-writerThis skill uses the workspace's default tool permissions.
references/file-operations.mdreferences/file-templates.mdreferences/phase-guide.mdreferences/scripts-tier-1.mdreferences/scripts-tier-2.mdreferences/scripts-tier-3.mdreferences/scripts-tier-4.mdsample-spec/OPEN_QUESTIONS.mdsample-spec/README.mdsample-spec/SPEC.mdsample-spec/STATE.mdsample-spec/archive/DECISIONS.mdsample-spec/archive/RESEARCH.mdscripts/add-edge-case.pyscripts/add-functional-requirement.pyscripts/add-question.pyscripts/add-revision.pyscripts/add-success-criteria.pyscripts/find-decisions.pyscripts/find-iterations.pyProvides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Uses ctx7 CLI to fetch current library docs, manage AI coding skills (install/search/generate), and configure Context7 MCP for AI editors.
Guide users through creating complete, unambiguous feature specifications using a discovery-driven process. Unlike traditional requirements gathering that starts with predefined user stories, this skill helps stories emerge naturally from deep problem understanding. The resulting specification is comprehensive enough for implementation without further clarification.
Stories emerge from discovery, they don't precede it.
Begin by understanding the problem space. Stories crystallize as understanding deepens through iterative exploration. Stories may split, merge, be added, or be revised as learning progresses—even after being written into the specification.
Use this skill when the user needs to:
SPEC.md serves as the compaction mechanism. As user stories reach full clarity, they graduate from working state into the deliverable specification. STATE.md holds only in-flight work. SPEC.md is a living document—graduated stories can be revised when new information warrants it.
discovery/
├── SPEC.md # Progressive deliverable (mutable)
├── STATE.md # Working memory (current work)
├── OPEN_QUESTIONS.md # Current blockers
└── archive/
├── DECISIONS.md # Decision history
├── RESEARCH.md # Research log
├── ITERATIONS.md # Iteration summaries
└── REVISIONS.md # Changes to graduated stories
Goal: Understand the problem before proposing solutions.
Activities:
Outputs to STATE.md:
Exit Criteria:
Goal: Transform themes into concrete, prioritized user stories.
Proto-stories become real stories when they have:
Activities:
Outputs to STATE.md:
Exit Criteria:
Goal: Develop each story to graduation-ready clarity.
Work through stories by priority while remaining alert to:
Activities:
Graduation Criteria (per story):
Graduation Protocol:
Reality: Discovery doesn't end when a story graduates.
Later stories may reveal:
Process:
Revision Types:
All revisions require:
"Let's build a feature specification together. I'm going to start by understanding the problem space - we'll figure out the user stories together as we go.
Tell me: What problem are you trying to solve? Who experiences this problem, and what does their life look like today without a solution?"
Once you understand the problem and have identified an appropriate feature name, use scripts/init-spec.sh <feature-name> --base-path "${CLAUDE_WORKING_DIRECTORY}" (Tier 1 Essential) to initialize the discovery/ directory with all required files at the project root. See references/scripts-tier-1.md for detailed usage.
Continue the discovery process from the project root (discovery/ directory will be created there)
"We're in Phase [X]. [N] stories completed, working on [Story Y]. [M] blocking questions. Any graduated stories at revision risk: [list]"
Field Update Rules: For exhaustive guidance on when to update each field and section, see references/file-operations.md.
Track questions in OPEN_QUESTIONS.md by type using add-question.py (Tier 1 Essential):
Use resolve-question.py (Tier 2 Automation) to remove questions when answered.
See references/scripts-tier-1.md and references/scripts-tier-2.md for details.
Use TodoWrite to track:
The specification is complete when:
Before marking complete, verify:
validate-spec.py (Tier 1) for final validationFor detailed templates and formats:
references/file-templates.md - Manual operations reference showing what sections you must write manually vs what scripts handle. Focus on Problem Understanding, In-Progress Story Detail, and manual metadata updates.references/file-operations.md - Exhaustive field-level update rules, sync checkpoints, and cross-file consistency invariants. Reference when updating files to ensure all required fields are updated and cross-references maintained.references/phase-guide.md - Comprehensive phase-by-phase guidance with questioning strategies, research approaches, and transition criteriaWorking examples in examples/:
examples/sample-spec/ - Complete example specification showing the discovery process from problem exploration through graduated storiesThe spec-writer skill includes 14 automation scripts in scripts/ organized in four tiers by functionality.
Script Organization:
Quick Start:
# Initialize new spec (creates discovery/ at project root)
scripts/init-spec.sh payment-flow-redesign --base-path "${CLAUDE_WORKING_DIRECTORY}"
# Add question
scripts/add-question.py \
--question "Who are the primary users?" \
--category clarifying
# Log decision
scripts/log-decision.py \
--title "Use REST API" \
--context "Need API protocol" \
--decision "REST with JSON" \
--stories "Story 1, Story 2"
# Find decisions
scripts/find-decisions.py --story 1
# Validate spec
scripts/validate-spec.py
Smart Directory Discovery: All scripts automatically locate discovery/ directory using:
--discovery-path flagdiscovery/Script Reference Documentation:
Read the appropriate tier reference based on your current task:
references/scripts-tier-1.md - Read when: starting new spec, adding questions, logging decisions, finding past decisions, validating spec integrity
references/scripts-tier-2.md - Read when: graduating stories to SPEC.md, changing story status, resolving questions, searching research log
references/scripts-tier-3.md - Read when: logging research findings, recording revisions to graduated stories, getting quick status overview
references/scripts-tier-4.md - Read when: adding edge cases, extracting functional requirements, defining success criteria
Progressive Reading: Start with Tier 1 for basic operations, read higher tiers only when needed for specific tasks.
The 16 automation scripts are organized into 4 tiers by functionality and use case. Use this quick reference to find the right script and its documentation.
| Task | Tier | Key Scripts | Reference |
|---|---|---|---|
| Starting a new spec | 1 | init-spec.sh | scripts-tier-1.md |
| Adding questions | 1 | add-question.py | scripts-tier-1.md |
| Logging decisions | 1 | log-decision.py | scripts-tier-1.md |
| Finding decisions | 1 | find-decisions.py | scripts-tier-1.md |
| Validating spec | 1 | validate-spec.py | scripts-tier-1.md |
| Graduating stories | 2 | graduate-story.py | scripts-tier-2.md |
| Changing story status | 2 | update-story-status.py | scripts-tier-2.md |
| Resolving questions | 2 | resolve-question.py | scripts-tier-2.md |
| Finding research | 2 | find-research.py | scripts-tier-2.md |
| Logging research | 3 | log-research.py | scripts-tier-3.md |
| Recording revisions | 3 | add-revision.py | scripts-tier-3.md |
| Logging iterations | 3 | log-iteration.py | scripts-tier-3.md |
| Finding iterations | 3 | find-iterations.py | scripts-tier-3.md |
| Status overview | 3 | story-status.sh | scripts-tier-3.md |
| Adding edge cases | 4 | add-edge-case.py | scripts-tier-4.md |
| Adding requirements | 4 | add-functional-requirement.py | scripts-tier-4.md |
| Adding success criteria | 4 | add-success-criteria.py | scripts-tier-4.md |
Read the appropriate tier reference based on your current task:
Tier 1: Essential Scripts — references/scripts-tier-1.md
Read when: starting new spec, adding questions, logging decisions, finding past decisions, validating spec integrity
Core scripts for initialization and basic discovery operations.
Tier 2: High-Value Automation — references/scripts-tier-2.md
Read when: graduating stories to SPEC.md, changing story status, resolving questions, searching research log
Advanced workflow automation for story lifecycle management.
Tier 3: Enhancement Scripts — references/scripts-tier-3.md
Read when: logging research findings, recording revisions to graduated stories, logging iteration summaries, getting quick status overview
Support scripts for research, revisions, iteration tracking, and monitoring.
Tier 4: Specialized Tables — references/scripts-tier-4.md
Read when: adding edge cases, extracting functional requirements, defining success criteria
Scripts for managing SPEC.md requirement tables.
Progressive Reading Strategy:
Monitor for transition signals:
For each story (in priority order):
update-story-status.py (Tier 2) to mark story as "In Progress"add-question.py (Tier 1)log-research.py (Tier 3)graduate-story.py (Tier 2) to move to SPEC.mdvalidate-spec.py (Tier 1) to check integritylog-iteration.py (Tier 3) after completing story cycleSee appropriate tier references for detailed usage. For graduation field updates and sync rules, see references/file-operations.md.
Stay alert for:
When new information affects graduated stories:
add-revision.py (Tier 3 Enhancement)validate-spec.py (Tier 1)For revision field updates and sync rules, see references/file-operations.md. For revision logging script details, see references/scripts-tier-3.md.
Start by checking if discovery/SPEC.md exists, then follow the appropriate protocol (fresh start or resume). Guide the user through discovery with patience, using questions to deepen understanding rather than rushing to document preconceived stories.