@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.
- package/LICENSE +21 -0
- package/README.md +557 -2
- package/bin/cli.mjs +415 -0
- package/package.json +12 -4
- package/skills/generative-seo/SKILL.md +255 -0
- package/skills/generative-seo/assets/citation-log-template.md +17 -0
- package/skills/generative-seo/assets/competitor-analysis-template.md +20 -0
- package/skills/generative-seo/assets/content-plan-template.md +15 -0
- package/skills/generative-seo/assets/geo-config-template.md +33 -0
- package/skills/generative-seo/assets/geo-playbook-template.md +22 -0
- package/skills/generative-seo/assets/social-queue-template.md +8 -0
- package/skills/generative-seo/references/geo-methodology.md +143 -0
- package/skills/spec-checkpoint/SKILL.md +106 -0
- package/skills/spec-create/SKILL.md +149 -0
- package/skills/spec-create/references/action-required-template.md +53 -0
- package/skills/spec-create/references/readme-template.md +53 -0
- package/skills/spec-create/references/requirements-template.md +54 -0
- package/skills/spec-create/references/task-template.md +86 -0
- package/skills/spec-implement/SKILL.md +236 -0
- package/skills/spec-implement/references/coder-prompt-template.md +48 -0
- package/skills/spec-implement/references/fix-prompt-template.md +38 -0
- package/skills/spec-implement/references/review-prompt-template.md +50 -0
- package/skills/spec-investigate/SKILL.md +323 -0
- package/skills/spec-investigate/references/report-template.md +53 -0
- package/skills/spec-setup/SKILL.md +105 -0
- package/skills/spec-setup/references/config-template.yml +45 -0
- package/skills/spec-ship/SKILL.md +218 -0
- package/skills/spec-verify/SKILL.md +153 -0
- package/skills/spec-verify/references/report-template.md +57 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Coder Agent Prompt Template
|
|
2
|
+
|
|
3
|
+
Use this template when constructing prompts for coder subagents. Replace the placeholders (`{requirements}`, `{completed_tasks_summary}`, `{task_content}`) with actual content from the spec files.
|
|
4
|
+
|
|
5
|
+
## Template
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
You are implementing a single task from a feature specification. Your job is to write the code described below — nothing more, nothing less.
|
|
9
|
+
|
|
10
|
+
## Feature Context
|
|
11
|
+
|
|
12
|
+
{requirements}
|
|
13
|
+
|
|
14
|
+
## What's Already Been Built
|
|
15
|
+
|
|
16
|
+
{completed_tasks_summary}
|
|
17
|
+
|
|
18
|
+
## Your Task
|
|
19
|
+
|
|
20
|
+
{task_content}
|
|
21
|
+
|
|
22
|
+
## Instructions
|
|
23
|
+
|
|
24
|
+
1. Read the relevant parts of the codebase to understand existing patterns, imports, and conventions
|
|
25
|
+
2. Write the tests listed in the task's Tests section first, using the repo's existing test framework, and run them to see them fail for the right reason (skip this only where the task says "None")
|
|
26
|
+
3. Implement everything described in the task's Technical Details and Implementation Steps until those tests pass
|
|
27
|
+
4. Follow the project's existing code patterns and conventions
|
|
28
|
+
5. Run the project's lint, typecheck, and test commands after making changes. Fix any errors before finishing — never delete, skip, or weaken a test to make it pass
|
|
29
|
+
6. Do NOT commit your changes — if you're in your own git worktree, leave the changes uncommitted there too — the orchestrator handles commits after review
|
|
30
|
+
6. When done, report:
|
|
31
|
+
- Files created (with paths)
|
|
32
|
+
- Files modified (with paths)
|
|
33
|
+
- Tests added and the test command's final result
|
|
34
|
+
- A one-paragraph summary of what you implemented
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Placeholder Details
|
|
38
|
+
|
|
39
|
+
- **{requirements}**: paste the full text of `requirements.md`. This gives the agent overall feature context — the "what" and "why" — so it can make good judgment calls during implementation.
|
|
40
|
+
|
|
41
|
+
- **{completed_tasks_summary}**: for each previously completed task, include a brief summary like:
|
|
42
|
+
```
|
|
43
|
+
- task-01-setup-database: Created PostgreSQL schema with users and sessions tables. Files: src/db/schema.ts, src/db/migrations/001_initial.sql
|
|
44
|
+
- task-02-auth-config: Set up Better Auth with email/password provider. Files: src/lib/auth.ts, src/lib/auth-client.ts
|
|
45
|
+
```
|
|
46
|
+
Keep each entry to 1-2 lines. The purpose is to give the agent awareness of what exists, not full implementation details.
|
|
47
|
+
|
|
48
|
+
- **{task_content}**: paste the full text of the task file (task-{nn}-{name}.md). This is the agent's primary instruction set — it contains the description, technical details, files to create/modify, and acceptance criteria.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Fix Agent Prompt Template
|
|
2
|
+
|
|
3
|
+
Use this template when constructing prompts for coder agents that fix issues found during code review. Replace the placeholders with actual content.
|
|
4
|
+
|
|
5
|
+
## Template
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
You are fixing specific issues found during code review. Address every issue listed below — do not skip any.
|
|
9
|
+
|
|
10
|
+
## Issues to Fix
|
|
11
|
+
|
|
12
|
+
{issues}
|
|
13
|
+
|
|
14
|
+
## Original Task Context
|
|
15
|
+
|
|
16
|
+
{task_content}
|
|
17
|
+
|
|
18
|
+
## Instructions
|
|
19
|
+
|
|
20
|
+
1. Fix each issue listed above. The review provided file paths, line numbers, and suggested fixes — use those as your starting point.
|
|
21
|
+
2. Run the project's lint and typecheck commands after making fixes. Resolve any new errors your fixes introduce.
|
|
22
|
+
3. Do NOT commit your changes — the orchestrator handles commits.
|
|
23
|
+
4. Do NOT make changes beyond what's needed to fix the listed issues. Stay within scope.
|
|
24
|
+
5. When done, report:
|
|
25
|
+
- What you fixed (reference each issue)
|
|
26
|
+
- Any files modified
|
|
27
|
+
- If you could NOT fix an issue, explain why
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Placeholder Details
|
|
31
|
+
|
|
32
|
+
- **{issues}**: the specific issues from the review that relate to this task. Include file paths, line numbers, descriptions, severity, and suggested fixes. Example:
|
|
33
|
+
```
|
|
34
|
+
- Issue 1: src/api/users.ts:42 — Missing error handling for database connection failure — Severity: high — Suggested fix: wrap the query in try/catch and return a 500 response
|
|
35
|
+
- Issue 2: src/api/users.ts:15 — Unused import 'Session' — Severity: low — Suggested fix: remove the import
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- **{task_content}**: the full text of the original task file for context. The fix agent may need to reference the task's technical details or acceptance criteria to understand the intended behavior.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Review Agent Prompt Template
|
|
2
|
+
|
|
3
|
+
Use this template when constructing prompts for the code review agent that runs between batches. Replace the placeholders with actual content.
|
|
4
|
+
|
|
5
|
+
## Template
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
You are reviewing the combined output of Batch {batch_number} of a feature implementation. Multiple coder agents worked in parallel on separate tasks — your job is to verify everything integrates correctly and meets quality standards.
|
|
9
|
+
|
|
10
|
+
## Feature Context
|
|
11
|
+
|
|
12
|
+
{requirements}
|
|
13
|
+
|
|
14
|
+
## Tasks Completed in This Batch
|
|
15
|
+
|
|
16
|
+
{task_summaries}
|
|
17
|
+
|
|
18
|
+
## Review Checklist
|
|
19
|
+
|
|
20
|
+
1. **Verification**: Run `{verification_commands}` and report results. Fix nothing — just report.
|
|
21
|
+
2. **Acceptance Criteria & Tests**: For each task listed above, check whether the implementation meets the acceptance criteria from its task file, and that the tests named in its Tests section exist, actually exercise that behaviour, and pass. Flag tests that were deleted, skipped, or weakened.
|
|
22
|
+
3. **Integration**: Verify that files created by different tasks work together:
|
|
23
|
+
- Imports resolve correctly
|
|
24
|
+
- Types match across module boundaries
|
|
25
|
+
- No duplicate or conflicting definitions
|
|
26
|
+
- Shared state (env vars, config) is consistent
|
|
27
|
+
4. **Code Quality**: Check for security issues, performance problems, and adherence to project conventions.
|
|
28
|
+
5. **Scope**: Verify each task stayed within its defined scope (Files to Create/Modify). Flag any unexpected file changes.
|
|
29
|
+
|
|
30
|
+
## Verdict
|
|
31
|
+
|
|
32
|
+
Respond with one of:
|
|
33
|
+
|
|
34
|
+
**VERDICT: PASS**
|
|
35
|
+
All checks passed. Include any minor observations as notes.
|
|
36
|
+
|
|
37
|
+
**VERDICT: FAIL**
|
|
38
|
+
Include a structured list of issues:
|
|
39
|
+
- **Issue 1**: {file:line} — {description} — Severity: {high/medium/low} — Suggested fix: {fix}
|
|
40
|
+
- **Issue 2**: ...
|
|
41
|
+
|
|
42
|
+
Group issues by the task they most closely relate to (based on which task's files are affected). This helps the orchestrator dispatch targeted fix agents.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Placeholder Details
|
|
46
|
+
|
|
47
|
+
- **{batch_number}**: the current batch number (e.g., "2")
|
|
48
|
+
- **{requirements}**: full text of `requirements.md`
|
|
49
|
+
- **{task_summaries}**: for each task in the batch, include the task title and the coder agent's completion summary (files created/modified + what was implemented)
|
|
50
|
+
- **{verification_commands}**: the project's lint, typecheck, and test commands. Check for `package.json` scripts (or the stack's equivalent) — typically `pnpm lint && pnpm typecheck && pnpm test` or similar.
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-investigate
|
|
3
|
+
description: >
|
|
4
|
+
Deep, evidence-based technical investigation of a piece of work BEFORE any specification or
|
|
5
|
+
implementation begins — starting from a ticket (Jira, GitHub Issues, Linear), a meeting/call
|
|
6
|
+
transcript, a plain-text description, a doc/PRD file, a Slack/email thread, or an error log.
|
|
7
|
+
Use when the user says "investigate STP-123", "spec-investigate", "look into this before we
|
|
8
|
+
plan it", or hands over any of those inputs and wants the
|
|
9
|
+
system understood (current behaviour, root cause, affected repos/files, risks, open
|
|
10
|
+
questions) rather than fixed or built yet. This is the first stage of the
|
|
11
|
+
investigate → create → (human approval) → implement → verify → ship pipeline — it hands off
|
|
12
|
+
to the existing spec-create skill and does not replace, duplicate, or invoke spec-create,
|
|
13
|
+
spec-implement, spec-verify, or spec-ship itself. Ticket-agnostic: works for bugs, features,
|
|
14
|
+
refactors, security, performance, infra, or cross-repository tickets in any repo.
|
|
15
|
+
license: MIT
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# spec-investigate
|
|
19
|
+
|
|
20
|
+
Discover and record the facts. Do not design the fix and do not write any code.
|
|
21
|
+
|
|
22
|
+
This skill is stage 1 of:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
spec-investigate → spec-create → human approval → spec-implement → spec-verify → spec-ship
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`spec-create`, `spec-implement`, `spec-verify`, and `spec-ship` already exist elsewhere (e.g. the
|
|
29
|
+
`spec-driven-dev` plugin, or whatever equivalent this host provides). **Never create, redesign,
|
|
30
|
+
duplicate, or invoke those skills from here.** Your only output is an investigation report plus a
|
|
31
|
+
ready-to-use work branch; a human decides when to run `spec-create` next.
|
|
32
|
+
|
|
33
|
+
## Project config (read first)
|
|
34
|
+
|
|
35
|
+
Load `.spec-driven.yml`: walk up from the current directory to the home folder, and the first one
|
|
36
|
+
found wins (a `multi-repo` config only applies inside the repos it lists). Its values beat anything
|
|
37
|
+
you would detect or assume. This skill uses `layout`/`repos` (where to look and what each repo does), `tracker`, `git.remote`, `git.base_branch`, `git.branch_name`, and `specs_dir`.
|
|
38
|
+
|
|
39
|
+
**Monorepo:** name the package(s) involved. **Multi-repo:** search every listed repo whose role fits the ticket, and create the work branch, with the same name, only in the repos the investigation shows need changes.
|
|
40
|
+
|
|
41
|
+
**No config?** If the `spec-setup` skill is available, run it first, then continue here. If it
|
|
42
|
+
isn't, detect what this skill needs from the repo, ask about anything ambiguous, and offer to save
|
|
43
|
+
the answers to `.spec-driven.yml` (keys: `layout`, `repos`, `tracker`, `git`, `commands`,
|
|
44
|
+
`specs_dir`).
|
|
45
|
+
|
|
46
|
+
## Invocation
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
spec-investigate STP-123
|
|
50
|
+
spec-investigate https://<org>.atlassian.net/browse/STP-123
|
|
51
|
+
spec-investigate STP-123 --context ./notes.md
|
|
52
|
+
spec-investigate #482 # GitHub issue in the current repo
|
|
53
|
+
spec-investigate https://github.com/<owner>/<repo>/issues/482
|
|
54
|
+
spec-investigate https://linear.app/<team>/issue/ENG-91
|
|
55
|
+
spec-investigate ./call-transcript.txt # transcript, notes, PRD, RFC, log — any file
|
|
56
|
+
spec-investigate "Checkout times out for EU users since Tuesday's deploy" # plain text
|
|
57
|
+
spec-investigate # with the material pasted in the same message
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The only required input is *something that describes the work* — a ticket ID/URL, a file, or text
|
|
61
|
+
pasted into the message. Below, "the ticket" means that primary input, whatever form it took. `--context` (a file path, or pasted text in the
|
|
62
|
+
same message) is optional supplementary evidence — a call transcript, meeting notes, a `.md`/`.txt`
|
|
63
|
+
file. Never block or stall waiting for context that doesn't exist; proceed without it.
|
|
64
|
+
|
|
65
|
+
Never hardcode a specific ticket ID into your behavior. Everything below must work identically for
|
|
66
|
+
any ticket key, tracker, or free-form input.
|
|
67
|
+
|
|
68
|
+
## The one rule everything else serves
|
|
69
|
+
|
|
70
|
+
**Do not guess when the answer can be discovered.** Every non-trivial claim in the final report
|
|
71
|
+
must be traceable to something you actually read — code, config, tests, git history, the
|
|
72
|
+
ticket, linked docs — not inferred from a plausible-sounding folder name or a guess at convention. Work
|
|
73
|
+
the loop:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
Question → Search → Evidence → Trace → Cross-check → Concrete answer
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
"I haven't looked yet" is not the same as "unknown." Only write UNKNOWN after you've actually
|
|
80
|
+
searched and found nothing — and say what you searched.
|
|
81
|
+
|
|
82
|
+
Calibrate investigation depth to the ticket. A one-line copy change doesn't need an architecture
|
|
83
|
+
diagram; a cross-service auth or data-migration ticket does. Don't manufacture process for a
|
|
84
|
+
trivial ticket, and don't shortcut a genuinely risky one.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Step 0 — Resolve the input and set up the branch safely
|
|
89
|
+
|
|
90
|
+
1. **Identify what kind of input this is and load all of it.** A tracker reference:
|
|
91
|
+
- `*.atlassian.net/browse/KEY-123` → Jira (Atlassian MCP tool, `jira`/`acli` CLI, or REST).
|
|
92
|
+
- `#482`, `owner/repo#482`, or a `github.com/.../issues/482` URL → GitHub Issues
|
|
93
|
+
(`gh issue view 482 --comments --json title,body,labels,comments,...`).
|
|
94
|
+
- `linear.app/.../issue/ENG-91` → Linear (Linear MCP tool or API).
|
|
95
|
+
- A bare `KEY-123` → use `tracker` from `.spec-driven.yml`; without one, the tracker the project already uses (CLAUDE.md/AGENTS.md, branch
|
|
96
|
+
names, PR links in `git log`); if that's ambiguous, try the trackers this host can reach and
|
|
97
|
+
ask if none resolves. If you can't reach the tracker at all, ask the user to paste the ticket
|
|
98
|
+
rather than guessing its contents.
|
|
99
|
+
|
|
100
|
+
Anything else is free-form input — read it in full:
|
|
101
|
+
- A file path (`.txt`/`.md`/`.vtt`/`.srt`/`.pdf`/`.docx`/log) → read the whole file.
|
|
102
|
+
- Pasted text — a transcript, Slack/email thread, PRD excerpt, stack trace, or a one-line
|
|
103
|
+
description → use it as-is.
|
|
104
|
+
- A URL to a doc, PR, Sentry/Datadog issue, or design → fetch it with whatever access the host
|
|
105
|
+
has; ask the user to paste it if you can't.
|
|
106
|
+
Free-form input has no fields, so extract them: a working title, the type of work, the stated
|
|
107
|
+
problem and desired outcome, any acceptance criteria actually stated, and who decided what.
|
|
108
|
+
Apply Step 1's classification to it (requirement vs. proposal vs. question) — a transcript is
|
|
109
|
+
not a spec. If it references a ticket, fetch that too and treat it as the scope of record.
|
|
110
|
+
|
|
111
|
+
For a ticket, pull title, type,
|
|
112
|
+
priority, labels, components, full description, comments, linked/parent/child issues, and
|
|
113
|
+
attachments. Follow meaningful links (a linked ticket that defines the actual contract, a
|
|
114
|
+
linked design doc) rather than stopping at the description.
|
|
115
|
+
|
|
116
|
+
2. **Determine the repository/repositories.** If you're already inside a git working directory
|
|
117
|
+
that plausibly owns this ticket's area, use it. If the ticket is cross-repo (confirmed from its
|
|
118
|
+
content, not assumed), identify every relevant repo and investigate each one — don't silently
|
|
119
|
+
pick just the one you happen to be sitting in. If you can't tell which repo(s) are relevant
|
|
120
|
+
from the ticket alone, say so and ask, rather than guessing.
|
|
121
|
+
|
|
122
|
+
3. **`git status` first, always.** If there are uncommitted changes unrelated to this ticket:
|
|
123
|
+
**stop** — do not stash, reset, clean, discard, commit, or force anything on the user's behalf.
|
|
124
|
+
Report exactly what you found and ask how to proceed.
|
|
125
|
+
|
|
126
|
+
4. **Determine the correct remote and base branch.** Run `git remote -v` — don't assume `origin`
|
|
127
|
+
is the right remote if there's more than one. Pick the base branch in this order: `git.base_branch` in
|
|
128
|
+
`.spec-driven.yml` → what `CLAUDE.md`/`AGENTS.md`/memory/prior project context says for this repo → the remote's default
|
|
129
|
+
branch (`git remote show <remote>` or `gh repo view --json defaultBranchRef`). If the repo also
|
|
130
|
+
has an integration branch (`staging`, `develop`) that recent work branches were cut from, and
|
|
131
|
+
nothing says which to use, stop and ask rather than guessing. Fetch it and record its latest
|
|
132
|
+
commit SHA.
|
|
133
|
+
|
|
134
|
+
5. **Name the branch by the repo's convention, then stick to it exactly.** Use, in order: `git.branch_name`
|
|
135
|
+
in `.spec-driven.yml` → an explicit rule in `CLAUDE.md`/`AGENTS.md`/memory → the pattern recent branches already follow
|
|
136
|
+
(`git branch -r --sort=-committerdate | head -20` — e.g. bare `STP-123`, or `fix/STP-123-…`) →
|
|
137
|
+
default `<type>/<TICKET-ID>-<short-slug>` with the same prefixes `spec-ship` uses (`feat/`,
|
|
138
|
+
`fix/`, `refactor/`, `chore/`, `docs/`). Don't invent a new pattern alongside an existing one.
|
|
139
|
+
With no ticket ID (free-form input), use `<type>/<short-slug>` from the working title, and ask
|
|
140
|
+
whether there's a ticket it should be linked to.
|
|
141
|
+
|
|
142
|
+
6. **If the branch already exists** (locally or remotely): do not delete, reset, rebase, or
|
|
143
|
+
recreate it. Investigate first — what commit is it on, does it already have commits ahead of
|
|
144
|
+
base, uncommitted changes, an existing `specs/` folder or investigation report, signs of
|
|
145
|
+
started implementation? If continuing risks losing someone's work, **stop and report** instead
|
|
146
|
+
of proceeding. If it's clean and simply behind the latest base, that's fine to note, not fix
|
|
147
|
+
unprompted.
|
|
148
|
+
|
|
149
|
+
7. **If the branch doesn't exist:** create it directly from the fetched base commit. Never modify
|
|
150
|
+
the base branch itself, never force-push.
|
|
151
|
+
|
|
152
|
+
8. Record for the report: source type (ticket / transcript / text / doc / log), ticket ID +
|
|
153
|
+
tracker + URL or file path, working title, type of work, branch name, base branch, base commit
|
|
154
|
+
SHA.
|
|
155
|
+
|
|
156
|
+
## Step 1 — Read the optional context, but don't crown it source of truth
|
|
157
|
+
|
|
158
|
+
If `--context` or pasted material was given, read it fully. It is **supplementary evidence**, not
|
|
159
|
+
automatically a requirement. For every substantive claim in it, classify what kind of statement it
|
|
160
|
+
actually is: a stated requirement, a business decision, a technical decision, a constraint, a
|
|
161
|
+
description of existing behaviour, a proposed (not decided) solution, a question, an assumption, or
|
|
162
|
+
just an example. A sentence like "maybe we should add another endpoint" is a proposed approach to
|
|
163
|
+
investigate against the existing API, not a requirement to build it.
|
|
164
|
+
|
|
165
|
+
Default evidence hierarchy when sources disagree — but actually evaluate conflicts, don't apply
|
|
166
|
+
this mechanically:
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
Repository / actual system behaviour
|
|
170
|
+
↓
|
|
171
|
+
Ticket scope and acceptance criteria
|
|
172
|
+
↓
|
|
173
|
+
User-provided context / meeting discussion
|
|
174
|
+
↓
|
|
175
|
+
Supporting documentation
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
When the context introduces something not in the ticket at all and it would materially affect scope,
|
|
179
|
+
architecture, data, APIs, security, or effort: don't fold it in silently. Flag it as Confirmed /
|
|
180
|
+
Likely / Proposed / Needs Clarification, and if sources genuinely conflict, document it as:
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
Ticket says: ...
|
|
184
|
+
Additional context says: ...
|
|
185
|
+
Repository currently does: ...
|
|
186
|
+
Impact: ...
|
|
187
|
+
Recommended clarification: ...
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
No context supplied is a completely normal case — proceed on ticket + repository evidence alone,
|
|
191
|
+
don't ask for a transcript that may not exist.
|
|
192
|
+
|
|
193
|
+
## Step 2 — Understand the ticket itself
|
|
194
|
+
|
|
195
|
+
From the ticket: problem statement, expected behaviour, acceptance criteria, type (bug / feature /
|
|
196
|
+
refactor / security / infra / perf / data / integration / UI / API / DB — whatever it actually is,
|
|
197
|
+
don't force it into a category it isn't). Pull in anything linked that actually defines scope.
|
|
198
|
+
|
|
199
|
+
## Step 3 — Map the relevant system before touching anything
|
|
200
|
+
|
|
201
|
+
For each relevant repo, briefly note why it's relevant and which app/service/module inside it
|
|
202
|
+
matters. Then trace the ACTUAL implementation — not what the folder names suggest — through
|
|
203
|
+
whichever of these layers are real for this stack:
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
Client/UI → Route/Controller → Service/Business logic → Data access → Database → External integration
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Also check, wherever relevant to the ticket (skip what plainly doesn't apply): auth/authz,
|
|
210
|
+
validation, state management, feature flags, background jobs/queues/events, caching, retries,
|
|
211
|
+
idempotency, error handling, logging/observability, deployment behaviour.
|
|
212
|
+
|
|
213
|
+
For the specific behaviour the ticket is about, document the real execution flow with concrete
|
|
214
|
+
references — file paths, function/class/component names, route handlers, DB tables/migrations,
|
|
215
|
+
config keys, env vars. "The backend handles this" is not an answer; name the file and function.
|
|
216
|
+
|
|
217
|
+
## Step 4 — Root cause (bug/regression tickets)
|
|
218
|
+
|
|
219
|
+
Don't accept the ticket's stated cause at face value — verify it against the code. Classify your
|
|
220
|
+
conclusion as `CONFIRMED ROOT CAUSE`, `LIKELY ROOT CAUSE` (explain the gap), or
|
|
221
|
+
`ROOT CAUSE NOT YET CONFIRMED` (explain what more would nail it down). If the real cause differs
|
|
222
|
+
from what the ticket claims, say so plainly and show the evidence.
|
|
223
|
+
|
|
224
|
+
## Step 5 — Change surface, without scope-creeping it
|
|
225
|
+
|
|
226
|
+
Bucket every piece of work you can see coming into exactly one of:
|
|
227
|
+
|
|
228
|
+
- **Required** — needed to satisfy the ticket.
|
|
229
|
+
- **Supporting** — needed to safely enable the required change (a migration, a flag, a test seam).
|
|
230
|
+
- **Optional** — genuinely nice, not required; name it as optional, don't fold it into Required.
|
|
231
|
+
- **Out of scope** — things you noticed along the way that should explicitly NOT be touched now.
|
|
232
|
+
|
|
233
|
+
An investigation that quietly balloons into "and also we should refactor X" has failed this step.
|
|
234
|
+
|
|
235
|
+
## Step 6 — Dependencies, risks, security, performance (as relevant)
|
|
236
|
+
|
|
237
|
+
For each meaningful risk: what it is, why it exists, the potential impact, the evidence behind it,
|
|
238
|
+
and what mitigation it implies — don't list generic risk categories with nothing backing them.
|
|
239
|
+
Cover, where actually applicable to this ticket (don't manufacture relevance): internal/external
|
|
240
|
+
dependencies, API/DB/schema changes, backward compatibility, data migration, concurrency/race
|
|
241
|
+
conditions, retries/idempotency/duplicate processing, rollback, auth/authz/tenant isolation, input
|
|
242
|
+
validation, secrets/sensitive data handling, query performance/N+1/pagination, caching, rate
|
|
243
|
+
limits, timeouts. Tie every recommendation to evidence you actually found — not "this could
|
|
244
|
+
theoretically be slow."
|
|
245
|
+
|
|
246
|
+
## Step 7 — Testing landscape
|
|
247
|
+
|
|
248
|
+
Find what already tests this area (unit/integration/API/component/E2E, fixtures, mocks, CI config)
|
|
249
|
+
and what doesn't. Note existing patterns worth reusing and obvious regression risk if untested
|
|
250
|
+
paths change. **Do not write or implement any tests here** — this step only maps the landscape for
|
|
251
|
+
`spec-create` to plan against.
|
|
252
|
+
|
|
253
|
+
## Step 8 — Completion gate
|
|
254
|
+
|
|
255
|
+
Before writing the report, check you can actually answer (or have correctly marked UNKNOWN with
|
|
256
|
+
real justification, or flagged as a business decision) every one of:
|
|
257
|
+
|
|
258
|
+
what the ticket asks for · current vs. expected behaviour · where the current behaviour lives ·
|
|
259
|
+
how that flow actually works · why it behaves that way · confirmed root cause (if a bug) ·
|
|
260
|
+
affected repos/files · the real change surface · dependencies and risks · security considerations ·
|
|
261
|
+
performance/reliability considerations · existing test coverage · edge cases that matter ·
|
|
262
|
+
anything from optional context that changes scope · what's genuinely unknown · what needs a human
|
|
263
|
+
business decision.
|
|
264
|
+
|
|
265
|
+
If something on this list is still open and investigable, keep investigating — don't write the
|
|
266
|
+
report yet. If it's genuinely a product/business call, name the exact question that needs an
|
|
267
|
+
answer; don't invent one.
|
|
268
|
+
|
|
269
|
+
## Evidence labels
|
|
270
|
+
|
|
271
|
+
Tag non-obvious findings so `spec-create` knows how much weight to put on them:
|
|
272
|
+
|
|
273
|
+
- **VERIFIED** — confirmed directly in code, config, DB, tests, git history, the ticket, or official docs.
|
|
274
|
+
- **INFERRED** — well-supported by multiple signals but not directly confirmed; say why.
|
|
275
|
+
- **ASSUMPTION** — can't currently be proven; keep this list short, never hide one inside a
|
|
276
|
+
recommendation as if it were fact.
|
|
277
|
+
- **UNKNOWN** — investigated and still open; say what you searched and why it didn't resolve.
|
|
278
|
+
|
|
279
|
+
## Step 9 — Write the report
|
|
280
|
+
|
|
281
|
+
Write it to `{specs_dir}/{feature-slug}/investigation.md` (`specs_dir` from config, default `specs`) in the repo (create the `specs/` folder if
|
|
282
|
+
needed — this mirrors where `spec-create` already keeps its own output, so the handoff reads
|
|
283
|
+
naturally from the same place; don't commit this folder if the repo's convention already
|
|
284
|
+
gitignores `specs/`, matching whatever this repo already does there). Use the structure in `references/report-template.md`.
|
|
285
|
+
|
|
286
|
+
Every section should be specific and evidence-backed, or explicitly say "None found" /
|
|
287
|
+
"Not applicable to this ticket" rather than being left looking like an oversight.
|
|
288
|
+
|
|
289
|
+
**Recommended Implementation Direction** describes the technically-supported direction the
|
|
290
|
+
evidence points to — reusing existing patterns the investigation actually found, not a novel
|
|
291
|
+
architecture invented on the spot. It is not permission to start building; flag any business
|
|
292
|
+
decision it depends on.
|
|
293
|
+
|
|
294
|
+
## Step 10 — Stop, hand off, don't bleed into the next stage
|
|
295
|
+
|
|
296
|
+
Report completion plainly:
|
|
297
|
+
|
|
298
|
+
```
|
|
299
|
+
Investigation complete.
|
|
300
|
+
|
|
301
|
+
Source: <ticket ID, or file / "pasted text">
|
|
302
|
+
Branch: <branch> (created from <base> @ <sha>)
|
|
303
|
+
Report: specs/<feature-slug>/investigation.md
|
|
304
|
+
|
|
305
|
+
Next step: run spec-create for <feature-slug> — it can read the investigation above directly rather than
|
|
306
|
+
re-discovering the system.
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Do not run `spec-create` yourself unless the user explicitly asks you to chain into it in the same
|
|
310
|
+
turn. Never run `spec-implement` from here under any circumstance — that skips the human
|
|
311
|
+
review/approval step this workflow depends on.
|
|
312
|
+
|
|
313
|
+
## Hard boundaries (do not cross these)
|
|
314
|
+
|
|
315
|
+
- No implementation: no app code, API, schema, migration, UI, config, dependency, infra, or test
|
|
316
|
+
changes. Finding an obvious one-line fix doesn't change this — document it, don't apply it.
|
|
317
|
+
- No code changes get committed or pushed from this skill — the only commit this skill produces,
|
|
318
|
+
if any, is the empty ticket branch itself (creating a branch doesn't require a commit).
|
|
319
|
+
- Never touch the base branch.
|
|
320
|
+
- Never discard, stash, reset, or overwrite existing uncommitted work without being told to.
|
|
321
|
+
- Never force-push, never delete an existing branch without explicit approval.
|
|
322
|
+
- Never fabricate an answer to fill a gap — mark it UNKNOWN or as a business decision instead.
|
|
323
|
+
- Never silently expand scope based on optional context the ticket itself doesn't support.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Investigation Report Template
|
|
2
|
+
|
|
3
|
+
Copy this structure into `specs/{feature-slug}/investigation.md`.
|
|
4
|
+
|
|
5
|
+
```markdown
|
|
6
|
+
# Investigation
|
|
7
|
+
|
|
8
|
+
## Source
|
|
9
|
+
- Source Type: (ticket / transcript / plain text / doc / log / mixed)
|
|
10
|
+
- Ticket ID / Tracker / URL: (or "None")
|
|
11
|
+
- Source Files / Links:
|
|
12
|
+
- Title:
|
|
13
|
+
- Type of Work:
|
|
14
|
+
- Priority:
|
|
15
|
+
- Branch:
|
|
16
|
+
- Base Branch:
|
|
17
|
+
- Base Commit:
|
|
18
|
+
|
|
19
|
+
## Business Context
|
|
20
|
+
## Problem Statement
|
|
21
|
+
## Expected Behaviour
|
|
22
|
+
## Current Behaviour
|
|
23
|
+
## Relevant Repositories
|
|
24
|
+
## Relevant Files / Modules
|
|
25
|
+
## Existing Architecture
|
|
26
|
+
## Current Flow
|
|
27
|
+
## Data Flow
|
|
28
|
+
## Root Cause
|
|
29
|
+
## Evidence
|
|
30
|
+
### Verified
|
|
31
|
+
### Inferred
|
|
32
|
+
### Unknown
|
|
33
|
+
### Assumptions
|
|
34
|
+
## Required Change Surface
|
|
35
|
+
## Supporting Changes
|
|
36
|
+
## Optional Changes
|
|
37
|
+
## Out of Scope
|
|
38
|
+
## Dependencies
|
|
39
|
+
## Risks
|
|
40
|
+
## Security Considerations
|
|
41
|
+
## Performance / Reliability Considerations
|
|
42
|
+
## Testing Context
|
|
43
|
+
## Edge Cases
|
|
44
|
+
## Additional Context
|
|
45
|
+
### Business Decisions
|
|
46
|
+
### Technical Decisions
|
|
47
|
+
### Potential Requirements
|
|
48
|
+
### Proposed Solutions Discussed
|
|
49
|
+
### Open Questions
|
|
50
|
+
### Conflicts / Discrepancies
|
|
51
|
+
## Recommended Implementation Direction
|
|
52
|
+
## References
|
|
53
|
+
```
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-setup
|
|
3
|
+
description: >
|
|
4
|
+
One-time discovery that teaches the spec-driven-dev pipeline how THIS project works, and saves
|
|
5
|
+
the answers to .spec-driven.yml — project layout (single repo, monorepo, or multiple repos),
|
|
6
|
+
issue tracker, base branch, PR target, branch naming, commit style, and the lint/typecheck/test/
|
|
7
|
+
build/dev commands. Use when the user says "set up spec-driven", "configure the pipeline",
|
|
8
|
+
"spec-setup", "change our branch rules", or when any other spec-* skill finds no
|
|
9
|
+
.spec-driven.yml. Detects everything it can from the repos first and only asks about what is
|
|
10
|
+
ambiguous. Writes config only — never changes code, branches, or commits.
|
|
11
|
+
license: MIT
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# spec-setup
|
|
15
|
+
|
|
16
|
+
Learn this project's rules once, save them, and let every other `spec-*` skill reuse them. Team
|
|
17
|
+
rules live in a config file the team can review and change — never in the skills themselves.
|
|
18
|
+
|
|
19
|
+
## Where the config lives
|
|
20
|
+
|
|
21
|
+
`.spec-driven.yml`, found by walking up from the current directory (stop at the home folder). The
|
|
22
|
+
first one found wins.
|
|
23
|
+
|
|
24
|
+
| Layout | Put the file in | Share it? |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| `single` | the repo root | Commit it — the whole team gets the same rules |
|
|
27
|
+
| `monorepo` | the repo root | Commit it |
|
|
28
|
+
| `multi-repo` | the shared parent folder of the repos (usually not itself a git repo) | Personal by default; offer to also commit a copy into the repo the team treats as "home" |
|
|
29
|
+
|
|
30
|
+
A multi-repo config only applies inside the repos it lists. If the current repo sits under that
|
|
31
|
+
folder but isn't listed, treat it as having no config (ask whether to add it).
|
|
32
|
+
|
|
33
|
+
## Step 1 — Detect before asking
|
|
34
|
+
|
|
35
|
+
Read, don't guess. Collect a draft of every field in `references/config-template.yml`:
|
|
36
|
+
|
|
37
|
+
1. **Layout.**
|
|
38
|
+
- Inside a git repo with workspace markers (`pnpm-workspace.yaml`, `workspaces` in
|
|
39
|
+
`package.json`, `turbo.json`, `nx.json`, `lerna.json`, `go.work`, `[workspace]` in
|
|
40
|
+
`Cargo.toml`, several `apps/*`/`packages/*`/`services/*` with their own manifests) →
|
|
41
|
+
`monorepo`; list the packages.
|
|
42
|
+
- Not inside a git repo, but sibling folders are git repos → candidate `multi-repo`. Group them
|
|
43
|
+
by remote owner (`git remote get-url origin`) and show the groups — the user picks which repos
|
|
44
|
+
belong together. Never assume every folder in the parent belongs. Always also ask whether
|
|
45
|
+
repos in **other folders** belong (e.g. `~/clients/billing`). Check each path is a git repo,
|
|
46
|
+
and store paths inside the workspace as relative and paths outside it as absolute.
|
|
47
|
+
- The user can override the detected layout. If they choose `multi-repo` from inside one repo,
|
|
48
|
+
the workspace folder defaults to that repo's parent, with the current repo pre-selected. If
|
|
49
|
+
they choose `monorepo`, ask for the package folders. Never write a `multi-repo` config with
|
|
50
|
+
no repos.
|
|
51
|
+
- Otherwise → `single`.
|
|
52
|
+
2. **Existing written rules.** `CLAUDE.md`, `AGENTS.md`, `CONTRIBUTING.md`, PR templates,
|
|
53
|
+
`.github/workflows`. Anything stated there is a strong default — quote it back to the user.
|
|
54
|
+
3. **Tracker.** Ticket keys in recent branch names and commit subjects (`STP-123`, `#45`,
|
|
55
|
+
`ENG-91`), Jira/Linear links in PR templates or docs, whether GitHub Issues are enabled
|
|
56
|
+
(`gh repo view --json hasIssuesEnabled`).
|
|
57
|
+
4. **Git, per repo.** Default branch (`git symbolic-ref refs/remotes/origin/HEAD` or
|
|
58
|
+
`gh repo view --json defaultBranchRef`); integration branches (`staging`, `develop`,
|
|
59
|
+
`pre-prod`); which branch recent PRs targeted (`gh pr list --state merged --limit 20 --json
|
|
60
|
+
baseRefName`); the pattern of the last ~20 remote branch names; the commit style from
|
|
61
|
+
`git log -30 --format=%s`.
|
|
62
|
+
5. **Commands, per repo/package.** `package.json` scripts plus the lockfile's package manager,
|
|
63
|
+
`Makefile`, `pyproject.toml`/`tox.ini`, `Cargo.toml`, `go.mod`, `composer.json`, CI workflow
|
|
64
|
+
steps (CI is often the most truthful source). Dev URL from the dev script, `.env.example`, or
|
|
65
|
+
framework defaults.
|
|
66
|
+
|
|
67
|
+
## Step 2 — Confirm in one round
|
|
68
|
+
|
|
69
|
+
Show the draft as a short table grouped by layout, tracker, git, commands, and specs location.
|
|
70
|
+
Mark each value **detected** (with where it came from) or **guess**. Then ask only about guesses
|
|
71
|
+
and conflicts — in one message, not a drip of questions. Typical ones:
|
|
72
|
+
|
|
73
|
+
- "Your repos default to `master`, but recent PRs targeted `staging`. Cut work from `staging`?"
|
|
74
|
+
- "Recent branches are bare ticket IDs (`STP-282`). Keep that, or use `fix/STP-282-short-slug`?"
|
|
75
|
+
- "These 6 repos share the `acme` GitHub org. Do they form one workspace for the pipeline?"
|
|
76
|
+
- "Where should specs live — this folder's `specs/`, or inside one repo so they go through PRs?"
|
|
77
|
+
|
|
78
|
+
If the user says "just use the defaults", accept the detected values and the template defaults
|
|
79
|
+
for the rest.
|
|
80
|
+
|
|
81
|
+
## Step 3 — Write and report
|
|
82
|
+
|
|
83
|
+
1. Write `.spec-driven.yml` using `references/config-template.yml` as the shape. Keep its
|
|
84
|
+
comments; drop fields that don't apply (e.g. `repos:` for `single`). Per-repo values only go
|
|
85
|
+
under `repos:` where they differ from the top level.
|
|
86
|
+
2. If it's inside a repo, tell the user it's meant to be committed (so teammates get the same
|
|
87
|
+
rules) — don't commit it yourself.
|
|
88
|
+
3. If `npx` is available, run `npx -y @benjaminthomas/spec-driven-dev doctor` from the config's folder. It checks
|
|
89
|
+
that every branch, folder, and `npm run` script in the file really exists. Fix anything it
|
|
90
|
+
reports before finishing.
|
|
91
|
+
4. Report: the file path, a one-line summary per section, and "re-run spec-setup any time these
|
|
92
|
+
change".
|
|
93
|
+
|
|
94
|
+
## Updating
|
|
95
|
+
|
|
96
|
+
Re-running `spec-setup` with an existing config: load it, re-detect, and show only what changed or
|
|
97
|
+
looks stale (a branch that no longer exists, a script that was renamed). Never silently overwrite
|
|
98
|
+
a value the user set by hand.
|
|
99
|
+
|
|
100
|
+
## Boundaries
|
|
101
|
+
|
|
102
|
+
- Writes `.spec-driven.yml` and nothing else. No branches, commits, pushes, installs, or code.
|
|
103
|
+
- Never put secrets, tokens, or credentials in the config.
|
|
104
|
+
- A value in the config beats a detected value. If the config looks wrong mid-run (a base
|
|
105
|
+
branch that doesn't exist), the other skills stop and point back here rather than overriding it.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# .spec-driven.yml — project rules for the spec-driven-dev skills.
|
|
2
|
+
# Written by spec-setup from what it detected + what you confirmed. Edit freely, or re-run
|
|
3
|
+
# spec-setup to update it. Every spec-* skill reads this before doing anything else.
|
|
4
|
+
version: 1
|
|
5
|
+
|
|
6
|
+
# single — one git repo, one app
|
|
7
|
+
# monorepo — one git repo, several apps/packages (pnpm/npm/yarn workspaces, Turborepo, Nx, Go/Cargo workspaces…)
|
|
8
|
+
# multi-repo — several separate git repos that change together (this file sits in their shared parent folder)
|
|
9
|
+
layout: single
|
|
10
|
+
|
|
11
|
+
# The repos (multi-repo) or packages (monorepo) the pipeline may touch. Omit for `single`.
|
|
12
|
+
# Each entry can override the top-level git/commands settings.
|
|
13
|
+
# repos:
|
|
14
|
+
# - path: api # relative to this file
|
|
15
|
+
# role: REST API + workers # one line: what lives here, so investigations know where to look
|
|
16
|
+
# git:
|
|
17
|
+
# base_branch: staging
|
|
18
|
+
# commands:
|
|
19
|
+
# test: npm test
|
|
20
|
+
# - path: web
|
|
21
|
+
# role: React frontend
|
|
22
|
+
|
|
23
|
+
tracker:
|
|
24
|
+
type: jira # jira | github | linear | none
|
|
25
|
+
key: STP # ticket key prefix (jira/linear); omit for github/none
|
|
26
|
+
url: https://example.atlassian.net # site/org/repo URL, if any
|
|
27
|
+
|
|
28
|
+
git:
|
|
29
|
+
remote: origin
|
|
30
|
+
base_branch: default # branch work is cut from; "default" = the remote's default branch
|
|
31
|
+
pr_target: default # branch PRs go into; usually the same as base_branch
|
|
32
|
+
branch_name: "{type}/{ticket}-{slug}" # placeholders: {ticket} {slug} {type}; e.g. "{ticket}" for bare STP-123
|
|
33
|
+
commit_style: conventional # conventional (feat: …) | ticket (STP-123: …) | freeform
|
|
34
|
+
|
|
35
|
+
# Leave a command empty if the project doesn't have it; skills skip what's empty.
|
|
36
|
+
commands:
|
|
37
|
+
install: ""
|
|
38
|
+
lint: ""
|
|
39
|
+
typecheck: ""
|
|
40
|
+
test: ""
|
|
41
|
+
build: ""
|
|
42
|
+
dev: "" # how spec-verify starts the app
|
|
43
|
+
dev_url: "" # where it answers, e.g. http://localhost:3000
|
|
44
|
+
|
|
45
|
+
specs_dir: specs # where specs/<feature>/ folders go (relative to this file)
|