spec-workflow
Drives feature development through a phased workflow: specify requirements, design architecture, break into tasks, then implement autonomously with frequent commits. TRIGGER CHECK: Before starting any new task, ask yourself — does this touch 3+ files, add dependencies, change infrastructure, or require trade-off decisions? If yes, activate this skill. Also activate when the user says "let's spec this", "new feature", or "let's plan."
Phase details: See references/phase-*.md for step-by-step instructions per phase.
Drive feature work from idea to implementation through repo-stored specs. Five phases: specify → design → tasks → implement → validate.
Execution Flow
- Detect state → enter correct phase
- Specify requirements with user
- Design architecture (deep only)
- Break into atomic tasks → confirm
- Implement tasks sequentially with commits
- Ask user about validation → validate in fresh session
Mode Detection
Read specs/_current to determine state:
- File missing or empty → New feature (start at Specify)
- Directory exists, no
tasks.md→ Specify or Design tasks.mdexists, tasks Pending → Implement (resume)- All tasks Done, no
validation-report.md→ Validate validation-report.mdexists → Complete
If no specs/ directory exists, create it.
Resuming
When specs/_current points to an active spec:
- Read the progress log for context from prior sessions
- Check
git statusandgit log --oneline -5to see what was last committed - Find the first task with Status: Pending or In Progress
- Summarize to the user: "Resuming spec NNNN, task N: [title]. Last completed: [summary]." Then continue Phase 4.
Phases
| Phase | When | Reference |
|---|---|---|
| 1. Specify | New feature | phase-specify.md |
| 2. Design | Deep depth only | phase-design.md |
| 3. Tasks | After spec confirmed | phase-tasks.md |
| 4. Implement | Tasks are Pending | phase-implement.md |
| 5. Validate | All tasks Done | phase-validate.md |
See example-spec.md for a complete output example.
Conventions
- One spec directory per feature
- 4-digit zero-padded numbering (0001, 0002, ...)
- Commits reference the spec and task number
- Commits are frequent — after each task, not at the end
- The agent works autonomously within a task but does not skip phase transitions without user confirmation
Boundaries
- DOES create and update files in
specs/ - DOES create feature branches when asked
- DOES commit during implementation phase
- Does NOT modify files outside the current task's boundary
- Does NOT skip phase gates without user confirmation
- Does NOT delete or overwrite existing specs
Common Failures
- Skipping confirmation — proceeding to implementation without user sign-off on the spec or tasks leads to building the wrong thing.
- Tasks too large — each task should be completable in one commit. If a task needs multiple commits, split it.
- No progress log — without log entries, the next session can't tell what happened. Always log after each task.
Best Practices
- Keep tasks to one commit, one concern
- Investigate code before asking — read first, ask second
- Log progress after every task for session continuity
- Spec the why, tasks the what
- Quick depth for < 3 files, Standard for features
├── references/
SKILL.md | | Raw
Spec-Driven Dev
Phase details: See references/phase-*.md for step-by-step instructions per phase.
Drive feature work from idea to implementation through repo-stored specs. Five phases: specify → design → tasks → implement → validate.
Execution Flow
- Detect state → enter correct phase
- Specify requirements with user
- Design architecture (deep only)
- Break into atomic tasks → confirm
- Implement tasks sequentially with commits
- Ask user about validation → validate in fresh session
Mode Detection
Read specs/_current to determine state:
- File missing or empty → New feature (start at Specify)
- Directory exists, no
tasks.md→ Specify or Design tasks.mdexists, tasks Pending → Implement (resume)- All tasks Done, no
validation-report.md→ Validate validation-report.mdexists → Complete
If no specs/ directory exists, create it.
Resuming
When specs/_current points to an active spec:
- Read the progress log for context from prior sessions
- Check
git statusandgit log --oneline -5to see what was last committed - Find the first task with Status: Pending or In Progress
- Summarize to the user: "Resuming spec NNNN, task N: [title]. Last completed: [summary]." Then continue Phase 4.
Phases
| Phase | When | Reference |
|---|---|---|
| 1. Specify | New feature | phase-specify.md |
| 2. Design | Deep depth only | phase-design.md |
| 3. Tasks | After spec confirmed | phase-tasks.md |
| 4. Implement | Tasks are Pending | phase-implement.md |
| 5. Validate | All tasks Done | phase-validate.md |
See example-spec.md for a complete output example.
Conventions
- One spec directory per feature
- 4-digit zero-padded numbering (0001, 0002, ...)
- Commits reference the spec and task number
- Commits are frequent — after each task, not at the end
- The agent works autonomously within a task but does not skip phase transitions without user confirmation
Boundaries
- DOES create and update files in
specs/ - DOES create feature branches when asked
- DOES commit during implementation phase
- Does NOT modify files outside the current task's boundary
- Does NOT skip phase gates without user confirmation
- Does NOT delete or overwrite existing specs
Common Failures
- Skipping confirmation — proceeding to implementation without user sign-off on the spec or tasks leads to building the wrong thing.
- Tasks too large — each task should be completable in one commit. If a task needs multiple commits, split it.
- No progress log — without log entries, the next session can't tell what happened. Always log after each task.
Best Practices
- Keep tasks to one commit, one concern
- Investigate code before asking — read first, ask second
- Log progress after every task for session continuity
- Spec the why, tasks the what
- Quick depth for < 3 files, Standard for features
references/example-spec.md | | Raw
Example: Standard Depth Spec
A minimal example showing the expected output format for a Standard depth feature.
specs/0001-user-search/spec.md
---
status: Draft
depth: Standard
---
# User Search
## Story
As a user, I want to search for other users by name
so I can find and connect with people I know.
## Requirements
- Search input with debounced API calls (300ms)
- Results show name, avatar, and role
- Empty state: "No users found"
- Min 2 characters to trigger search
- Results limited to 20 entries
## Out of Scope
- Pagination of results
- Search filters (by role, department)
- Fuzzy matching
## Open Questions
- None
specs/0001-user-search/tasks.md
# Tasks: User Search
## Tasks
### 1. Add search API endpoint
- **Status**: Pending
- **Goal**: Create GET /api/users/search?q= endpoint
- **Boundary**: `src/routes/users.ts`
- **Depends**: None
- **Done when**: Endpoint returns matching users as JSON,
limited to 20 results, min 2 char query enforced
- **Verify**: `npm test -- --grep "user search"`
### 2. Add search UI component
- **Status**: Pending
- **Goal**: Search input with debounced calls and
result list display
- **Boundary**: `src/components/UserSearch.tsx`
- **Depends**: 1
- **Done when**: Input triggers search after 300ms,
results render with name/avatar/role, empty state shows
- **Verify**: `npm test -- --grep "UserSearch"`
## Progress Log
references/phase-design.md | | Raw
Phase 2: Design (Deep only)
-
Investigate the codebase — Read relevant files, existing patterns, dependencies.
-
Write design.md — Use the design.md template from spec-templates.
-
Confirm — Show the design to the user. Do not proceed without confirmation.
references/phase-implement.md | | Raw
Phase 4: Implement
For each task with Status: Pending:
- Update task status to
In Progress - Read the progress log for notes from earlier tasks
- Read the task's goal, boundary, and done-when criteria
- Build the implementation
- Run tests and verify against done-when criteria. If tests fail, fix before proceeding. For non-testable criteria (visual, behavioral), describe what was checked and the observed result in the progress log.
- Update task status to
Done - Add a progress log entry with date and summary
- Commit:
type(scope): description Part of specs/NNNN-slug task N. - Move to next Pending task
When all tasks are Done:
- Ask the user: "All tasks complete. Would you like to run validation (recommended for a fresh-perspective review)?"
- If yes → proceed to Phase 5 (Validate)
- If no → continue below
Mark complete:
- Update
spec.mdstatus toDone - Clear
specs/_current - Inform the user the feature is complete and ask whether to push the branch and open a PR
references/phase-specify.md | | Raw
Phase 1: Specify
Before asking about requirements, complete these in order:
-
Determine depth — Ask the user:
- Quick — small fix or change. Write a
brief.md(a few sentences capturing scope) then skip to implementation. No full spec needed. - Standard — typical feature.
spec.md+tasks.md. - Deep — complex feature.
spec.md+design.md+tasks.md.
- Quick — small fix or change. Write a
-
Create the directory — Next sequential 4-digit number:
specs/NNNN-slug/. Check existing directories. -
Ask about branching — "Would you like me to create a feature branch? Suggested name:
feature/NNNN-slug" Do not create the branch without confirmation. If the branch already exists, switch to it instead of creating.
Then collect requirements:
-
Investigate relevant code — Read files related to the feature before asking questions. Check existing patterns, dependencies, and constraints. Don't ask the user what you can look up yourself.
-
Ask targeted questions:
- What does the user want to build?
- What does success look like?
- What is out of scope?
- Are there open questions that block implementation?
-
Write spec.md — Use the spec.md template from spec-templates. Set status to
Draftand depth to the chosen level. -
Set active — Write the directory name to
specs/_current. -
Resolve open questions — If the spec has an Open Questions section with unresolved items, walk through each one with the user and get a decision. Update the spec to reflect the answers (move decisions into Requirements or remove the question). Do not proceed with open questions remaining.
-
Confirm — Show the spec to the user. Do not proceed to the next phase without confirmation.
references/phase-tasks.md | | Raw
Phase 3: Tasks
-
Break down the spec (and design if present) into ordered tasks. Each task should be completable in one commit and touch one concern. If you need multiple commits, split the task.
-
Write tasks.md — Use the tasks.md template from spec-templates.
-
Confirm — Show the task breakdown. Do not start implementing without confirmation.
references/phase-validate.md | | Raw
Phase 5: Validate
A fresh agent session is recommended for validation to avoid builder bias.
-
Read spec.md — load requirements and acceptance criteria only. Do not read tasks.md or the progress log.
-
Review the implementation — read the code changes (use
git diff mainor the feature branch diff). -
Write validation-report.md — Use the template from spec-templates:
- Check each requirement against the implementation
- Verify out-of-scope items were not built
- Note any issues found
-
Report — show the validation report to the user. If issues are found, the feature returns to Phase 4 for fixes.
references/spec-templates.md | | Raw
Spec Templates
brief.md (Quick depth only)
# Brief: Title
Scope: one or two sentences describing what this change does.
Date: YYYY-MM-DD
spec.md
---
status: Draft
depth: Standard
---
# Feature Title
## Story
As a ..., I want ..., so that ...
## Requirements
- Acceptance criteria
## Out of Scope
- What this feature does not include
## Open Questions
- Unresolved items
design.md
# Design: Feature Title
## Architecture
- Approach, file paths, components affected
## Decisions
- Key trade-offs and rationale
## Dependencies
- External systems, libraries, other features
tasks.md
# Tasks: Feature Title
## Tasks
### 1. Task name
- **Status**: Pending
- **Goal**: What this achieves
- **Boundary**: Files/modules this task touches
- **Depends**: Task numbers that must complete first
- **Done when**: Observable criteria
- **Verify**: Command to prove completion (optional)
### 2. Next task
- **Status**: Pending
- **Goal**: ...
- **Boundary**: ...
- **Depends**: ...
- **Done when**: ...
- **Verify**: ...
## Progress Log
validation-report.md
# Validation: Feature Title
## Requirements Check
- [x] Requirement — verified by ...
- [ ] Requirement — FAILED: ...
## Out of Scope Verified
- Confirmed: no work done on excluded items
## Issues Found
- Description of any problems found
spec-workflow drives feature development through five phases: specify requirements, design architecture, break into tasks, implement with commits, and validate.
Why phases are split into reference files
The main SKILL.md stays under 130 lines by deferring
phase details to references/phase-*.md. This keeps
the execution flow scannable while giving each phase
full step-by-step instructions. An agent reads the
phase file only when entering that phase — saving
context tokens for the actual work.
Why mode detection uses a _current pointer
specs/_current lets the agent resume without scanning
every spec directory. One file read determines the active
spec. Without it, the agent would need to walk all spec
dirs looking for pending tasks — expensive in large repos.
Why phase transitions require user confirmation
Each phase transition requires user confirmation. Without gates, the agent builds the wrong thing (confirmed by real-world testing). The cost of one "does this look right?" question is far less than rebuilding after a misunderstood requirement.
Why each task must be exactly one commit
Multi-commit tasks create ambiguous resume points. When a session dies mid-task, the progress log and git history must agree on what's done. One task = one commit = one log entry makes this unambiguous.
Why progress logs exist
Agent sessions have finite context. The progress log is the handoff mechanism between sessions — it records what was done, what was decided, and what to do next. Without it, resuming requires the user to re-explain context that was already established.
Why there are two depth modes
Quick (< 3 files, no design phase) and Standard (full 5-phase). Most changes don't need architecture design. Forcing every change through five phases wastes time on trivial work. The trigger check in the description helps agents self-select the right depth.
[1.1.1] - 2026-06-11
Added
- RATIONALE.md explaining design decisions
[1.1.0] - 2026-06-03
Added
- Execution Flow summary for quick-glance overview
- Best Practices section with positive guidance
- Concrete example spec in references/example-spec.md
Changed
- Split phase details into individual reference files for reduced token cost (phase-specify, phase-design, phase-tasks, phase-implement, phase-validate)
- SKILL.md reduced from ~160 to ~95 lines
[1.0.2] - 2026-06-03
Added
- Explicit step to resolve open questions before confirming spec
[1.0.1] - 2026-06-02
Fixed
- Prompt user for validation before clearing spec as done (Phase 5 was silently skipped in practice)
[1.0.0] - 2026-05-24
Added
- Five-phase workflow: specify → design → tasks → implement → validate
- Depth adaptation: Quick (brief.md), Standard (spec + tasks), Deep (spec + design + tasks)
- Mode detection from file state for session resumability
- Validation phase with fresh-agent recommendation
- Boundary and Depends annotations on tasks
- Progress log forward-reading between tasks
- References: spec-templates.md with all file templates