sddx-workflow 0.6.0

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 (37) hide show
  1. package/README.md +134 -0
  2. package/dist/cli.js +311 -0
  3. package/package.json +46 -0
  4. package/templates/CLAUDE.md +35 -0
  5. package/templates/claude-commands/ask.md +5 -0
  6. package/templates/claude-commands/assume.md +7 -0
  7. package/templates/claude-commands/bootstrap.md +5 -0
  8. package/templates/claude-commands/bugfix.md +6 -0
  9. package/templates/claude-commands/finish.md +5 -0
  10. package/templates/claude-commands/refactor.md +6 -0
  11. package/templates/claude-commands/review.md +5 -0
  12. package/templates/claude-commands/spec-new.md +4 -0
  13. package/templates/claude-commands/spec-plan.md +4 -0
  14. package/templates/claude-commands/spec-tasks.md +5 -0
  15. package/templates/conventions/base.md +32 -0
  16. package/templates/copilot-instructions.md +33 -0
  17. package/templates/copilot-prompts/ask.prompt.md +10 -0
  18. package/templates/copilot-prompts/assume.prompt.md +12 -0
  19. package/templates/copilot-prompts/bootstrap.prompt.md +11 -0
  20. package/templates/copilot-prompts/bugfix.prompt.md +12 -0
  21. package/templates/copilot-prompts/finish.prompt.md +10 -0
  22. package/templates/copilot-prompts/refactor.prompt.md +10 -0
  23. package/templates/copilot-prompts/review.prompt.md +10 -0
  24. package/templates/copilot-prompts/spec-new.prompt.md +9 -0
  25. package/templates/copilot-prompts/spec-plan.prompt.md +9 -0
  26. package/templates/copilot-prompts/spec-tasks.prompt.md +10 -0
  27. package/templates/cursor-rules/sddx-workflow.mdc +27 -0
  28. package/templates/domains/auth.md +31 -0
  29. package/templates/domains/email.md +30 -0
  30. package/templates/domains/payments.md +32 -0
  31. package/templates/domains/storage.md +30 -0
  32. package/templates/project-overview.md +31 -0
  33. package/templates/specs/_template/1-requirements.md +81 -0
  34. package/templates/specs/_template/2-plan.md +128 -0
  35. package/templates/specs/_template/3-tasks.md +53 -0
  36. package/templates/windsurf-rules/sddx-workflow.md +26 -0
  37. package/templates/workflow.md +285 -0
@@ -0,0 +1,285 @@
1
+ # SDD Protocol — Workflow
2
+
3
+ This file defines how AI agents interact with this codebase.
4
+ Read it before starting any task.
5
+
6
+ ---
7
+
8
+ ## Execution Principles
9
+
10
+ These rules apply to every command. They are not suggestions.
11
+
12
+ 1. **Surface assumptions** — before writing code, state what you're assuming. If something is unclear, stop and ask. Do not pick an interpretation silently. If a simpler approach exists, say so — push back when warranted.
13
+ 2. **Minimum code** — implement only what was asked. No extra abstractions, no "while I'm here" cleanups, no speculative flexibility, no error handling for impossible scenarios. Ask: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
14
+ 3. **Surgical changes** — touch only the lines the task requires. Do not reformat, rename, or refactor adjacent code. Match existing style, even if you'd do it differently. Remove imports, variables, and functions that *your* changes made unused — do not remove pre-existing dead code unless asked. Test: every changed line should trace directly to the user's request.
15
+ 4. **Verify before moving on** — define what "done" looks like before you start. Transform vague tasks into verifiable goals: "Fix the bug" → "Write a test that reproduces it, then make it pass." Strong success criteria let you loop independently without constant clarification. A task isn't done until its verification passes.
16
+
17
+ ---
18
+
19
+ ## Commands
20
+
21
+ ### /bootstrap
22
+ **Purpose:** Populate `.sdd/project-overview.md` and `.sdd/conventions.md` with real project context. Run once at project start, or when joining an existing codebase.
23
+
24
+ Two modes:
25
+
26
+ **New project — interview mode:**
27
+ Ask the following questions one at a time, waiting for a full answer before continuing:
28
+
29
+ 1. What problem does this app solve? Who is it for?
30
+ 2. What is the tech stack? (framework, database, auth, hosting, key libraries)
31
+ 3. What are the explicit non-goals — what will this app intentionally NOT do?
32
+ 4. Are there architecture decisions already made? (patterns, constraints, things that cannot change)
33
+ 5. What are the main business domains? (e.g. auth, payments, orders, notifications)
34
+ 6. What does "production ready" mean here? (performance targets, compliance, security requirements)
35
+
36
+ **Existing project — scan mode (`/bootstrap --scan`):**
37
+ Before asking anything, read the codebase:
38
+ - Project structure, `package.json` / dependency manifests, environment files
39
+ - Schema definitions, migration files, route declarations
40
+ - Main entry points and key components
41
+
42
+ Infer what you can from the code. Ask only about what the code cannot answer:
43
+ - Business intent behind models or patterns ("I see `Order` and `Product` — is this B2C or B2B?")
44
+ - Whether patterns are deliberate or shortcuts ("Is X intentional or a workaround?")
45
+ - Non-goals that aren't visible in code
46
+ - What "done" means for this team
47
+
48
+ ⛔ **STOP. Present the full draft of `project-overview.md` and `conventions.md` for review before writing anything. Do not save files until both are explicitly approved.**
49
+
50
+ After approval:
51
+ - Write `.sdd/project-overview.md`
52
+ - Update `.sdd/conventions.md` with confirmed stack and patterns
53
+ - Update `CLAUDE.md` to reference `.sdd/project-overview.md`
54
+
55
+ ---
56
+
57
+ ### /ask
58
+ **Purpose:** Research and exploration. No code changes.
59
+
60
+ Use when: understanding a system, gathering context, analyzing options, investigating a bug.
61
+
62
+ Rules:
63
+ - Read files, search, analyze — never modify
64
+ - If the question has multiple valid interpretations, surface all of them; do not pick one silently
65
+ - If something is ambiguous or surprising, name it explicitly
66
+ - End with a clear summary and explicit options or recommendations
67
+ - Do NOT proceed to implementation without explicit instruction
68
+
69
+ ---
70
+
71
+ ### /assume
72
+ **Purpose:** Surface all assumptions before acting on a task.
73
+
74
+ Use when: before running /spec-plan, before a complex diagnosis in /bugfix, or any time you realize you're making an unstated guess about requirements, codebase state, or technical decisions.
75
+
76
+ Process:
77
+ 1. List every assumption, numbered, in plain language
78
+ 2. For each one: what you're assuming, why, and what would change if it's wrong
79
+ 3. ⛔ **STOP — do not proceed until every assumption is confirmed or corrected**
80
+ 4. After confirmation: update the relevant spec or plan to reflect any corrections
81
+
82
+ Format:
83
+ ```
84
+ Assumptions for <task>:
85
+
86
+ 1. **<assumption>** — because <reason>.
87
+ If wrong: <what changes>.
88
+
89
+ 2. **<assumption>** — because <reason>.
90
+ If wrong: <what changes>.
91
+ ```
92
+
93
+ Rules:
94
+ - No assumption is too obvious — name it anyway
95
+ - "I don't know X" is a valid assumption; it means the answer must be found before proceeding
96
+ - One wrong assumption can invalidate an entire plan — surface them cheap, not mid-execution
97
+
98
+ ---
99
+
100
+ ### /bugfix
101
+ **Purpose:** Lightweight flow for confirmed bugs.
102
+
103
+ Stages (in order, no skipping):
104
+ 1. **Reproduce** — confirm the bug with a test or minimal repro case
105
+ 2. **Diagnose** — identify root cause, not just symptoms; state any assumptions about the cause
106
+ 3. **Fix** — minimal targeted change; do not refactor surrounding code
107
+ 4. **Validate** — run tests, confirm the fix doesn't regress anything
108
+
109
+ Stop points:
110
+ - After Reproduce: if unable to reproduce, STOP and report
111
+ - After Diagnose: if fix scope exceeds ~1 file or ~50 lines, escalate to /spec-new
112
+
113
+ ---
114
+
115
+ ### /refactor
116
+ **Purpose:** Restructure code without changing external behavior.
117
+
118
+ The invariant: every observable behavior before the refactor must be identical after it.
119
+
120
+ Process:
121
+ 1. Run existing tests — establish a green baseline; if any fail, fix them first as a separate /bugfix
122
+ 2. Run /assume — list structural assumptions: file dependencies, public interfaces, callers
123
+ 3. Define scope: which files change, which stay untouched
124
+ 4. Implement in small steps; run tests after each step — they must stay green throughout
125
+ 5. Run /finish when done
126
+
127
+ Rules:
128
+ - No new features, no bug fixes mixed in — if you find a bug, note it; don't fix it now
129
+ - No new tests for new behavior — only tests that verify unchanged behavior
130
+ - If tests go red mid-refactor, revert the last step immediately; do not continue on a red baseline
131
+ - If scope expands beyond the original definition, STOP and escalate to /spec-new
132
+
133
+ ⛔ If the refactor reveals a structural problem that requires new behavior to fix properly, stop and escalate to /spec-new.
134
+
135
+ ---
136
+
137
+ ### /spec-new
138
+ **Purpose:** Scaffold a spec folder for a feature or significant change.
139
+
140
+ Process:
141
+ 1. Create `specs/<name>/` directory
142
+ 2. Copy `specs/_template/1-requirements.md` → `specs/<name>/1-requirements.md`
143
+ 3. Copy `specs/_template/2-plan.md` → `specs/<name>/2-plan.md`
144
+ 4. Copy `specs/_template/3-tasks.md` → `specs/<name>/3-tasks.md`
145
+ 5. Replace `<Feature Name>` in each file title with the actual feature name
146
+
147
+ Then: fill out `1-requirements.md` before running /spec-plan
148
+
149
+ ---
150
+
151
+ ### /spec-plan
152
+ **Purpose:** Generate a technical plan from an approved requirements doc.
153
+
154
+ Input: completed `specs/<name>/1-requirements.md`
155
+
156
+ Process:
157
+ 1. Read requirements and acceptance criteria
158
+ 2. Run /assume — list every assumption about requirements, codebase state, and technical decisions; STOP and wait for confirmation before continuing
159
+ 3. Consider the simplest approach that satisfies the requirements; if you reject it, explain why
160
+ 4. Analyze codebase impact
161
+ 5. Define abort criteria: conditions under which tasks must stop and return to planning
162
+ 6. Draft technical plan in `specs/<name>/2-plan.md`
163
+
164
+ ⛔ **STOP HERE. Do not write any code until the plan is explicitly approved.**
165
+
166
+ The plan must include:
167
+ - Goals coverage — which goal IDs (G1, G2…) from requirements this plan addresses, and which are out of scope
168
+ - Explicit assumptions — confirmed via /assume before drafting
169
+ - The simplest viable approach and why it was chosen or rejected
170
+ - Tradeoffs — conscious sacrifices the chosen approach makes (write "none" if there are none)
171
+ - Components affected (files, modules, services)
172
+ - New artifacts (files, types, schemas, migrations)
173
+ - What the plan explicitly does NOT do (mirrors non-goals)
174
+ - External dependencies, if any
175
+ - Risks and open questions — unresolved items block approval
176
+ - Abort criteria — conditions that trigger a stop and return to planning
177
+ - Verification criteria for each task (define "done" before executing)
178
+ - Estimated task count
179
+
180
+ ---
181
+
182
+ ### /spec-tasks
183
+ **Purpose:** Execute an approved plan as atomic tasks.
184
+
185
+ Input: approved `specs/<name>/2-plan.md`
186
+
187
+ Rules:
188
+ - One task at a time — complete it fully before moving to the next
189
+ - **Before writing implementation code for each task: write the test that defines "done" first.** It must fail (red) before any implementation exists
190
+ - Implement until that test passes (green), then run the full test suite to catch regressions
191
+ - Do NOT batch tasks or run ahead
192
+ - Each task touches only what it requires — no cleanup of adjacent code, no style fixes, no refactors of nearby functions
193
+ - If you notice something broken or worth improving nearby, note it in the spec — do not fix it now
194
+ - If a task reveals new scope, STOP and update the plan before continuing
195
+
196
+ Generates / updates: `specs/<name>/3-tasks.md` checklist
197
+
198
+ ---
199
+
200
+ ### /review
201
+ **Purpose:** Final audit before closing a spec or merging.
202
+
203
+ Checks:
204
+ - All tasks in `3-tasks.md` are marked complete
205
+ - Every goal (G1, G2…) in `1-requirements.md` is satisfied by the implementation
206
+ - Every scenario in `1-requirements.md` has a test that covers it and passes
207
+ - Tests pass (full suite, not just the new ones)
208
+ - No leftover debug code or TODO comments
209
+ - Conventions in `.sdd/conventions.md` are followed
210
+ - No out-of-scope changes were introduced
211
+ - No speculative features, unused abstractions, or "just in case" code
212
+ - Every changed line traces directly to the user's request — if not, explain why
213
+ - The implementation is the simplest one that satisfies the requirements — if it's more complex, justify it
214
+
215
+ ---
216
+
217
+ ### /finish
218
+ **Purpose:** Stage changed files and produce a conventional commit message for approval.
219
+
220
+ Process:
221
+ 1. Run `git status` — identify changed, added, and deleted files
222
+ 2. Run `git diff` (staged and unstaged) — read the actual changes in detail
223
+ 3. Exclude files that must not be committed: `.env*`, build artifacts, scratch files, editor state
224
+ 4. Stage all relevant files with `git add`
225
+ 5. Determine the commit type from the changes:
226
+ - `feat` — new feature or user-visible capability
227
+ - `fix` — bug fix
228
+ - `refactor` — restructuring without behavior change
229
+ - `docs` — documentation only
230
+ - `test` — adding or updating tests
231
+ - `chore` — build, tooling, dependencies, config
232
+ - `style` — formatting, no logic change
233
+ - `perf` — performance improvement
234
+ 6. Draft commit message following the format below
235
+
236
+ ⛔ **STOP. Present the staged file list and the proposed commit message. Do not commit until explicitly approved.**
237
+
238
+ Commit format:
239
+ ```
240
+ <type>(<scope>): <short summary, imperative mood, max 72 chars>
241
+
242
+ <One sentence that frames the overall change — what it adds or fixes
243
+ at a high level, and why it matters.>
244
+
245
+ - <Specific change — what was added/modified and the reasoning or
246
+ tradeoff behind the decision.>
247
+ - <Specific change — include method names, file paths, component names
248
+ when they clarify what was touched.>
249
+ - <Specific change — explain exclusions and edge cases explicitly:
250
+ "X is intentionally excluded because Y".>
251
+
252
+ <Footer — notable technical context that isn't obvious from the diff:
253
+ migration notes, performance tradeoffs, deliberate design decisions,
254
+ known limitations. Not required if there's nothing non-obvious.>
255
+ ```
256
+
257
+ Rules for the message:
258
+ - Summary line: imperative mood (`add`, `fix`, `remove`, `update`), lowercase, no trailing period
259
+ - Scope: the domain or module most affected (`auth`, `cli`, `payments`, `spec`)
260
+ - Overview sentence: one sentence only — frames the "what and why" at the highest level
261
+ - Bullets: one per logical unit of change; name real identifiers (functions, files, endpoints); explain the *why* behind each decision, not just the *what*
262
+ - Explicit exclusions belong in the bullets: "X is intentionally excluded because Y"
263
+ - Footer: non-obvious context only — migration decisions, deliberate tradeoffs, known caveats
264
+ - If changes are unrelated, propose splitting into multiple commits
265
+
266
+ ---
267
+
268
+ ## Ceremony Levels
269
+
270
+ | Change size | Required flow |
271
+ |---|---|
272
+ | Typo / comment | Direct — no ceremony |
273
+ | Bug (< ~50 lines, 1 file) | /bugfix → /finish |
274
+ | Refactor (no behavior change) | /refactor → /finish |
275
+ | Feature | /spec-new → /spec-plan → /spec-tasks → /review → /finish |
276
+ | Architecture change | /spec-new → /spec-plan (mandatory human review) → /spec-tasks → /review → /finish |
277
+
278
+ ## Stop Points (Non-Negotiable)
279
+
280
+ 1. **Unclear requirements** — stop, ask via /ask, do not assume
281
+ 2. **Unvalidated assumptions** — run /assume before /spec-plan; if a confirmed assumption turns out false mid-execution, stop and re-plan
282
+ 3. **After /spec-plan** — never proceed to tasks without explicit approval
283
+ 4. **Abort criterion triggered** — when any condition in the plan's Abort Criteria is met, stop immediately and return to /spec-plan
284
+ 5. **Scope creep detected** — stop, report, get a decision before continuing
285
+ 6. **Test failure during /spec-tasks** — stop, fix the failure before the next task