@tudeorangbiasa/sdd-multiagent-opencode 0.2.2 → 0.2.3
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/.opencode/commands/sdd-construct.md +693 -0
- package/.opencode/commands/sdd-quick.md +136 -105
- package/.sdd/templates/model-profile-template.json +4 -2
- package/.sdd/templates/reasoning-profile-template.json +4 -2
- package/GUIDE.md +141 -4
- package/README.md +100 -33
- package/bin/sdd-quick.js +607 -0
- package/package.json +4 -3
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Initialize SDD workflow for a new or existing project — explore stack, grill vision, scaffold config, create CONTEXT.md and ADRs
|
|
3
|
+
agent: sdd-planner
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Initialize the "spine" of an SDD-driven project. This is a one-time setup command that creates the foundational artifacts every AI-assisted project needs.
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
/sdd-construct
|
|
12
|
+
/sdd-construct "e-commerce platform for digital goods"
|
|
13
|
+
/sdd-construct --existing
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Philosophy
|
|
17
|
+
|
|
18
|
+
Inspired by Matt Pocock's `setup-matt-pocock-skills` + `grill-with-docs` workflow. The goal is not to generate boilerplate — it is to **force clarity before code**.
|
|
19
|
+
|
|
20
|
+
Before any implementation artifact exists, the project must have:
|
|
21
|
+
- A detected and verified stack profile
|
|
22
|
+
- A domain glossary (CONTEXT.md) with agreed terminology
|
|
23
|
+
- Architectural Decision Records for load-bearing choices
|
|
24
|
+
- Model routing and reasoning profiles tuned to project complexity
|
|
25
|
+
- Type-specific guardrails (design system for frontend, API contract for backend, etc.)
|
|
26
|
+
|
|
27
|
+
## Phase 1: Stack Detection and Classification
|
|
28
|
+
|
|
29
|
+
### Step 0: Empty Directory Guard
|
|
30
|
+
|
|
31
|
+
Check if the directory contains ANY files:
|
|
32
|
+
- `ls -la` at repo root
|
|
33
|
+
- Check for hidden files: `.gitignore`, `.env`, `.git/`
|
|
34
|
+
|
|
35
|
+
**If ZERO files found (truly empty):**
|
|
36
|
+
1. Report: "This directory is empty. I cannot auto-detect a stack."
|
|
37
|
+
2. Ask user to choose project type explicitly:
|
|
38
|
+
- `frontend` (React, Vue, Svelte, etc.)
|
|
39
|
+
- `backend` (Express, Fastify, Laravel, Django, etc.)
|
|
40
|
+
- `library/sdk` (TypeScript package, utility library)
|
|
41
|
+
- `cli` (command-line tool)
|
|
42
|
+
- `fullstack` (Next.js, Remix, Nuxt)
|
|
43
|
+
3. Ask user to choose initial stack details:
|
|
44
|
+
- Framework, language, package manager, styling (if applicable)
|
|
45
|
+
4. Generate minimal starter files based on chosen type (`package.json`, `tsconfig.json`, etc.)
|
|
46
|
+
5. Proceed to Phase 2 with user-provided stack info
|
|
47
|
+
6. DO NOT spawn sdd-explorer (nothing to explore).
|
|
48
|
+
|
|
49
|
+
### Step 1: Quick Sniff Test (no subagent yet)
|
|
50
|
+
|
|
51
|
+
Read these files directly to determine if exploration is needed:
|
|
52
|
+
1. `package.json` (first 50 lines) — check for framework dependencies and config fields
|
|
53
|
+
2. `ls -la` at root — check for config files and directory structure
|
|
54
|
+
|
|
55
|
+
**Decision Matrix: Spawn explorer or skip?**
|
|
56
|
+
|
|
57
|
+
| Sniff Result | Decision | Reason |
|
|
58
|
+
|-------------|----------|--------|
|
|
59
|
+
| No `package.json` + random files | Spawn explorer | Unclear pattern |
|
|
60
|
+
| `package.json` + `next.config.*` | Skip | Clear: Next.js |
|
|
61
|
+
| `package.json` + `nuxt.config.*` | Skip | Clear: Nuxt |
|
|
62
|
+
| `package.json` + `vite.config.*` + `src/` + no server deps | Skip | Clear: Vite frontend |
|
|
63
|
+
| `package.json` + `laravel/` dir | Skip | Clear: Laravel |
|
|
64
|
+
| `package.json` + `django/` or `manage.py` | Skip | Clear: Django |
|
|
65
|
+
| `package.json` + `express`/`fastify`/`hono` deps | Skip | Clear: backend |
|
|
66
|
+
| `package.json` + `"exports"` field + no server deps | Skip | Clear: library |
|
|
67
|
+
| `package.json` + `"bin"` field + no server | Skip | Clear: CLI |
|
|
68
|
+
| `package.json` + unknown config + 3+ config files | Spawn explorer | Complex or custom |
|
|
69
|
+
| `pnpm-workspace.yaml` or monorepo structure | Spawn explorer | Monorepo needs deep scan |
|
|
70
|
+
| 10+ config files at root | Spawn explorer | Too many signals to classify from sniff |
|
|
71
|
+
|
|
72
|
+
**If decision is SKIP:**
|
|
73
|
+
- Classify project type directly from sniff results.
|
|
74
|
+
- Proceed to Step 3 (Present findings).
|
|
75
|
+
- Do NOT spawn subagent.
|
|
76
|
+
|
|
77
|
+
**If decision is SPAWN:**
|
|
78
|
+
- Proceed to Step 2 (Subagent exploration).
|
|
79
|
+
|
|
80
|
+
### Step 2: Subagent Exploration (only if sniff test is unclear)
|
|
81
|
+
|
|
82
|
+
Spawn `sdd-explorer` subagent with this task:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
Explore this codebase and return a structured stack profile.
|
|
86
|
+
|
|
87
|
+
Write results to `.sdd/stack-profile.json` with this exact structure:
|
|
88
|
+
|
|
89
|
+
{
|
|
90
|
+
"detectedAt": "<ISO timestamp>",
|
|
91
|
+
"projectType": "<frontend|backend|library|cli|fullstack>",
|
|
92
|
+
"packageManager": { "name": "<value>", "lockFile": "<filename or null>" },
|
|
93
|
+
"framework": { "name": "<value>", "version": "<value or null>", "config": "<config filename or null>" },
|
|
94
|
+
"language": { "name": "<value>", "version": "<value or null>", "config": "<config filename or null>" },
|
|
95
|
+
"styling": { "name": "<value or null>", "version": "<value or null>", "config": "<config filename or null>" },
|
|
96
|
+
"testing": { "name": "<value or null>", "config": "<config filename or null>" },
|
|
97
|
+
"sddArtifacts": { "hasSddDir": false, "hasSpecs": false, "hasContextMd": false, "hasAdr": false },
|
|
98
|
+
"designSignals": { "hasDesignMd": false, "hasStorybook": false, "componentDirs": [] },
|
|
99
|
+
"rawFiles": {
|
|
100
|
+
"package.json": "<truncated to 200 lines>",
|
|
101
|
+
"tsconfig.json": "<full content if < 200 lines, else truncated>",
|
|
102
|
+
"<other small config files>": "<full content>"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
Rules for rawFiles:
|
|
107
|
+
- Config files < 200 lines: include FULL content
|
|
108
|
+
- Config files >= 200 lines: truncate to first 200 lines, append "... (truncated)"
|
|
109
|
+
- Source files: do NOT include, only list paths
|
|
110
|
+
- Include at minimum: package.json, tsconfig.json (or equivalent), and up to 3 other config files
|
|
111
|
+
|
|
112
|
+
After writing the file, summarize findings in a table for the user.
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Timeout and Error Handling (Three-Layer Fallback):**
|
|
116
|
+
|
|
117
|
+
- **Layer 1**: Spawn `sdd-explorer` with 60-second timeout.
|
|
118
|
+
- **Layer 2**: If Layer 1 times out or errors → `sdd-planner` reads files directly:
|
|
119
|
+
- Read `package.json`, `tsconfig.json`, and up to 3 config files found in sniff test.
|
|
120
|
+
- Do manual classification based on what's readable.
|
|
121
|
+
- Report: "Explorer timed out. I did a quick scan instead. Results may be incomplete."
|
|
122
|
+
- Write `.sdd/stack-profile.json` with whatever was found (use `null` for unknown fields).
|
|
123
|
+
- **Layer 3**: If Layer 2 also fails (unreadable files, no package.json, etc.):
|
|
124
|
+
- Report: "I could not read this project automatically."
|
|
125
|
+
- Ask user to provide: project type, framework, language, package manager.
|
|
126
|
+
- Write `.sdd/stack-profile.json` with user-provided info.
|
|
127
|
+
- Proceed to Phase 2 with caveat.
|
|
128
|
+
|
|
129
|
+
### Step 3: Present Findings
|
|
130
|
+
|
|
131
|
+
Summarize what is present, what is missing, and the classified type:
|
|
132
|
+
|
|
133
|
+
```markdown
|
|
134
|
+
## Stack Detection Results
|
|
135
|
+
|
|
136
|
+
| Signal | Found | Value |
|
|
137
|
+
|--------|-------|-------|
|
|
138
|
+
| Package manager | ✅ | pnpm |
|
|
139
|
+
| Framework | ✅ | Next.js 15 (App Router) |
|
|
140
|
+
| Language | ✅ | TypeScript 5.7 |
|
|
141
|
+
| Styling | ✅ | Tailwind CSS v4 |
|
|
142
|
+
| Testing | ❌ | none detected |
|
|
143
|
+
| Existing SDD | ❌ | no .sdd/ or specs/ |
|
|
144
|
+
| Design docs | ❌ | no DESIGN.md or PRODUCT.md |
|
|
145
|
+
|
|
146
|
+
**Classified as: fullstack**
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
If exploration was done via subagent, also note: "Full stack profile saved to `.sdd/stack-profile.json`".
|
|
150
|
+
If fallback was used, note: "Stack profile is incomplete — explorer fell back to direct scan."
|
|
151
|
+
|
|
152
|
+
## Phase 2: Grilling Session
|
|
153
|
+
|
|
154
|
+
After presenting findings, walk the user through decisions **one at a time**. Do not dump all questions at once. Wait for each answer before proceeding.
|
|
155
|
+
|
|
156
|
+
Assume the user does not know SDD terminology. Each section starts with a short explainer.
|
|
157
|
+
|
|
158
|
+
### Section A — Project Vision (ALL types)
|
|
159
|
+
|
|
160
|
+
> Explainer: This defines what you're building at a high level. It becomes the north star for all future `/sdd-propose` calls.
|
|
161
|
+
|
|
162
|
+
Ask:
|
|
163
|
+
1. **What are you building?** (one sentence description)
|
|
164
|
+
2. **Who is the target user?** (developer, consumer, enterprise, etc.)
|
|
165
|
+
3. **What is the single most important feature?** (the thing that must work)
|
|
166
|
+
|
|
167
|
+
### Section B — Constraints & Preferences (ALL types)
|
|
168
|
+
|
|
169
|
+
> Explainer: These are the guardrails that prevent AI from making wrong choices. If you don't set them now, the AI will guess — and it will guess wrong.
|
|
170
|
+
|
|
171
|
+
Ask:
|
|
172
|
+
1. **Any libraries or frameworks you refuse to use?** (e.g., "no Redux", "no jQuery")
|
|
173
|
+
2. **Any libraries you insist on?** (e.g., "must use Zod", "must use TanStack Query")
|
|
174
|
+
3. **Team size:** solo, small team (2-5), or large team (5+)? This affects how strict the workflow should be.
|
|
175
|
+
|
|
176
|
+
### Section C — Model Budget (ALL types)
|
|
177
|
+
|
|
178
|
+
> Explainer: SDD routes different agents to different models. Paid models get planning and orchestration roles. Free models get implementation and exploration roles. This section configures that routing.
|
|
179
|
+
|
|
180
|
+
Present the default model profile (from `.sdd/templates/model-profile-template.json`) and ask:
|
|
181
|
+
1. **Do you have a paid model subscription?** (OpenAI Plus, OpenCode Go, OpenCode Zen, or direct API keys)
|
|
182
|
+
2. **If yes, which provider?** This determines which agents get routed to paid models.
|
|
183
|
+
3. **If no, accept the free-model defaults.** Implementation will still work but planning may be slower.
|
|
184
|
+
|
|
185
|
+
### Section D — Issue Tracker (ALL types)
|
|
186
|
+
|
|
187
|
+
> Explainer: SDD can track work through GitHub Issues, GitLab Issues, or local markdown files. This determines where `/sdd-propose` publishes its artifacts.
|
|
188
|
+
|
|
189
|
+
Options:
|
|
190
|
+
- **GitHub** — uses `gh` CLI (default if `git remote` points to GitHub)
|
|
191
|
+
- **GitLab** — uses `glab` CLI
|
|
192
|
+
- **Local markdown** — files under `.scratch/` (good for solo projects)
|
|
193
|
+
- **Other** — ask user to describe workflow in one paragraph
|
|
194
|
+
|
|
195
|
+
### Section E — Domain Glossary (CONTEXT.md) (ALL types)
|
|
196
|
+
|
|
197
|
+
> Explainer: CONTEXT.md is a glossary of domain terms. It contains NO implementation details — only agreed-upon terminology. Skills like `/sdd-propose` and `/sdd-ship` read this to ensure consistent language. If a term isn't in CONTEXT.md, the AI might invent its own variant.
|
|
198
|
+
|
|
199
|
+
Ask:
|
|
200
|
+
1. **What are the key domain terms in your project?** (e.g., for e-commerce: "Product", "Cart", "Checkout", "Order", "Customer")
|
|
201
|
+
2. **Any terms that are commonly confused?** (e.g., "User vs Customer — User is authenticated, Customer is the buyer")
|
|
202
|
+
|
|
203
|
+
### Section F — Type-Specific Guardrails (conditional)
|
|
204
|
+
|
|
205
|
+
**Only for `frontend` and `fullstack` projects:**
|
|
206
|
+
|
|
207
|
+
#### Section F-UI — Design System Lock
|
|
208
|
+
|
|
209
|
+
> Explainer: Without a locked design system, every feature will invent its own colors, spacing, and shadows. This causes visual drift. We must lock core tokens NOW before any feature is proposed.
|
|
210
|
+
|
|
211
|
+
Ask:
|
|
212
|
+
1. **Design system:** Material You 3, shadcn/ui, Tailwind default, Custom, or Existing?
|
|
213
|
+
2. **Primary color:** Hex value (e.g., `#6750A4` for Material You)
|
|
214
|
+
3. **Typography:** Font family + scale (e.g., "Inter, 14/16/20/24/32")
|
|
215
|
+
4. **Spacing base:** Pixel value (e.g., `8px`)
|
|
216
|
+
5. **Dark mode:** Yes or No?
|
|
217
|
+
|
|
218
|
+
If user says **"Custom"** → MUST define at minimum: primary, secondary, surface, font, spacing. No skip allowed.
|
|
219
|
+
If user says **"Existing"** → read tokens from existing files and copy to DESIGN.md.
|
|
220
|
+
If user says **"Skip for now"** → create DESIGN.md empty but flag: all future `/sdd-propose` UI changes will WARN that tokens are not locked.
|
|
221
|
+
|
|
222
|
+
**Only for `backend` projects:**
|
|
223
|
+
|
|
224
|
+
#### Section F-API — API Contract
|
|
225
|
+
|
|
226
|
+
> Explainer: API contracts define how your backend communicates with clients. Without these, every feature will invent its own response format and error structure.
|
|
227
|
+
|
|
228
|
+
Ask:
|
|
229
|
+
1. **Auth method:** JWT, Session/Cookie, API Key, OAuth2, None?
|
|
230
|
+
2. **Response format:** `{data, meta}`, `{result}`, plain array, other?
|
|
231
|
+
3. **Pagination style:** cursor-based, offset-based, none?
|
|
232
|
+
4. **Error format:** RFC 7807 (Problem Details), `{error: {code, message}}`, other?
|
|
233
|
+
5. **Rate limiting:** Yes/No? If yes, what limits?
|
|
234
|
+
|
|
235
|
+
**Only for `library/sdk` projects:**
|
|
236
|
+
|
|
237
|
+
#### Section F-LIB — Public API
|
|
238
|
+
|
|
239
|
+
> Explainer: A library's public API is its contract with consumers. Breaking changes cost users real money. We must define the export policy now.
|
|
240
|
+
|
|
241
|
+
Ask:
|
|
242
|
+
1. **Export style:** ESM only, CJS only, dual (ESM + CJS)?
|
|
243
|
+
2. **Versioning policy:** Semver strict, semver with pre-release, other?
|
|
244
|
+
3. **Breaking change tolerance:** "Never break without major version", "Accept minor breaking for beta", other?
|
|
245
|
+
4. **Type exports:** Always export types, types only in `@types/`, other?
|
|
246
|
+
|
|
247
|
+
**Only for `cli` projects:**
|
|
248
|
+
|
|
249
|
+
#### Section F-CLI — Command Structure
|
|
250
|
+
|
|
251
|
+
> Explainer: CLI tools need consistent flag conventions, output formats, and exit codes. Without these, each command feels like it was written by a different author.
|
|
252
|
+
|
|
253
|
+
Ask:
|
|
254
|
+
1. **Flag convention:** `--kebab-case`, `-camelCase`, POSIX short flags (`-v`)?
|
|
255
|
+
2. **Output format:** JSON (`--json` flag), human-readable default, both?
|
|
256
|
+
3. **Exit codes:** Standard (0=success, 1=error), custom codes?
|
|
257
|
+
4. **Help format:** `--help`, `man` page, interactive?
|
|
258
|
+
|
|
259
|
+
## Phase 3: Scaffold Artifacts
|
|
260
|
+
|
|
261
|
+
After all grilling questions are answered, generate the following files:
|
|
262
|
+
|
|
263
|
+
### 3.1 `.sdd/project-profile.json`
|
|
264
|
+
|
|
265
|
+
Populate the template with detected stack info and user answers:
|
|
266
|
+
- `stack.*` — from `.sdd/stack-profile.json` (written by Phase 1 explorer or sniff test)
|
|
267
|
+
- `commands.*` — from package.json scripts or equivalent
|
|
268
|
+
- `design.*` — from styling signals and design doc presence
|
|
269
|
+
- `projectState` — `"new"` or `"existing"` based on whether source code exists
|
|
270
|
+
- `projectType` — classified type from Phase 1
|
|
271
|
+
|
|
272
|
+
### 3.1b `.sdd/stack-profile.json` (if not already written by explorer)
|
|
273
|
+
|
|
274
|
+
If Phase 1 used the sniff test (no subagent spawned), write the stack profile now with the same structure the explorer would have written:
|
|
275
|
+
|
|
276
|
+
```json
|
|
277
|
+
{
|
|
278
|
+
"detectedAt": "<ISO timestamp>",
|
|
279
|
+
"projectType": "<value>",
|
|
280
|
+
"packageManager": { "name": "<value>", "lockFile": "<value or null>" },
|
|
281
|
+
"framework": { "name": "<value>", "version": "<value or null>", "config": "<value or null>" },
|
|
282
|
+
"language": { "name": "<value>", "version": "<value or null>", "config": "<value or null>" },
|
|
283
|
+
"styling": { "name": "<value or null>", "version": "<value or null>", "config": "<value or null>" },
|
|
284
|
+
"testing": { "name": "<value or null>", "config": "<value or null>" },
|
|
285
|
+
"sddArtifacts": { "hasSddDir": false, "hasSpecs": false, "hasContextMd": false, "hasAdr": false },
|
|
286
|
+
"designSignals": { "hasDesignMd": false, "hasStorybook": false, "componentDirs": [] },
|
|
287
|
+
"rawFiles": {
|
|
288
|
+
"package.json": "<truncated to 200 lines>",
|
|
289
|
+
"tsconfig.json": "<full content if < 200 lines>"
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
This ensures `.sdd/stack-profile.json` always exists after `/sdd-construct`, regardless of whether a subagent was used.
|
|
295
|
+
|
|
296
|
+
### 3.2 `.sdd/model-profile.json`
|
|
297
|
+
|
|
298
|
+
Populate the template with model routing based on Phase 2 Section C:
|
|
299
|
+
- If user has paid subscription → route orchestrator and planner to paid model
|
|
300
|
+
- If user has no paid subscription → use free model defaults
|
|
301
|
+
- Keep explorer, implementer, verifier, reviewer on free models
|
|
302
|
+
|
|
303
|
+
### 3.3 `.sdd/reasoning-profile.json`
|
|
304
|
+
|
|
305
|
+
Copy the template. No changes needed — defaults are appropriate for all project sizes.
|
|
306
|
+
|
|
307
|
+
### 3.4 `CONTEXT.md` (at repo root)
|
|
308
|
+
|
|
309
|
+
Create the domain glossary. Format:
|
|
310
|
+
|
|
311
|
+
```markdown
|
|
312
|
+
# Context: <project name>
|
|
313
|
+
|
|
314
|
+
## Domain Terms
|
|
315
|
+
|
|
316
|
+
| Term | Definition | Non-Example |
|
|
317
|
+
|------|------------|-------------|
|
|
318
|
+
| Product | A sellable item in the catalog | Not a Service — Services have no inventory |
|
|
319
|
+
| Cart | A temporary collection of Products selected by a Customer | Not an Order — Orders are placed after checkout |
|
|
320
|
+
| Customer | A user who has placed at least one Order | Not a User — Users may browse without buying |
|
|
321
|
+
|
|
322
|
+
## Out of Scope Terms
|
|
323
|
+
|
|
324
|
+
Terms that are intentionally NOT part of this project:
|
|
325
|
+
|
|
326
|
+
| Term | Why Excluded |
|
|
327
|
+
|------|-------------|
|
|
328
|
+
| Warehouse | Handled by external 3PL system |
|
|
329
|
+
| Invoice | Generated by Stripe, not stored locally |
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Rules for CONTEXT.md:**
|
|
333
|
+
- Totally devoid of implementation details
|
|
334
|
+
- No file paths, no code snippets, no framework names
|
|
335
|
+
- Only domain concepts and their relationships
|
|
336
|
+
- If no terms were resolved during grilling, create the file with empty tables and a note: "Terms will be added during /sdd-propose sessions"
|
|
337
|
+
|
|
338
|
+
### 3.5 `docs/adr/0001-project-initialization.md`
|
|
339
|
+
|
|
340
|
+
Create the first ADR documenting the initialization decisions:
|
|
341
|
+
|
|
342
|
+
```markdown
|
|
343
|
+
# ADR-0001: Project Initialization
|
|
344
|
+
|
|
345
|
+
**Date:** YYYY-MM-DD
|
|
346
|
+
**Status:** Accepted
|
|
347
|
+
|
|
348
|
+
## Context
|
|
349
|
+
|
|
350
|
+
Initial SDD construct session for <project name>.
|
|
351
|
+
Project type: <frontend|backend|library|cli|fullstack>
|
|
352
|
+
|
|
353
|
+
## Decisions
|
|
354
|
+
|
|
355
|
+
| Decision | Rationale |
|
|
356
|
+
|----------|-----------|
|
|
357
|
+
| Stack: <framework> + <language> | <user's reason or "default choice"> |
|
|
358
|
+
| Styling: <approach> | <user's preference> |
|
|
359
|
+
| Issue tracker: <tracker> | <reason> |
|
|
360
|
+
| Model routing: <paid/free> | <subscription status> |
|
|
361
|
+
| <Type-specific guardrail> | <user's answer> |
|
|
362
|
+
|
|
363
|
+
## Consequences
|
|
364
|
+
|
|
365
|
+
- SDD workflow is initialized and ready for /sdd-propose
|
|
366
|
+
- CONTEXT.md contains initial domain glossary
|
|
367
|
+
- Model profile routes agents based on subscription status
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### 3.6 Type-Specific Artifacts (conditional)
|
|
371
|
+
|
|
372
|
+
**For `frontend` projects:**
|
|
373
|
+
|
|
374
|
+
Create `DESIGN.md` with locked tokens from Section F-UI:
|
|
375
|
+
|
|
376
|
+
```markdown
|
|
377
|
+
# Design System: <project name>
|
|
378
|
+
|
|
379
|
+
## 🔒 Locked Tokens (READ-ONLY for /sdd-propose)
|
|
380
|
+
|
|
381
|
+
Core tokens that CANNOT be changed by feature proposals.
|
|
382
|
+
Only /sdd-construct or explicit design change request can modify these.
|
|
383
|
+
|
|
384
|
+
| Token | Value | Source |
|
|
385
|
+
|-------|-------|--------|
|
|
386
|
+
| color-primary | <value> | <source> |
|
|
387
|
+
| color-surface-light | <value> | <source> |
|
|
388
|
+
| color-surface-dark | <value> | <source> |
|
|
389
|
+
| font-family | <value> | <source> |
|
|
390
|
+
| font-scale | <value> | <source> |
|
|
391
|
+
| spacing-base | <value> | <source> |
|
|
392
|
+
| border-radius | <value> | <source> |
|
|
393
|
+
| shadow-elevation-1 | <value> | <source> |
|
|
394
|
+
|
|
395
|
+
## 📦 Component Catalog (APPEND-ONLY for /sdd-propose)
|
|
396
|
+
|
|
397
|
+
New components can be ADDED. Existing components CANNOT be modified
|
|
398
|
+
without explicit user approval.
|
|
399
|
+
|
|
400
|
+
| Component | Tokens Used | Added In | Status |
|
|
401
|
+
|-----------|-------------|----------|--------|
|
|
402
|
+
| (none yet) | — | — | — |
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Also create or update `AGENTS.md` with design rules:
|
|
406
|
+
|
|
407
|
+
```markdown
|
|
408
|
+
## Design Rules
|
|
409
|
+
|
|
410
|
+
- All UI components must follow the design system defined in DESIGN.md
|
|
411
|
+
- No inline styles — use Tailwind utility classes or CSS modules
|
|
412
|
+
- No hardcoded colors — use design tokens from DESIGN.md
|
|
413
|
+
- Responsive breakpoints: mobile-first (sm: 640px, md: 768px, lg: 1024px)
|
|
414
|
+
- Accessibility: all interactive elements must have aria-labels
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
**For `fullstack` projects:**
|
|
418
|
+
|
|
419
|
+
Create both `DESIGN.md` (as above) AND `API_CONTRACT.md`:
|
|
420
|
+
|
|
421
|
+
```markdown
|
|
422
|
+
# API Contract: <project name>
|
|
423
|
+
|
|
424
|
+
## Authentication
|
|
425
|
+
|
|
426
|
+
Method: <JWT|Session|API Key|OAuth2>
|
|
427
|
+
Token location: Header (Authorization: Bearer <token>)
|
|
428
|
+
|
|
429
|
+
## Response Format
|
|
430
|
+
|
|
431
|
+
```json
|
|
432
|
+
{
|
|
433
|
+
"data": "<result>",
|
|
434
|
+
"meta": { "page": 1, "total": 100 }
|
|
435
|
+
}
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
## Error Format
|
|
439
|
+
|
|
440
|
+
Format: <RFC 7807|custom>
|
|
441
|
+
```json
|
|
442
|
+
{
|
|
443
|
+
"error": {
|
|
444
|
+
"code": "VALIDATION_ERROR",
|
|
445
|
+
"message": "Email is required",
|
|
446
|
+
"details": {}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
## Pagination
|
|
452
|
+
|
|
453
|
+
Style: <cursor|offset|none>
|
|
454
|
+
|
|
455
|
+
## Rate Limiting
|
|
456
|
+
|
|
457
|
+
Enabled: <yes|no>
|
|
458
|
+
Limits: <if yes, what limits>
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
**For `backend` projects:**
|
|
462
|
+
|
|
463
|
+
Create `API_CONTRACT.md` (as above) AND `SECURITY_RULES.md`:
|
|
464
|
+
|
|
465
|
+
```markdown
|
|
466
|
+
# Security Rules: <project name>
|
|
467
|
+
|
|
468
|
+
## Input Validation
|
|
469
|
+
|
|
470
|
+
- All input must be validated with Zod (or equivalent)
|
|
471
|
+
- No raw user input passed to database queries
|
|
472
|
+
- SQL injection prevention: use parameterized queries
|
|
473
|
+
|
|
474
|
+
## Authentication
|
|
475
|
+
|
|
476
|
+
- <method from Section F-API>
|
|
477
|
+
- Token expiration: <value>
|
|
478
|
+
- Refresh token policy: <value>
|
|
479
|
+
|
|
480
|
+
## Rate Limiting
|
|
481
|
+
|
|
482
|
+
- <limits from Section F-API>
|
|
483
|
+
- Per-user or per-IP: <value>
|
|
484
|
+
|
|
485
|
+
## CORS
|
|
486
|
+
|
|
487
|
+
- Allowed origins: <value>
|
|
488
|
+
- Allowed methods: GET, POST, PUT, DELETE
|
|
489
|
+
- Credentials: <true|false>
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
**For `library/sdk` projects:**
|
|
493
|
+
|
|
494
|
+
Create `PUBLIC_API.md` AND `VERSIONING.md`:
|
|
495
|
+
|
|
496
|
+
```markdown
|
|
497
|
+
# Public API: <project name>
|
|
498
|
+
|
|
499
|
+
## Exports
|
|
500
|
+
|
|
501
|
+
Export style: <ESM|CJS|dual>
|
|
502
|
+
|
|
503
|
+
## Exported Modules
|
|
504
|
+
|
|
505
|
+
| Module | Purpose | Stability |
|
|
506
|
+
|--------|---------|-----------|
|
|
507
|
+
| (none yet) | — | — |
|
|
508
|
+
|
|
509
|
+
## Type Exports
|
|
510
|
+
|
|
511
|
+
Policy: <always export types|separate @types package>
|
|
512
|
+
|
|
513
|
+
## Deprecation Policy
|
|
514
|
+
|
|
515
|
+
- Deprecated exports must be marked with `@deprecated` JSDoc
|
|
516
|
+
- Minimum 1 minor version notice before removal
|
|
517
|
+
- Migration guide required for breaking changes
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
```markdown
|
|
521
|
+
# Versioning: <project name>
|
|
522
|
+
|
|
523
|
+
## Policy
|
|
524
|
+
|
|
525
|
+
Versioning: <semver strict|semver with pre-release|other>
|
|
526
|
+
|
|
527
|
+
## Breaking Change Rules
|
|
528
|
+
|
|
529
|
+
- MAJOR: Breaking changes to public API
|
|
530
|
+
- MINOR: New features, backward-compatible
|
|
531
|
+
- PATCH: Bug fixes, backward-compatible
|
|
532
|
+
|
|
533
|
+
## Changelog Format
|
|
534
|
+
|
|
535
|
+
- Use Keep a Changelog format
|
|
536
|
+
- Categories: Added, Changed, Deprecated, Removed, Fixed, Security
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
**For `cli` projects:**
|
|
540
|
+
|
|
541
|
+
Create `COMMAND_STRUCTURE.md`:
|
|
542
|
+
|
|
543
|
+
```markdown
|
|
544
|
+
# Command Structure: <project name>
|
|
545
|
+
|
|
546
|
+
## Flag Convention
|
|
547
|
+
|
|
548
|
+
Style: <kebab-case|camelCase|POSIX>
|
|
549
|
+
|
|
550
|
+
## Output Format
|
|
551
|
+
|
|
552
|
+
Default: <human-readable|JSON>
|
|
553
|
+
JSON flag: `--json` → machine-readable output
|
|
554
|
+
|
|
555
|
+
## Exit Codes
|
|
556
|
+
|
|
557
|
+
- 0: Success
|
|
558
|
+
- 1: General error
|
|
559
|
+
- 2: Misuse of CLI (invalid flags)
|
|
560
|
+
- Custom codes: <if any>
|
|
561
|
+
|
|
562
|
+
## Help
|
|
563
|
+
|
|
564
|
+
Format: `--help` flag
|
|
565
|
+
Additional: <man page|interactive|none>
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
### 3.7 Agent Skills Block
|
|
569
|
+
|
|
570
|
+
Add or update the `## Agent skills` block in `AGENTS.md` (or `CLAUDE.md` if it exists):
|
|
571
|
+
|
|
572
|
+
```markdown
|
|
573
|
+
## Agent skills
|
|
574
|
+
|
|
575
|
+
### Issue tracker
|
|
576
|
+
|
|
577
|
+
<one-line summary>. See `docs/agents/issue-tracker.md`.
|
|
578
|
+
|
|
579
|
+
### Domain docs
|
|
580
|
+
|
|
581
|
+
Single-context: CONTEXT.md at repo root, ADRs in docs/adr/.
|
|
582
|
+
|
|
583
|
+
### SDD Commands
|
|
584
|
+
|
|
585
|
+
| Command | Purpose |
|
|
586
|
+
|---------|---------|
|
|
587
|
+
| `/sdd-explore` | Codebase investigation |
|
|
588
|
+
| `/sdd-propose` | Create spec, design, and tasks for a feature |
|
|
589
|
+
| `/sdd-apply` | Implement tasks from a spec |
|
|
590
|
+
| `/sdd-ship` | Final verification before merge |
|
|
591
|
+
| `/sdd-quick` | Lightweight cosmetic/config change |
|
|
592
|
+
| `/sdd-construct` | Initialize SDD workflow (this command) |
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
### 3.8 `docs/agents/issue-tracker.md`
|
|
596
|
+
|
|
597
|
+
Create based on user's choice in Phase 2 Section D:
|
|
598
|
+
|
|
599
|
+
For GitHub:
|
|
600
|
+
```markdown
|
|
601
|
+
# Issue Tracker: GitHub
|
|
602
|
+
|
|
603
|
+
Issues are tracked via GitHub Issues using the `gh` CLI.
|
|
604
|
+
|
|
605
|
+
## Workflow
|
|
606
|
+
- `/sdd-propose` creates specs in `specs/active/<change-id>/`
|
|
607
|
+
- Features can be published as GitHub Issues with `ready-for-agent` label
|
|
608
|
+
- Triage labels: needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
For local markdown:
|
|
612
|
+
```markdown
|
|
613
|
+
# Issue Tracker: Local Markdown
|
|
614
|
+
|
|
615
|
+
Issues are stored as files under `.scratch/<feature>/` in this repo.
|
|
616
|
+
|
|
617
|
+
## Workflow
|
|
618
|
+
- `/sdd-propose` creates specs in `specs/active/<change-id>/`
|
|
619
|
+
- Feature requests can be written as `.scratch/<feature>/request.md`
|
|
620
|
+
- No labels — status is tracked via file presence
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
## Phase 4: Verification
|
|
624
|
+
|
|
625
|
+
Before reporting completion, verify:
|
|
626
|
+
|
|
627
|
+
### Universal checks (ALL project types):
|
|
628
|
+
- [ ] `.sdd/stack-profile.json` exists (written by explorer or by planner after sniff test)
|
|
629
|
+
- [ ] `.sdd/project-profile.json` exists and has non-null values for detected stack
|
|
630
|
+
- [ ] `.sdd/model-profile.json` exists and has agent routing configured
|
|
631
|
+
- [ ] `.sdd/reasoning-profile.json` exists
|
|
632
|
+
- [ ] `CONTEXT.md` exists at repo root (even if empty tables)
|
|
633
|
+
- [ ] `docs/adr/0001-project-initialization.md` exists
|
|
634
|
+
- [ ] `AGENTS.md` or `CLAUDE.md` has `## Agent skills` block
|
|
635
|
+
- [ ] `docs/agents/issue-tracker.md` exists
|
|
636
|
+
|
|
637
|
+
### Type-specific checks:
|
|
638
|
+
- [ ] If `frontend`: `DESIGN.md` exists with locked tokens from Section F-UI
|
|
639
|
+
- [ ] If `fullstack`: `DESIGN.md` AND `API_CONTRACT.md` exist
|
|
640
|
+
- [ ] If `backend`: `API_CONTRACT.md` AND `SECURITY_RULES.md` exist
|
|
641
|
+
- [ ] If `library`: `PUBLIC_API.md` AND `VERSIONING.md` exist
|
|
642
|
+
- [ ] If `cli`: `COMMAND_STRUCTURE.md` exists
|
|
643
|
+
|
|
644
|
+
If any item is missing, report it as a warning but do not fail — the user can create it manually later.
|
|
645
|
+
|
|
646
|
+
## Anti-Generic Gate
|
|
647
|
+
|
|
648
|
+
Before final output, verify:
|
|
649
|
+
|
|
650
|
+
- [ ] Stack detection was based on actual file signals, not assumptions
|
|
651
|
+
- [ ] Empty directory was handled explicitly (asked user, did not guess)
|
|
652
|
+
- [ ] Quick sniff test was performed before deciding to spawn subagent
|
|
653
|
+
- [ ] Subagent was spawned ONLY when sniff test was unclear (not for clear patterns like Next.js)
|
|
654
|
+
- [ ] If subagent was spawned, `.sdd/stack-profile.json` contains raw file content (not just summary)
|
|
655
|
+
- [ ] If subagent failed, fallback was used and reported to user (no silent failure)
|
|
656
|
+
- [ ] Project type was classified correctly (not forced into frontend)
|
|
657
|
+
- [ ] Grilling questions were asked one at a time (not dumped all at once)
|
|
658
|
+
- [ ] CONTEXT.md contains domain terms from the grilling session, not generic placeholders
|
|
659
|
+
- [ ] ADR documents actual decisions made during the session
|
|
660
|
+
- [ ] Model routing reflects user's subscription status, not defaults
|
|
661
|
+
- [ ] No file paths or code snippets in CONTEXT.md
|
|
662
|
+
- [ ] Type-specific guardrails match classified project type
|
|
663
|
+
- [ ] No DESIGN.md generated for non-UI projects (backend, library, cli)
|
|
664
|
+
- [ ] No API_CONTRACT.md generated for frontend-only projects
|
|
665
|
+
|
|
666
|
+
If any item fails, report the failure and explain what is missing.
|
|
667
|
+
|
|
668
|
+
## Output
|
|
669
|
+
|
|
670
|
+
End with:
|
|
671
|
+
|
|
672
|
+
```markdown
|
|
673
|
+
changed: SDD project initialized
|
|
674
|
+
|
|
675
|
+
Artifacts created:
|
|
676
|
+
- `.sdd/stack-profile.json` — raw stack detection results (from explorer or sniff test)
|
|
677
|
+
- `.sdd/project-profile.json` — stack detection results
|
|
678
|
+
- `.sdd/model-profile.json` — model routing configuration
|
|
679
|
+
- `.sdd/reasoning-profile.json` — reasoning effort per agent
|
|
680
|
+
- `CONTEXT.md` — domain glossary
|
|
681
|
+
- `docs/adr/0001-project-initialization.md` — initialization decisions
|
|
682
|
+
- `docs/agents/issue-tracker.md` — issue tracker configuration
|
|
683
|
+
- `AGENTS.md` — agent skills block (created or updated)
|
|
684
|
+
- <type-specific artifacts>
|
|
685
|
+
|
|
686
|
+
Project type: <frontend|backend|library|cli|fullstack>
|
|
687
|
+
Stack: <framework> + <language> + <styling or "N/A">
|
|
688
|
+
Issue tracker: <GitHub|GitLab|Local|Other>
|
|
689
|
+
Model routing: <paid model name|free defaults>
|
|
690
|
+
Exploration: <subagent|sniff-test|user-provided>
|
|
691
|
+
|
|
692
|
+
Next: run `/sdd-propose "<your first feature>"` to start building.
|
|
693
|
+
```
|