@benjaminthomas/spec-driven-dev 0.0.0-stage → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +557 -2
  3. package/bin/cli.mjs +415 -0
  4. package/package.json +12 -4
  5. package/skills/generative-seo/SKILL.md +255 -0
  6. package/skills/generative-seo/assets/citation-log-template.md +17 -0
  7. package/skills/generative-seo/assets/competitor-analysis-template.md +20 -0
  8. package/skills/generative-seo/assets/content-plan-template.md +15 -0
  9. package/skills/generative-seo/assets/geo-config-template.md +33 -0
  10. package/skills/generative-seo/assets/geo-playbook-template.md +22 -0
  11. package/skills/generative-seo/assets/social-queue-template.md +8 -0
  12. package/skills/generative-seo/references/geo-methodology.md +143 -0
  13. package/skills/spec-checkpoint/SKILL.md +106 -0
  14. package/skills/spec-create/SKILL.md +149 -0
  15. package/skills/spec-create/references/action-required-template.md +53 -0
  16. package/skills/spec-create/references/readme-template.md +53 -0
  17. package/skills/spec-create/references/requirements-template.md +54 -0
  18. package/skills/spec-create/references/task-template.md +86 -0
  19. package/skills/spec-implement/SKILL.md +236 -0
  20. package/skills/spec-implement/references/coder-prompt-template.md +48 -0
  21. package/skills/spec-implement/references/fix-prompt-template.md +38 -0
  22. package/skills/spec-implement/references/review-prompt-template.md +50 -0
  23. package/skills/spec-investigate/SKILL.md +323 -0
  24. package/skills/spec-investigate/references/report-template.md +53 -0
  25. package/skills/spec-setup/SKILL.md +105 -0
  26. package/skills/spec-setup/references/config-template.yml +45 -0
  27. package/skills/spec-ship/SKILL.md +218 -0
  28. package/skills/spec-verify/SKILL.md +153 -0
  29. package/skills/spec-verify/references/report-template.md +57 -0
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: spec-create
3
+ description: >
4
+ Create a structured feature specification with self-contained task files organized into
5
+ parallel execution batches. Use this skill when the user says "create a spec", "plan this feature",
6
+ "write up an implementation plan", "break this into tasks", or after any planning conversation
7
+ where the user wants to capture decisions as actionable spec files. Also use when the user
8
+ says "/spec-create" (or their host's equivalent invocation syntax) or wants to decompose a
9
+ feature into work items that agents can implement independently. This skill produces local
10
+ spec files under specs/{feature}/ — no GitHub integration.
11
+ license: MIT
12
+ ---
13
+
14
+ # Create Feature Specification
15
+
16
+ Transform a planning conversation into a structured spec folder that enables parallel agent implementation. The spec breaks a feature into self-contained task files — each one detailed enough that a coder agent can pick it up cold and implement it without reading anything else.
17
+
18
+ The key insight: implementation plans that live in a single file are either too large for a context window or too shallow for independent execution. By splitting into one file per task with full context in each, we enable multiple agents to work in parallel while keeping each agent's context focused.
19
+
20
+ ## Project config (read first)
21
+
22
+ Load `.spec-driven.yml`: walk up from the current directory to the home folder, and the first one
23
+ found wins (a `multi-repo` config only applies inside the repos it lists). Its values beat anything
24
+ you would detect or assume. This skill uses `layout`/`repos` and `specs_dir`.
25
+
26
+ **Monorepo / multi-repo:** every task names its package or repo, and its file paths are relative to that. Keep each task inside one repo. Cross-repo work becomes separate tasks, with the contract (API shape, event, schema) written into both.
27
+
28
+ **No config?** If the `spec-setup` skill is available, run it first, then continue here. If it
29
+ isn't, detect what this skill needs from the repo, ask about anything ambiguous, and offer to save
30
+ the answers to `.spec-driven.yml` (keys: `layout`, `repos`, `tracker`, `git`, `commands`,
31
+ `specs_dir`).
32
+
33
+ ## When to Use
34
+
35
+ - After a planning conversation where requirements and technical details have been discussed
36
+ - When the user asks to create a spec, plan a feature, or break work into tasks
37
+ - When the user wants to prepare work for parallel agent implementation
38
+
39
+ ## Instructions
40
+
41
+ ### Step 1: Gather Requirements
42
+
43
+ If a `{specs_dir}/*/investigation.md` (default `specs/`) from `spec-investigate` exists for this work, read it first and treat it as the evidence base: carry its VERIFIED facts, affected files, risks, and acceptance criteria into the spec, reuse its folder (`specs/{feature-slug}/`) instead of naming a new one in Step 2, and turn its open questions/UNKNOWNs into items for the user or `action-required.md` rather than guessing.
44
+
45
+ If the conversation already contains planning context (requirements discussed, technical decisions made, architecture outlined), extract all of it. Review the entire conversation to ensure nothing is lost — the spec is the single source of truth, and anything not captured here disappears.
46
+
47
+ If no planning conversation exists, interview the user:
48
+ - What does this feature do and why does it matter?
49
+ - What are the acceptance criteria?
50
+ - What technical constraints or decisions have been made?
51
+ - What files, APIs, schemas, or patterns are involved?
52
+
53
+ ### Step 2: Name the Feature
54
+
55
+ Choose a kebab-case name that clearly identifies the feature (e.g., `add-user-auth`, `migrate-to-postgres`, `dashboard-redesign`). This becomes the folder name under `specs/`.
56
+
57
+ ### Step 3: Decompose into Tasks
58
+
59
+ Break the implementation into atomic tasks. Each task should:
60
+ - Be completable in a single coding session by one agent
61
+ - Have a clear, specific scope (one concern per task)
62
+ - Produce working, testable code when complete
63
+ - Not overlap in files modified with other tasks in the same batch
64
+
65
+ Think carefully about granularity. Too coarse and agents can't work in parallel. Too fine and the overhead of context-switching between tasks dominates. A good task typically creates or modifies 1-5 files around a single concern.
66
+
67
+ Tests ship with the code they cover: fill in each task's **Tests** section (see the task template) instead of creating separate "write tests" tasks. Only add a standalone testing task for cross-cutting suites (e.g. a new E2E harness) or when the user asks for one.
68
+
69
+ ### Step 4: Build the Dependency Graph
70
+
71
+ For each task, identify:
72
+ - **What it depends on**: which tasks must complete before this one can start
73
+ - **What depends on it**: which tasks are blocked until this one finishes
74
+
75
+ Tasks with no dependencies form Batch 1. Tasks whose dependencies are all in Batch 1 form Batch 2. And so on. All tasks within a batch can execute in parallel.
76
+
77
+ When assigning batches, verify that tasks within the same batch do not modify overlapping files. If two tasks in the same batch would touch the same file, move one to a later batch — parallel agents on the same branch cannot safely modify the same file.
78
+
79
+ ### Step 5: Create the Spec Folder
80
+
81
+ Create the following structure at `specs/{feature-name}/`:
82
+
83
+ ```
84
+ specs/{feature-name}/
85
+ ├── README.md
86
+ ├── requirements.md
87
+ ├── action-required.md
88
+ └── tasks/
89
+ ├── task-01-{name}.md
90
+ ├── task-02-{name}.md
91
+ └── ...
92
+ ```
93
+
94
+ Read the templates in `references/` before writing each file:
95
+ - `references/readme-template.md` — for the README (dependency graph, batch table, status tracking)
96
+ - `references/task-template.md` — for each task file (self-contained with all context)
97
+ - `references/requirements-template.md` — for the requirements document
98
+ - `references/action-required-template.md` — for manual human steps
99
+
100
+ Task files are numbered with zero-padded two-digit prefixes in topological order: Batch 1 tasks first, then Batch 2, etc. Within a batch, order is arbitrary but stable.
101
+
102
+ ### Step 6: Write Self-Contained Task Files
103
+
104
+ This is the most important step. Each task file is the **only thing** a coder agent will read before implementing. It must contain everything the agent needs:
105
+
106
+ - **Description**: what to build and why it matters in context
107
+ - **Dependency context**: what prior tasks produce that this task needs (summarized in prose, not just filenames). The agent should not need to read other task files.
108
+ - **Technical details**: CLI commands, code snippets, schemas, file paths, env vars, API endpoints — every implementation-specific detail from the planning conversation
109
+ - **Files to create/modify**: explicit list with purpose for each
110
+ - **Acceptance criteria**: specific, verifiable conditions
111
+
112
+ Review each task file with fresh eyes: could an agent who has never seen the planning conversation implement this correctly using only this file? If not, add what's missing.
113
+
114
+ ### Step 7: Extract Manual Actions
115
+
116
+ Identify any steps that require human action (account creation, API key setup, DNS configuration, environment variables, third-party service registration, etc.). Write these to `action-required.md` grouped by timing (Before/During/After implementation). If none exist, note "No manual steps required."
117
+
118
+ ### Step 8: Report to User
119
+
120
+ After creating the spec, display:
121
+
122
+ ```
123
+ Feature specification created at specs/{feature-name}/
124
+
125
+ Files created:
126
+ - README.md (dependency graph, {N} batches, {T} tasks)
127
+ - requirements.md
128
+ - action-required.md
129
+ - tasks/ ({T} task files)
130
+
131
+ Batch breakdown:
132
+ - Batch 1: {count} tasks (parallel) — {brief description}
133
+ - Batch 2: {count} tasks (parallel) — {brief description}
134
+ - ...
135
+
136
+ Next steps:
137
+ 1. Review action-required.md for tasks you need to complete manually
138
+ 2. Review the requirements and task files
139
+ 3. Use /spec-implement to start parallel implementation
140
+ ```
141
+
142
+ ## Critical Rules
143
+
144
+ - Every task file must be fully self-contained — this is the entire point of the spec structure. A coder agent reading only that file must know exactly what to do.
145
+ - Capture ALL technical details from the planning conversation. The spec is the single source of truth — CLI commands, schemas, code snippets, file paths, env vars, API endpoints. Anything not captured here is lost.
146
+ - Tasks within the same batch must not modify overlapping files. Parallel agents on the same branch cannot safely touch the same files.
147
+ - Keep tasks atomic — one concern per task. If a task has more than 5-7 files to modify, consider splitting it.
148
+ - Put tests in each task's Tests section, not in separate testing tasks (unless the user asks, or it's a cross-cutting suite).
149
+ - Number task files in topological order (batch 1 first, then batch 2, etc.) for easy scanning.
@@ -0,0 +1,53 @@
1
+ # Action Required Template
2
+
3
+ Use this structure for the action-required.md at the root of each spec folder. This file captures manual steps that require human action and cannot be automated by agents.
4
+
5
+ ## Template (when manual steps exist)
6
+
7
+ ```markdown
8
+ # Action Required: {Feature Name}
9
+
10
+ Manual steps that must be completed by a human. These cannot be automated.
11
+
12
+ ## Before Implementation
13
+
14
+ - [ ] **{Action}** — {Brief reason why this is needed}
15
+ - [ ] **{Action}** — {Brief reason}
16
+
17
+ ## During Implementation
18
+
19
+ - [ ] **{Action}** — {Brief reason}
20
+
21
+ ## After Implementation
22
+
23
+ - [ ] **{Action}** — {Brief reason}
24
+
25
+ ---
26
+
27
+ > These tasks are also referenced in context within the relevant task files.
28
+ ```
29
+
30
+ ## Template (when no manual steps exist)
31
+
32
+ ```markdown
33
+ # Action Required: {Feature Name}
34
+
35
+ No manual steps required for this feature. All tasks can be implemented automatically.
36
+ ```
37
+
38
+ ## Common Manual Steps
39
+
40
+ - Account creation (third-party services, OAuth apps)
41
+ - API key generation and setup
42
+ - Environment variable configuration
43
+ - DNS or domain settings
44
+ - Billing or subscription setup
45
+ - Third-party service registration (webhooks, integrations)
46
+ - Certificate provisioning
47
+ - Access permissions or IAM roles
48
+
49
+ ## Key Points
50
+
51
+ - Group actions by timing: before, during, and after implementation. This helps the user know when they need to act.
52
+ - Keep descriptions brief — one line explaining what to do and why.
53
+ - Also reference these manual steps in the relevant task files so agents know to pause or skip that part.
@@ -0,0 +1,53 @@
1
+ # README Template
2
+
3
+ Use this structure for the README.md at the root of each spec folder. The README serves as the orchestration index — the `spec-implement` skill reads it to determine batch order, task assignments, and completion status.
4
+
5
+ ## Template
6
+
7
+ ```markdown
8
+ # {Feature Name}
9
+
10
+ ## Overview
11
+
12
+ {One paragraph summary of what the feature does and why it exists.}
13
+
14
+ ## Quick Links
15
+
16
+ - [Requirements](./requirements.md) — full requirements and acceptance criteria
17
+ - [Action Required](./action-required.md) — manual steps needing human action
18
+
19
+ ## Dependency Graph
20
+
21
+ ​```mermaid
22
+ graph TD
23
+ task-01-name["01: Task Title"]
24
+ task-02-name["02: Task Title"]
25
+ task-03-name["03: Task Title"]
26
+ task-01-name --> task-03-name
27
+ task-02-name --> task-03-name
28
+ ​```
29
+
30
+ ## Batches
31
+
32
+ | Batch | Tasks | Description |
33
+ |------|-------|-------------|
34
+ | 1 | task-01, task-02 | {Brief description of what this batch accomplishes} |
35
+ | 2 | task-03 | {Brief description} |
36
+
37
+ ## Task Status
38
+
39
+ ### Batch 1
40
+ - [ ] [task-01-{name}](./tasks/task-01-{name}.md) — {One-line title}
41
+ - [ ] [task-02-{name}](./tasks/task-02-{name}.md) — {One-line title}
42
+
43
+ ### Batch 2
44
+ - [ ] [task-03-{name}](./tasks/task-03-{name}.md) — {One-line title}
45
+ ```
46
+
47
+ ## Key Points
48
+
49
+ - The **Dependency Graph** uses Mermaid syntax (widely rendered in GitHub, VS Code, etc.). Each node shows the task number and title for quick reference.
50
+ - The **Batches** table provides a scannable overview of what runs in parallel.
51
+ - The **Task Status** section uses markdown checkboxes that the `spec-implement` skill updates as tasks complete. The orchestrator parses these to determine which batch to resume from.
52
+ - Links to task files use relative paths pointing into the `tasks/` subfolder.
53
+ - Tasks without dependencies have no incoming arrows in the graph — these form Batch 1.
@@ -0,0 +1,54 @@
1
+ # Requirements Template
2
+
3
+ Use this structure for the requirements.md at the root of each spec folder.
4
+
5
+ ## Template
6
+
7
+ ```markdown
8
+ # Requirements: {Feature Name}
9
+
10
+ ## Summary
11
+
12
+ {What the feature does and why it exists — 2-3 paragraphs covering the problem, the solution, and the expected outcome.}
13
+
14
+ ## Goals
15
+
16
+ - {Goal 1}
17
+ - {Goal 2}
18
+ - {Goal 3}
19
+
20
+ ## Non-Goals
21
+
22
+ {Explicitly out of scope — things that might seem related but are not part of this feature.}
23
+
24
+ - {Non-goal 1}
25
+ - {Non-goal 2}
26
+
27
+ ## Acceptance Criteria
28
+
29
+ {High-level criteria for the entire feature. Individual task files have their own granular criteria.}
30
+
31
+ - [ ] {Criterion 1}
32
+ - [ ] {Criterion 2}
33
+ - [ ] {Criterion 3}
34
+
35
+ ## Assumptions
36
+
37
+ {Things assumed to be true that could affect implementation if they turn out to be false.}
38
+
39
+ - {Assumption 1}
40
+ - {Assumption 2}
41
+
42
+ ## Technical Constraints
43
+
44
+ {Architecture decisions, technology choices, or constraints that affect all tasks.}
45
+
46
+ - {Constraint 1}
47
+ - {Constraint 2}
48
+ ```
49
+
50
+ ## Key Points
51
+
52
+ - The requirements doc provides **overall feature context** that each coder agent receives alongside its task file. Keep it focused on the "what" and "why" — individual task files handle the "how."
53
+ - Non-goals are important: they prevent agents from over-building. If search functionality is out of scope, say so — otherwise a well-meaning agent might add it.
54
+ - Acceptance criteria here are feature-level (the whole thing works end-to-end). Task-level criteria live in each task file.
@@ -0,0 +1,86 @@
1
+ # Task File Template
2
+
3
+ Use this structure for each task file in the `tasks/` subfolder. Each task file must be **fully self-contained** — a coder agent reading only this file should know exactly what to implement, why, and how.
4
+
5
+ ## Template
6
+
7
+ ```markdown
8
+ # Task {nn}: {Title}
9
+
10
+ ## Status
11
+
12
+ pending
13
+
14
+ ## Batch
15
+
16
+ {N}
17
+
18
+ ## Description
19
+
20
+ {2-5 sentences describing what this task accomplishes and why it matters in the context of the overall feature. Include enough context that an agent unfamiliar with the planning conversation understands the purpose.}
21
+
22
+ ## Dependencies
23
+
24
+ **Depends on:** {Comma-separated list of task filenames, or "None (Batch 1)"}
25
+ **Blocks:** {Comma-separated list of task filenames, or "None"}
26
+
27
+ **Context from dependencies:** {Prose summary of what the dependency tasks produce that this task needs. For example: "task-01-setup-database.md creates the PostgreSQL schema with users and sessions tables. This task builds the API routes that query those tables." This is what makes each file self-contained — the agent does not need to read other task files to understand its inputs.}
28
+
29
+ ## Files to Create
30
+
31
+ - `path/to/new-file.ts` — {Brief purpose}
32
+ - `path/to/another-file.ts` — {Brief purpose}
33
+
34
+ ## Files to Modify
35
+
36
+ - `path/to/existing-file.ts` — {What changes and why}
37
+
38
+ ## Technical Details
39
+
40
+ {All implementation-specific details from the planning conversation. This section is the single source of truth. Include:}
41
+
42
+ ### Implementation Steps
43
+
44
+ 1. {Step-by-step instructions with enough detail for independent implementation}
45
+ 2. {Include CLI commands where relevant: `pnpm add package-name`}
46
+ 3. {Include code snippets for non-obvious patterns}
47
+
48
+ ### Code Snippets
49
+
50
+ {Key type definitions, schemas, configuration blocks, or patterns that the implementer needs. Use fenced code blocks with language tags.}
51
+
52
+ ### Environment Variables
53
+
54
+ {If applicable:}
55
+ - `VAR_NAME` — {Purpose and example value}
56
+
57
+ ### API Endpoints
58
+
59
+ {If applicable:}
60
+ - `METHOD /path` — {Request/response shape}
61
+
62
+ ## Tests
63
+
64
+ {Which tests prove this task works, following the repo's existing test framework and layout (an investigation's Testing Context is the best source). For each: file path, type (unit/integration/E2E), and the behaviour it pins down. Write "None — {reason}" only for tasks with nothing testable (pure config, docs).}
65
+
66
+ - `path/to/thing.test.ts` — {behaviour under test}
67
+
68
+ ## Acceptance Criteria
69
+
70
+ - [ ] {Criterion 1 — specific and verifiable}
71
+ - [ ] {Criterion 2}
72
+ - [ ] {Criterion 3}
73
+
74
+ ## Notes
75
+
76
+ {Any additional context, edge cases, warnings, or architectural decisions relevant to this task. Omit this section if there's nothing to add.}
77
+ ```
78
+
79
+ ## Key Points
80
+
81
+ - The **Status** field is updated by the `spec-implement` skill: `pending` → `in-progress` → `complete`.
82
+ - The **Dependencies** section includes prose context (not just filenames) so the agent understands its inputs without reading other files. This is the most important part of making task files self-contained.
83
+ - **Files to Create** and **Files to Modify** make the task's scope explicit. Tasks in the same batch should not overlap on these lists.
84
+ - **Technical Details** captures everything from the planning conversation — CLI commands, schemas, code snippets, file paths, env vars, API endpoints. If it was discussed during planning and is relevant to this task, it belongs here.
85
+ - **Tests** names the tests the coder writes alongside the code. A behavioural acceptance criterion without a matching test is a gap — add the test or explain why it can only be checked by `spec-verify`.
86
+ - **Acceptance Criteria** should be specific enough that completion can be verified objectively (by a code review agent or a human).
@@ -0,0 +1,236 @@
1
+ ---
2
+ name: spec-implement
3
+ description: >
4
+ Orchestrate parallel implementation of a feature specification by dispatching coder agents
5
+ batch-by-batch with code review gates between batches. Use this skill when the user says
6
+ "implement this feature", "start implementing", "run the spec", "execute the plan",
7
+ "continue implementing", or wants to begin coding a previously planned feature from a
8
+ specs/{feature}/ folder. Also use when the user says "/spec-implement" (or their host's
9
+ equivalent invocation syntax) or drags a spec folder into the conversation and asks to
10
+ implement it. This skill does NOT write code itself — it orchestrates coder subagents that
11
+ work in parallel.
12
+ license: MIT
13
+ ---
14
+
15
+ # Implement Feature
16
+
17
+ Orchestrate the parallel implementation of a feature specification by dispatching coder agents batch-by-batch. This skill reads a spec folder (created by `spec-create`), identifies the next batch of parallelizable work, spawns coder agents for each task, and runs a code review gate before moving to the next batch.
18
+
19
+ The orchestrator never writes code itself. Its job is to:
20
+ 1. Parse the spec and determine what to do next
21
+ 2. Give each coder agent exactly the context it needs
22
+ 3. Verify the results via code review
23
+ 4. Manage the fix loop if review finds issues
24
+ 5. Track progress and commit completed batches
25
+
26
+ ## Project config (read first)
27
+
28
+ Load `.spec-driven.yml`: walk up from the current directory to the home folder, and the first one
29
+ found wins (a `multi-repo` config only applies inside the repos it lists). Its values beat anything
30
+ you would detect or assume. This skill uses `layout`/`repos`, `commands` (lint/typecheck/test per repo or package), and `git.commit_style`.
31
+
32
+ **Multi-repo:** create worktrees in each repo a task touches, run each repo's own commands in review, and make the batch commit in every repo that changed, using the same subject line.
33
+
34
+ **No config?** If the `spec-setup` skill is available, run it first, then continue here. If it
35
+ isn't, detect what this skill needs from the repo, ask about anything ambiguous, and offer to save
36
+ the answers to `.spec-driven.yml` (keys: `layout`, `repos`, `tracker`, `git`, `commands`,
37
+ `specs_dir`).
38
+
39
+ ## Orchestration Model
40
+
41
+ This skill's parallelism assumes your host can run multiple independent agents at once —
42
+ Claude Code's Agent/Task tool, Codex CLI's `spawn_agent`/`wait_agent`, Cursor's Subagents or
43
+ Background Agents, Antigravity's `invoke_subagent`, or whatever equivalent your host provides.
44
+ Use that mechanism throughout; give each dispatched agent only the context specified in Step 4
45
+ below, never the full conversation history.
46
+
47
+ If your host has no such mechanism, fall back to processing each batch's tasks sequentially in
48
+ the current session — implement one task fully, then the next — rather than skipping the batch.
49
+ The review gate (Step 6) still applies; run it as a distinct pass with a fresh, unbiased read of
50
+ the diff, even without a separate agent to run it in.
51
+
52
+ ## Prerequisites
53
+
54
+ A `specs/{feature}/` directory containing:
55
+ - `README.md` with batch assignments and task status checkboxes
56
+ - `requirements.md` with feature context
57
+ - `tasks/task-{nn}-*.md` files (one per task, self-contained)
58
+
59
+ This structure is produced by the `spec-create` skill. If the user doesn't have a spec folder, suggest they create one first.
60
+
61
+ ## Orchestration
62
+
63
+ ### Step 1: Load the Spec
64
+
65
+ 1. Read `specs/{feature}/README.md`
66
+ 2. Read `specs/{feature}/requirements.md`
67
+ 3. Parse the **Task Status** section in the README — look at the checkboxes:
68
+ - `- [x]` = completed task (skip)
69
+ - `- [ ]` = pending task (include)
70
+ 4. Determine the **current batch**: the first batch that has any incomplete tasks
71
+ 5. If all tasks in all batches are complete, report "All tasks complete!" and stop
72
+
73
+ This makes the skill **resumable** — if invoked on a partially completed spec, it picks up exactly where it left off.
74
+
75
+ ### Step 2: Process Each Batch
76
+
77
+ For each batch starting from the current one, execute Steps 3 through 8 below, then advance to the next batch.
78
+
79
+ ### Step 3: Prepare Batch Tasks
80
+
81
+ 1. Read all incomplete task files for this batch from the `tasks/` subfolder
82
+ 2. **Check for file overlaps**: scan the "Files to Create" and "Files to Modify" sections across all tasks in this batch. If any file appears in more than one task, warn the user:
83
+
84
+ ```
85
+ Warning: File overlap detected in Batch {N}:
86
+ - {file-path} is modified by both task-{nn} and task-{mm}
87
+
88
+ Options:
89
+ 1. Proceed anyway (risk of conflicts)
90
+ 2. Run these tasks sequentially instead of in parallel
91
+ ```
92
+
93
+ Wait for the user's decision before proceeding.
94
+
95
+ ### Step 4: Dispatch Coder Agents
96
+
97
+ For each task in the batch, delegate the work to an independent agent using your host's
98
+ parallel-agent mechanism (see Orchestration Model above). Dispatch every task in the batch at
99
+ once so they run concurrently — or, without a parallel-agent mechanism, work through them one
100
+ at a time in the current session.
101
+
102
+ Read `references/coder-prompt-template.md` and construct each agent's prompt by filling in:
103
+ - **{requirements}**: full text of `requirements.md`
104
+ - **{completed_tasks_summary}**: for each previously completed task, a one-paragraph summary of what was implemented and what files were created/modified (extract from the task file's Description section plus any completion notes)
105
+ - **{task_content}**: full text of the task file being assigned
106
+
107
+ The coder agents should NOT commit their changes — the orchestrator handles commits after review.
108
+
109
+ **Isolate parallel coders in git worktrees when the host allows it.** Coders sharing one working
110
+ tree can clobber each other's edits and each other's lint/test runs. If your host can run an agent
111
+ in its own worktree (e.g. Claude Code's `isolation: "worktree"`), use it for every coder in a
112
+ batch of 2+ tasks; otherwise create them yourself — `git worktree add -b spec/{feature}/task-{nn}
113
+ ../.worktrees/{feature}-task-{nn} HEAD` — and point each coder at its path. A single-task batch, or
114
+ a host with no way to give an agent a different working directory, runs in the main tree as before.
115
+
116
+ When the batch's coders finish, bring their work back into the main tree before the review gate:
117
+ commit inside each worktree (`wip: task-{nn}`), then `git merge --squash` each task branch into the
118
+ feature branch in task order, leaving the result unstaged. A merge conflict means the batch's tasks
119
+ weren't independent — stop, show the conflicting files, and ask the user how to resolve them. Remove
120
+ the worktrees and their branches (`git worktree remove`, `git branch -D`) once merged.
121
+
122
+ ### Step 5: Collect Results
123
+
124
+ Wait for all coder agents in the batch to complete. Each agent should report:
125
+ - Files created
126
+ - Files modified
127
+ - A summary of what was implemented
128
+
129
+ If any agent fails (returns an error or crashes), note the failure and continue with the remaining results. Report the failure to the user after the batch.
130
+
131
+ ### Step 6: Code Review Gate
132
+
133
+ Dispatch a single review pass in a fresh agent/session — not one of the coder agents from
134
+ Step 4, since the review needs an unbiased read of the diff it didn't write. Use your host's
135
+ parallel-agent mechanism if it supports spawning a distinct reviewer agent; otherwise perform
136
+ the review directly in the current session as its own clearly delimited pass.
137
+
138
+ Read `references/review-prompt-template.md` and construct the review prompt by filling in:
139
+ - **{batch_number}**: current batch number
140
+ - **{requirements}**: full text of `requirements.md`
141
+ - **{task_summaries}**: for each task in this batch, the task title and the coder agent's completion summary
142
+ - **{verification_commands}**: `commands.lint`/`typecheck`/`test` from `.spec-driven.yml` for each repo or package touched, or the project's own commands if there's no config (e.g., `pnpm lint && pnpm typecheck && pnpm test`)
143
+
144
+ The review agent should:
145
+ 1. Run lint, typecheck, and tests
146
+ 2. Verify acceptance criteria and the tests named in each task file
147
+ 3. Check that files integrate correctly (imports resolve, types match)
148
+ 4. Check for security issues and code quality
149
+ 5. Return a structured verdict: **PASS** or **FAIL** with specific issues
150
+
151
+ ### Step 7: Fix Loop
152
+
153
+ If the review returns **FAIL**:
154
+
155
+ 1. Parse the issues from the review (file paths, descriptions, suggested fixes)
156
+ 2. Group issues by the task they most closely relate to (match file paths against each task's "Files to Create/Modify")
157
+ 3. For each group, dispatch a coder agent (same mechanism as Step 4) with a fix prompt. Read `references/fix-prompt-template.md` and fill in:
158
+ - **{issues}**: the specific issues for this task group
159
+ - **{task_content}**: the original task file for context
160
+ 4. After fix agents complete, re-run the review (Step 6)
161
+
162
+ **Cap at 3 review cycles per batch.** If the third review still fails, stop and report to the user:
163
+
164
+ ```
165
+ Batch {N} review failed after 3 cycles. Outstanding issues:
166
+ {list of remaining issues}
167
+
168
+ Options:
169
+ 1. Fix these manually and re-run /spec-implement
170
+ 2. Proceed to the next batch anyway
171
+ 3. Stop here
172
+ ```
173
+
174
+ ### Step 8: Complete the Batch
175
+
176
+ After the batch passes review (or the user chooses to proceed):
177
+
178
+ 1. **Update task files**: for each completed task, change the Status field from `pending` to `complete`
179
+ 2. **Update README.md**: change `- [ ]` to `- [x]` for each completed task
180
+ 3. **Commit the batch**:
181
+ ```
182
+ git add -A
183
+ git commit -m "feat({feature}): complete batch {N} — {brief summary}" # or the config's git.commit_style
184
+ ```
185
+ 4. **Report batch completion**:
186
+ ```
187
+ Batch {N} of {total} complete.
188
+
189
+ Tasks completed:
190
+ - task-{nn}-{name}: {one-line summary}
191
+ - task-{mm}-{name}: {one-line summary}
192
+
193
+ Review: PASS
194
+ Commit: {hash}
195
+
196
+ Next: Batch {N+1} has {count} tasks ready for parallel execution.
197
+ ```
198
+
199
+ ### Step 9: Final Integration Review
200
+
201
+ After all batches are complete:
202
+
203
+ 1. Run lint and typecheck one final time
204
+ 2. Dispatch a review pass (same mechanism as Step 6) to review the full scope of changes (all files modified across all batches)
205
+ 3. Report the final status:
206
+
207
+ ```
208
+ Feature "{feature}" implementation complete.
209
+
210
+ Batches completed: {N}/{N}
211
+ Total tasks: {T}
212
+
213
+ Verification:
214
+ - Lint: {PASS/FAIL}
215
+ - Typecheck: {PASS/FAIL}
216
+ - Integration review: {PASS/FAIL with notes}
217
+
218
+ Next steps:
219
+ - Review the changes
220
+ - Push and create a PR when ready
221
+ ```
222
+
223
+ ## Error Handling
224
+
225
+ - **Coder agent failure**: mark the task as failed, report to user, continue with remaining tasks in the batch. The review step will catch integration issues.
226
+ - **Lint/typecheck failure after fix attempts**: report the specific errors and ask the user whether to commit anyway or fix manually.
227
+ - **All tasks already complete**: report completion and stop.
228
+ - **Missing spec folder**: ask the user to provide the feature name or suggest creating a spec with `spec-create`.
229
+
230
+ ## Key Principles
231
+
232
+ - **The orchestrator does not write code.** Its job is dispatch, review, and progress tracking. All implementation happens in coder subagents.
233
+ - **Each coder agent gets exactly one task.** This keeps each agent's context focused and manageable.
234
+ - **Completed task summaries are brief.** One paragraph per task — not the full file contents. This keeps coder agent prompts from growing unbounded as batches progress.
235
+ - **The review gate is non-negotiable.** Every batch gets reviewed before commit. This catches integration issues early rather than letting them compound across batches.
236
+ - **Progress is tracked in the spec files.** README checkboxes and task file status fields are the source of truth. This makes the skill resumable across sessions.