@anhth2/spec-driven-dev-plugin 0.6.0 → 0.8.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.
- package/bin/index.js +285 -11
- package/commands/debug.md +233 -11
- package/commands/debug.tmpl +170 -6
- package/commands/define-product.md +68 -6
- package/commands/define-product.tmpl +5 -1
- package/commands/fix-bug.md +111 -11
- package/commands/fix-bug.tmpl +48 -6
- package/commands/generate-bdd.md +86 -9
- package/commands/generate-bdd.tmpl +23 -4
- package/commands/generate-code.md +146 -19
- package/commands/generate-code.tmpl +83 -14
- package/commands/generate-design-spec.md +754 -0
- package/commands/generate-design-spec.tmpl +399 -0
- package/commands/generate-prd.md +91 -7
- package/commands/generate-prd.tmpl +28 -2
- package/commands/generate-spec-manifest.md +519 -0
- package/commands/generate-spec-manifest.tmpl +164 -0
- package/commands/generate-tech-docs.md +122 -9
- package/commands/generate-tech-docs.tmpl +59 -4
- package/commands/generate-tests.md +491 -37
- package/commands/generate-tests.tmpl +428 -32
- package/commands/refine-prd.md +76 -8
- package/commands/refine-prd.tmpl +13 -3
- package/commands/review-code.md +94 -6
- package/commands/review-code.tmpl +31 -1
- package/commands/review-context.md +118 -12
- package/commands/review-context.tmpl +55 -7
- package/commands/review-tech-docs.md +76 -9
- package/commands/review-tech-docs.tmpl +13 -4
- package/commands/run-tests.md +196 -18
- package/commands/run-tests.tmpl +133 -13
- package/commands/setup-ai-first.md +192 -6
- package/commands/setup-ai-first.tmpl +136 -5
- package/commands/smoke-test.md +228 -22
- package/commands/smoke-test.tmpl +165 -17
- package/commands/validate-traces.md +77 -8
- package/commands/validate-traces.tmpl +14 -3
- package/core/FRAMEWORK_VERSION +1 -1
- package/core/commands/debug.md +233 -11
- package/core/commands/define-product.md +68 -6
- package/core/commands/fix-bug.md +111 -11
- package/core/commands/generate-bdd.md +86 -9
- package/core/commands/generate-code.md +146 -19
- package/core/commands/generate-design-spec.md +754 -0
- package/core/commands/generate-prd.md +91 -7
- package/core/commands/generate-spec-manifest.md +519 -0
- package/core/commands/generate-tech-docs.md +122 -9
- package/core/commands/generate-tests.md +491 -37
- package/core/commands/refine-prd.md +76 -8
- package/core/commands/review-code.md +94 -6
- package/core/commands/review-context.md +118 -12
- package/core/commands/review-tech-docs.md +76 -9
- package/core/commands/run-tests.md +196 -18
- package/core/commands/setup-ai-first.md +192 -6
- package/core/commands/smoke-test.md +228 -22
- package/core/commands/validate-traces.md +77 -8
- package/core/skills/code/SKILL.md +68 -8
- package/core/skills/debug/SKILL.md +72 -10
- package/core/skills/design-spec/SKILL.md +450 -0
- package/core/skills/discovery/SKILL.md +62 -4
- package/core/skills/prd/SKILL.md +12 -8
- package/core/skills/setup-ai-first/SKILL.md +5 -3
- package/core/skills/spec/SKILL.md +11 -7
- package/core/skills/test/SKILL.md +130 -12
- package/core/steps/context-loader.md +57 -1
- package/core/steps/gate.md +1 -1
- package/core/steps/report-footer.md +5 -3
- package/core/steps/spawn-agent.md +3 -1
- package/core/templates/design-spec.template.md +209 -0
- package/core/templates/project-context.yaml +29 -0
- package/package.json +1 -1
- package/skills/code/SKILL.md +68 -8
- package/skills/debug/SKILL.md +72 -10
- package/skills/design-spec/SKILL.md +450 -0
- package/skills/design-spec/SKILL.tmpl +95 -0
- package/skills/discovery/SKILL.md +62 -4
- package/skills/prd/SKILL.md +12 -8
- package/skills/setup-ai-first/SKILL.md +5 -3
- package/skills/spec/SKILL.md +11 -7
- package/skills/test/SKILL.md +130 -12
- package/steps/context-loader.md +57 -1
- package/steps/gate.md +1 -1
- package/steps/report-footer.md +5 -3
- package/steps/spawn-agent.md +3 -1
- package/templates/design-spec.template.md +209 -0
- package/templates/project-context.yaml +29 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generates a Design Specification document for FE or App platforms from a Business PRD. Trigger when: "/generate-design-spec", "tạo design spec", "generate design spec", "viết design spec", "tạo tài liệu thiết kế UI", "generate UI spec", "cần design spec cho", "tôi muốn spec UI", "tài liệu cho FE", "tài liệu cho app".
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /generate-design-spec — Generate Design Specification (FE / App)
|
|
6
|
+
|
|
7
|
+
This skill generates a platform-specific Design Spec from a Business PRD.
|
|
8
|
+
Design Spec captures screen-level UI requirements, component inventory, platform interactions,
|
|
9
|
+
and design-level AC-UI for PO + Designer sign-off — separate from the business-level PRD.
|
|
10
|
+
|
|
11
|
+
**Supported platforms:** web (react / nextjs / vue / angular), app (flutter / react-native / ios-swiftui / android-compose)
|
|
12
|
+
**Not supported:** backend services — API contracts belong in the Business PRD.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Gate
|
|
17
|
+
|
|
18
|
+
<!-- Directory: specs/prd/**/*.md -->
|
|
19
|
+
# Gate — Universal Entry Procedure
|
|
20
|
+
|
|
21
|
+
Every command must execute this gate before proceeding with its specific logic.
|
|
22
|
+
|
|
23
|
+
## Step 0 — Sub-Agent Mode Check
|
|
24
|
+
|
|
25
|
+
Before anything else, check if `$ARGUMENTS` is a JSON payload from an orchestrator:
|
|
26
|
+
|
|
27
|
+
1. Attempt to parse `$ARGUMENTS` as JSON.
|
|
28
|
+
2. If it parses successfully **and** contains `"_agent_mode": true`:
|
|
29
|
+
- **Skip Steps 1, 2, and 3 of this Gate entirely.**
|
|
30
|
+
- Set target file = `payload.target_file`
|
|
31
|
+
- Set loaded context = `payload.context` (do NOT run context-loader.md)
|
|
32
|
+
- Set UC scope = `payload.uc_id` (process only this UC)
|
|
33
|
+
- Set line range = `payload.uc_section` (read only that PRD section)
|
|
34
|
+
- Proceed directly to the command-specific logic.
|
|
35
|
+
3. If `$ARGUMENTS` is not JSON or `_agent_mode` is absent → continue to Step 1 (normal mode).
|
|
36
|
+
|
|
37
|
+
## Step 0-B — Model Check
|
|
38
|
+
|
|
39
|
+
*Skip this step if `_agent_mode: true` (sub-agent — orchestrator already validated).*
|
|
40
|
+
|
|
41
|
+
Complex generation and review commands require strong reasoning.
|
|
42
|
+
Using a smaller model risks missed edge cases, incomplete spec analysis, and architecture violations.
|
|
43
|
+
|
|
44
|
+
Display and wait for response:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
⚙️ MODEL CHECK
|
|
48
|
+
──────────────────────────────────────────────────────────────────
|
|
49
|
+
Recommended : claude-opus-4 (or latest Opus model)
|
|
50
|
+
Why needed : Spec analysis, architecture review, code generation
|
|
51
|
+
require deep reasoning. Smaller models miss edge cases.
|
|
52
|
+
|
|
53
|
+
To switch in Claude Code:
|
|
54
|
+
• Settings → Model → select "claude-opus"
|
|
55
|
+
• or: /model → choose claude-opus
|
|
56
|
+
|
|
57
|
+
Running on claude-opus?
|
|
58
|
+
Y — yes, on claude-opus → proceed
|
|
59
|
+
S — skip check (I accept lower quality risk with current model)
|
|
60
|
+
──────────────────────────────────────────────────────────────────
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- "Y" → proceed to Step 1.
|
|
64
|
+
- "S" → proceed to Step 1 (user accepts risk, add ⚠️ to final report).
|
|
65
|
+
- "N" or anything else → **STOP.** Output: "Please switch to claude-opus, then re-run this command."
|
|
66
|
+
|
|
67
|
+
## Step 1 — Resolve Target File
|
|
68
|
+
|
|
69
|
+
1. If `$ARGUMENTS` is provided and points to an existing file → use it directly as the target.
|
|
70
|
+
2. If `$ARGUMENTS` is a UC-ID, ticket ID, or partial name → search for matching files in the relevant directory.
|
|
71
|
+
3. If `$ARGUMENTS` is empty or no match found:
|
|
72
|
+
- List files in the relevant directory for this command (e.g., `specs/prd/**/*.md` for PRD commands, `specs/bdd/**/*.feature` for BDD commands).
|
|
73
|
+
- Present the list to the user and ask: "Which file do you want to work with? (Enter number or filename)"
|
|
74
|
+
- Wait for user selection before continuing.
|
|
75
|
+
|
|
76
|
+
## Step 2 — Execute Context Loader
|
|
77
|
+
|
|
78
|
+
Load all project context by following the procedure in `steps/context-loader.md`.
|
|
79
|
+
Store all loaded context in memory for use throughout this command session.
|
|
80
|
+
|
|
81
|
+
## Step 3 — CHECKPOINT
|
|
82
|
+
|
|
83
|
+
After completing Steps 1 and 2, display a summary and wait for confirmation:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
CHECKPOINT
|
|
87
|
+
-----------
|
|
88
|
+
Target : {resolved file path}
|
|
89
|
+
Project : {project.name from project-context.yaml}
|
|
90
|
+
Tech stack : {language} / {framework}
|
|
91
|
+
Module : {module if set, else "not configured"}
|
|
92
|
+
Domains : {comma-separated domain list}
|
|
93
|
+
|
|
94
|
+
Proceed? (Y/N)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Wait for explicit "Y" or "N" from the user before continuing.
|
|
98
|
+
- "Y" → proceed to the command-specific steps below.
|
|
99
|
+
- "N" → stop and ask what the user wants to change.
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Context
|
|
105
|
+
|
|
106
|
+
# Context Loader — Load All Project Context
|
|
107
|
+
|
|
108
|
+
Execute these steps in order. Store everything in memory for the duration of the command session.
|
|
109
|
+
|
|
110
|
+
**Priority guide (anti-lost-in-middle):**
|
|
111
|
+
- Steps 1–2 are PROJECT-CONFIG — loaded first, resolve all paths and metadata.
|
|
112
|
+
- Step 3 is CRITICAL — architecture + coding standards, the highest-priority facts for generation.
|
|
113
|
+
- Step 4 is SAFETY — data protection rules, enforced silently for the entire session.
|
|
114
|
+
- Steps 5–6 are DOMAIN KNOWLEDGE — terminology and entity definitions.
|
|
115
|
+
- Step 7 is the WORKING MEMORY RECAP — locks critical facts into the top of working memory.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Step 1 — [PROJECT-CONFIG] Load project-context.yaml
|
|
120
|
+
|
|
121
|
+
Read `.agent/project-context.yaml`. Extract and store:
|
|
122
|
+
|
|
123
|
+
**Tech Stack:**
|
|
124
|
+
- `tech_stack.language` → active language (e.g., Java 17, TypeScript, C#, Go)
|
|
125
|
+
- `tech_stack.framework` → active framework (e.g., Spring Boot 3.2, Angular 17, .NET 8)
|
|
126
|
+
- `tech_stack.build_tool` → build tool (e.g., Maven, npm, dotnet, go)
|
|
127
|
+
- `tech_stack.test_framework` → test framework (e.g., JUnit 5 + Mockito, Jest, xUnit)
|
|
128
|
+
- `tech_stack.database` → database (e.g., PostgreSQL, MySQL, MongoDB)
|
|
129
|
+
- `tech_stack.module` → active module profile (e.g., java-spring, angular, dotnet, golang, context-engineering)
|
|
130
|
+
|
|
131
|
+
**Conventions:**
|
|
132
|
+
- `conventions.build_command` → how to compile/build
|
|
133
|
+
- `conventions.test_command` → how to run tests
|
|
134
|
+
- `conventions.service_run` → how to start the service
|
|
135
|
+
- `conventions.ticket_prefix` → ticket ID prefix (e.g., PROJ, FEAT, UC)
|
|
136
|
+
|
|
137
|
+
**Domains:**
|
|
138
|
+
- `domains` → list of active business domains
|
|
139
|
+
|
|
140
|
+
**Paths (if present):**
|
|
141
|
+
- `paths.specs_dir` → BDD specs root
|
|
142
|
+
- `paths.prd_dir` → PRD documents root
|
|
143
|
+
- `paths.refinement_dir` → findings/review output dir
|
|
144
|
+
- `paths.product_definitions_dir` → product definitions root
|
|
145
|
+
- `paths.domain_knowledge_dir` → domain knowledge root
|
|
146
|
+
- `paths.business_dictionary` → path to business-dictionary.md
|
|
147
|
+
- `paths.core_entities` → path to core-entities.md
|
|
148
|
+
- `paths.tech_docs_dir` → technical documentation root
|
|
149
|
+
- `paths.trace_dir` → trace state directory
|
|
150
|
+
- `paths.design_spec_dir` → Design Spec documents root (FE/App only)
|
|
151
|
+
|
|
152
|
+
If `paths` section is absent, use these defaults:
|
|
153
|
+
- `specs_dir` = `specs/bdd`
|
|
154
|
+
- `prd_dir` = `specs/prd`
|
|
155
|
+
- `refinement_dir` = `.agent/review`
|
|
156
|
+
- `product_definitions_dir` = `specs/product-definition`
|
|
157
|
+
- `domain_knowledge_dir` = `specs/domain-knowledge`
|
|
158
|
+
- `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
|
|
159
|
+
- `core_entities` = `specs/domain-knowledge/core-entities.md`
|
|
160
|
+
- `tech_docs_dir` = `specs/tech-docs`
|
|
161
|
+
- `trace_dir` = `.trace`
|
|
162
|
+
- `design_spec_dir` = `specs/design-spec`
|
|
163
|
+
|
|
164
|
+
If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
|
|
169
|
+
|
|
170
|
+
*Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
|
|
171
|
+
|
|
172
|
+
If `services` section is present:
|
|
173
|
+
|
|
174
|
+
**1. Detect active domain** (in priority order):
|
|
175
|
+
- Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
|
|
176
|
+
- Extract from target file path: segment immediately after `prd_dir` base path
|
|
177
|
+
*(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
|
|
178
|
+
- If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
|
|
179
|
+
|
|
180
|
+
**2. Route to service** — if active domain matches a key in `services`:
|
|
181
|
+
- Override `paths.specs_dir` → `services.{domain}.specs_dir`
|
|
182
|
+
- Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
|
|
183
|
+
- Store `active_service` = `services.{domain}.path`
|
|
184
|
+
- Store `active_service_module` = `services.{domain}.module`
|
|
185
|
+
- If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
|
|
186
|
+
|
|
187
|
+
**3. Fallback** — if domain not detected or no matching service key:
|
|
188
|
+
- Keep default paths from Step 1
|
|
189
|
+
- Set `active_service = unresolved`
|
|
190
|
+
|
|
191
|
+
**4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
|
|
192
|
+
- Override `paths.prd_dir` → `{spec_source}/specs/prd`
|
|
193
|
+
- Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
|
|
194
|
+
- Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
|
|
195
|
+
- Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
|
|
196
|
+
- Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
|
|
201
|
+
|
|
202
|
+
If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
|
|
203
|
+
Merge framework-specific conventions (layer patterns, test patterns, naming rules) into the loaded context.
|
|
204
|
+
If the file does not exist → skip silently.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Step 3 — [CRITICAL] Load CLAUDE.md
|
|
209
|
+
|
|
210
|
+
*This is the highest-priority context — it defines HOW to write code and documents for this project.*
|
|
211
|
+
|
|
212
|
+
Read `CLAUDE.md`. Extract and store:
|
|
213
|
+
|
|
214
|
+
- **§1 Project Overview** → project name, language, framework, build/test commands, domains
|
|
215
|
+
- **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules
|
|
216
|
+
- **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns
|
|
217
|
+
- **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name
|
|
218
|
+
- **§7 Git Conventions** → branch naming pattern, commit message format
|
|
219
|
+
|
|
220
|
+
If `CLAUDE.md` does not exist → note it as missing and continue with project-context.yaml data only.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Step 4 — [SAFETY] Load Data Protection Rules
|
|
225
|
+
|
|
226
|
+
Read `.agent/rules/data-protection.md` (or `rules/data-protection.md` from the framework installation).
|
|
227
|
+
|
|
228
|
+
Store the sensitive file patterns — you must **never** read, write, display, or reference content from files matching those patterns for the entire session.
|
|
229
|
+
|
|
230
|
+
If neither file exists → apply built-in defaults: never access `.env*`, `*.key`, `*.pem`, `*secret*`, `*password*`, `*credential*`.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Step 5 — [DOMAIN] Load Business Dictionary (conditional)
|
|
235
|
+
|
|
236
|
+
Check if the business dictionary file exists (use `paths.business_dictionary` resolved in Step 1).
|
|
237
|
+
|
|
238
|
+
If it exists, read it and extract:
|
|
239
|
+
- **Canonical Terms** → complete list of approved terms and their definitions
|
|
240
|
+
- **Banned Terms** → complete list of banned terms and their canonical replacements
|
|
241
|
+
- **Status / Enum Registry** → allowed enum values per entity
|
|
242
|
+
|
|
243
|
+
Store the banned terms list for **active enforcement** throughout the command session:
|
|
244
|
+
- When generating any text (PRD, BDD, code comments, tech docs), verify no banned terms appear
|
|
245
|
+
- Replace banned terms with their canonical equivalents automatically
|
|
246
|
+
|
|
247
|
+
If the file does not exist → skip silently. Do not warn or block.
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Step 6 — [DOMAIN] Load Core Entities (conditional)
|
|
252
|
+
|
|
253
|
+
Check if the core entities file exists at `paths.core_entities` (resolved in Step 1).
|
|
254
|
+
Default path: `specs/domain-knowledge/core-entities.md`.
|
|
255
|
+
|
|
256
|
+
If it exists, read it and store:
|
|
257
|
+
- **Entity catalog** → for each entity: its name, purpose, owner service, key fields (name + type), business invariants, and relationships
|
|
258
|
+
- **Field name registry** → canonical field names to use in generated code and documents
|
|
259
|
+
- **Relationship map** → how entities relate to each other (1:N, N:N, embedded, etc.)
|
|
260
|
+
|
|
261
|
+
**How to use this catalog:**
|
|
262
|
+
- When generating code: use the field names, types, and relationships defined here — do NOT infer from existing code
|
|
263
|
+
- When generating PRD/BDD: reference entity names from this catalog for consistency
|
|
264
|
+
- When generating tech-docs: use this catalog as the source-of-truth for entity definitions
|
|
265
|
+
|
|
266
|
+
If the file does not exist → skip silently.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Step 6.5 — [PLATFORM] Derive active_module and platform_type
|
|
271
|
+
|
|
272
|
+
Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
| `platform_type` | Modules |
|
|
279
|
+
|---|---|
|
|
280
|
+
| `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
|
|
281
|
+
| `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
|
|
282
|
+
| `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
|
|
283
|
+
|
|
284
|
+
If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
|
|
285
|
+
|
|
286
|
+
These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
|
|
291
|
+
|
|
292
|
+
After loading all context, synthesize and output a compact summary block.
|
|
293
|
+
This recap ensures the most critical facts are stated at the END of context loading
|
|
294
|
+
(recency effect — freshest in working memory when the task begins).
|
|
295
|
+
|
|
296
|
+
Output exactly this block:
|
|
297
|
+
```
|
|
298
|
+
[CTX LOADED]
|
|
299
|
+
Stack : {language} / {framework} / {database}
|
|
300
|
+
Platform : {active_module} ({platform_type})
|
|
301
|
+
Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
|
|
302
|
+
Ticket : {ticket_prefix}-
|
|
303
|
+
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
304
|
+
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
305
|
+
Service : {active_service} ({active_service_module}) | single-service
|
|
306
|
+
Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
If any CRITICAL file is missing (CLAUDE.md), flag it clearly so the user can decide whether to proceed.
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Context Load Complete
|
|
314
|
+
|
|
315
|
+
After completing all steps, you have loaded:
|
|
316
|
+
- Project identity, tech stack, module conventions
|
|
317
|
+
- Architecture rules and layer order ← **[CRITICAL — hold in working memory]**
|
|
318
|
+
- Coding standards and naming conventions ← **[CRITICAL — hold in working memory]**
|
|
319
|
+
- Data protection rules (sensitive file patterns to never access)
|
|
320
|
+
- Terminology rules with banned-term list ← **[DOMAIN — apply to every generated word]**
|
|
321
|
+
- Entity catalog (field names, types, invariants) ← **[DOMAIN — use for code generation]**
|
|
322
|
+
- All configured paths
|
|
323
|
+
|
|
324
|
+
Proceed to the next step of the calling command.
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
*Read the target PRD. Extract: TICKET-ID, domain, feature name, Service, Module from metadata, User Flow (Section 4a), Wireframe screen names (Section 4b).*
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Platform Check
|
|
332
|
+
|
|
333
|
+
- `platform_type = "backend"` → **STOP**: "Design Spec is only for FE/App. BE API contracts go in the Business PRD."
|
|
334
|
+
- `platform_type = "web-frontend"` → `active_platform = "web"`
|
|
335
|
+
- `platform_type = "mobile"` → `active_platform = "app"` (or `"app-ios"` / `"app-android"` for native)
|
|
336
|
+
- `platform_type = "unknown"` → ask user to select platform
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Figma Check
|
|
341
|
+
|
|
342
|
+
Ask: "Do you have a Figma link? (paste URL or Enter to skip)"
|
|
343
|
+
|
|
344
|
+
Store as `figma_url` or set to `"TBD"` with AI Assumption noted.
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Screen Discovery
|
|
349
|
+
|
|
350
|
+
Extract screen names from PRD Section 4. Present list for PO to confirm/add before generating.
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Generate
|
|
355
|
+
|
|
356
|
+
Write `{paths.design_spec_dir}/{domain}/{TICKET-ID}-design-spec-{active_platform}-{slug}.md`.
|
|
357
|
+
|
|
358
|
+
Structure:
|
|
359
|
+
1. **Metadata** — Spec ID, platform, module, service, Business PRD link, Figma link
|
|
360
|
+
2. **Screen Inventory** — table of all screens with entry points and Figma frame links
|
|
361
|
+
3. **Screen Specs** (per screen):
|
|
362
|
+
- Layout (grid, spacing, design tokens)
|
|
363
|
+
- Component Inventory (Figma → code component, import path, states)
|
|
364
|
+
- Screen States (default / loading / error / empty / success)
|
|
365
|
+
- Actions & Navigation (triggers → results)
|
|
366
|
+
4. **Interaction Patterns** (platform-adaptive):
|
|
367
|
+
- Web: responsive breakpoints table, hover/focus/keyboard table
|
|
368
|
+
- App: gesture table, navigation stack diagram, iOS vs Android conventions table
|
|
369
|
+
5. **Platform Considerations** (platform-adaptive):
|
|
370
|
+
- Web: accessibility checklist (WCAG, keyboard, ARIA)
|
|
371
|
+
- App: safe area, touch targets, deep links, permissions, offline, dark mode
|
|
372
|
+
6. **AC-UI** — design acceptance criteria table (Verified by: Designer / PO / QA)
|
|
373
|
+
7. **Appendix** — Figma summary, design tokens, references, AI assumptions, changelog
|
|
374
|
+
|
|
375
|
+
Component mapping rules:
|
|
376
|
+
- Check `figma-components/{active_module}.md` (loaded in context) for every component
|
|
377
|
+
- ✅ Found → use exact Code Component + Import Path
|
|
378
|
+
- ⚠️ TODO → mark `[TODO — implementation pending]`
|
|
379
|
+
- ❌ Not found → mark `[NEW — confirm with designer]`
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## Output
|
|
384
|
+
|
|
385
|
+
# Report Footer — Standard Command Output Format
|
|
386
|
+
|
|
387
|
+
Every command report must end with this standard footer section.
|
|
388
|
+
|
|
389
|
+
## Status Badge
|
|
390
|
+
|
|
391
|
+
Choose one based on outcome:
|
|
392
|
+
- `✅ Complete` — all steps succeeded, no issues found
|
|
393
|
+
- `❌ Failed` — command could not complete due to a blocking error
|
|
394
|
+
- `⚠️ Warnings` — completed with non-blocking issues that should be reviewed
|
|
395
|
+
|
|
396
|
+
## Output Artifacts
|
|
397
|
+
|
|
398
|
+
List every file created or modified by this command:
|
|
399
|
+
```
|
|
400
|
+
Output Artifacts:
|
|
401
|
+
{created|updated} {file-path} ({brief description})
|
|
402
|
+
{created|updated} {file-path} ({brief description})
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
|
|
406
|
+
|
|
407
|
+
## Next Command Suggestion
|
|
408
|
+
|
|
409
|
+
Suggest the logical next command based on workflow phase:
|
|
410
|
+
|
|
411
|
+
| Current command | Suggest next |
|
|
412
|
+
|-------------------------|-----------------------------------------------|
|
|
413
|
+
| /setup-ai-first | `/define-product` to start your first feature |
|
|
414
|
+
| /define-product | `/generate-prd {product-definition-file}` |
|
|
415
|
+
| /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
|
|
416
|
+
| /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
|
|
417
|
+
| /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
|
|
418
|
+
| /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
|
|
419
|
+
| /generate-bdd | `/review-context {feature-file}` to verify coverage |
|
|
420
|
+
| /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
|
|
421
|
+
| /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
|
|
422
|
+
| /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
|
|
423
|
+
| /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
|
|
424
|
+
| /generate-tests | `/run-tests {UC-ID}` |
|
|
425
|
+
| /run-tests (passing) | `/review-code {UC-ID}` |
|
|
426
|
+
| /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
|
|
427
|
+
| /review-code | `/smoke-test {UC-ID}` or create PR |
|
|
428
|
+
| /smoke-test | Create PR and link to ticket |
|
|
429
|
+
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
430
|
+
| /fix-bug | Create PR and link to ticket |
|
|
431
|
+
| /debug | `/fix-bug {ticket-id}` if fix needed |
|
|
432
|
+
|
|
433
|
+
Format the footer as:
|
|
434
|
+
```
|
|
435
|
+
---
|
|
436
|
+
Status : {badge}
|
|
437
|
+
{Output Artifacts block}
|
|
438
|
+
Next : {suggested command with example arguments}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
```
|
|
443
|
+
/generate-design-spec Complete — {TICKET-ID} [{active_platform}]
|
|
444
|
+
---
|
|
445
|
+
Status : ✅ Complete
|
|
446
|
+
Output Artifacts:
|
|
447
|
+
created specs/design-spec/{domain}/{TICKET-ID}-design-spec-{active_platform}-{slug}.md (v1.0)
|
|
448
|
+
Next : Share with Designer → add Figma links → PO + Designer sign-off
|
|
449
|
+
→ /generate-bdd {prd-file}
|
|
450
|
+
```
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generates a Design Specification document for FE or App platforms from a Business PRD. Trigger when: "/generate-design-spec", "tạo design spec", "generate design spec", "viết design spec", "tạo tài liệu thiết kế UI", "generate UI spec", "cần design spec cho", "tôi muốn spec UI", "tài liệu cho FE", "tài liệu cho app".
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /generate-design-spec — Generate Design Specification (FE / App)
|
|
6
|
+
|
|
7
|
+
This skill generates a platform-specific Design Spec from a Business PRD.
|
|
8
|
+
Design Spec captures screen-level UI requirements, component inventory, platform interactions,
|
|
9
|
+
and design-level AC-UI for PO + Designer sign-off — separate from the business-level PRD.
|
|
10
|
+
|
|
11
|
+
**Supported platforms:** web (react / nextjs / vue / angular), app (flutter / react-native / ios-swiftui / android-compose)
|
|
12
|
+
**Not supported:** backend services — API contracts belong in the Business PRD.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Gate
|
|
17
|
+
|
|
18
|
+
<!-- Directory: specs/prd/**/*.md -->
|
|
19
|
+
{{include:steps/gate.md}}
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Context
|
|
24
|
+
|
|
25
|
+
{{include:steps/context-loader.md}}
|
|
26
|
+
|
|
27
|
+
*Read the target PRD. Extract: TICKET-ID, domain, feature name, Service, Module from metadata, User Flow (Section 4a), Wireframe screen names (Section 4b).*
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Platform Check
|
|
32
|
+
|
|
33
|
+
- `platform_type = "backend"` → **STOP**: "Design Spec is only for FE/App. BE API contracts go in the Business PRD."
|
|
34
|
+
- `platform_type = "web-frontend"` → `active_platform = "web"`
|
|
35
|
+
- `platform_type = "mobile"` → `active_platform = "app"` (or `"app-ios"` / `"app-android"` for native)
|
|
36
|
+
- `platform_type = "unknown"` → ask user to select platform
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Figma Check
|
|
41
|
+
|
|
42
|
+
Ask: "Do you have a Figma link? (paste URL or Enter to skip)"
|
|
43
|
+
|
|
44
|
+
Store as `figma_url` or set to `"TBD"` with AI Assumption noted.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Screen Discovery
|
|
49
|
+
|
|
50
|
+
Extract screen names from PRD Section 4. Present list for PO to confirm/add before generating.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Generate
|
|
55
|
+
|
|
56
|
+
Write `{paths.design_spec_dir}/{domain}/{TICKET-ID}-design-spec-{active_platform}-{slug}.md`.
|
|
57
|
+
|
|
58
|
+
Structure:
|
|
59
|
+
1. **Metadata** — Spec ID, platform, module, service, Business PRD link, Figma link
|
|
60
|
+
2. **Screen Inventory** — table of all screens with entry points and Figma frame links
|
|
61
|
+
3. **Screen Specs** (per screen):
|
|
62
|
+
- Layout (grid, spacing, design tokens)
|
|
63
|
+
- Component Inventory (Figma → code component, import path, states)
|
|
64
|
+
- Screen States (default / loading / error / empty / success)
|
|
65
|
+
- Actions & Navigation (triggers → results)
|
|
66
|
+
4. **Interaction Patterns** (platform-adaptive):
|
|
67
|
+
- Web: responsive breakpoints table, hover/focus/keyboard table
|
|
68
|
+
- App: gesture table, navigation stack diagram, iOS vs Android conventions table
|
|
69
|
+
5. **Platform Considerations** (platform-adaptive):
|
|
70
|
+
- Web: accessibility checklist (WCAG, keyboard, ARIA)
|
|
71
|
+
- App: safe area, touch targets, deep links, permissions, offline, dark mode
|
|
72
|
+
6. **AC-UI** — design acceptance criteria table (Verified by: Designer / PO / QA)
|
|
73
|
+
7. **Appendix** — Figma summary, design tokens, references, AI assumptions, changelog
|
|
74
|
+
|
|
75
|
+
Component mapping rules:
|
|
76
|
+
- Check `figma-components/{active_module}.md` (loaded in context) for every component
|
|
77
|
+
- ✅ Found → use exact Code Component + Import Path
|
|
78
|
+
- ⚠️ TODO → mark `[TODO — implementation pending]`
|
|
79
|
+
- ❌ Not found → mark `[NEW — confirm with designer]`
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Output
|
|
84
|
+
|
|
85
|
+
{{include:steps/report-footer.md}}
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
/generate-design-spec Complete — {TICKET-ID} [{active_platform}]
|
|
89
|
+
---
|
|
90
|
+
Status : ✅ Complete
|
|
91
|
+
Output Artifacts:
|
|
92
|
+
created specs/design-spec/{domain}/{TICKET-ID}-design-spec-{active_platform}-{slug}.md (v1.0)
|
|
93
|
+
Next : Share with Designer → add Figma links → PO + Designer sign-off
|
|
94
|
+
→ /generate-bdd {prd-file}
|
|
95
|
+
```
|
|
@@ -52,6 +52,7 @@ Read `.agent/project-context.yaml`. Extract and store:
|
|
|
52
52
|
- `paths.core_entities` → path to core-entities.md
|
|
53
53
|
- `paths.tech_docs_dir` → technical documentation root
|
|
54
54
|
- `paths.trace_dir` → trace state directory
|
|
55
|
+
- `paths.design_spec_dir` → Design Spec documents root (FE/App only)
|
|
55
56
|
|
|
56
57
|
If `paths` section is absent, use these defaults:
|
|
57
58
|
- `specs_dir` = `specs/bdd`
|
|
@@ -61,13 +62,46 @@ If `paths` section is absent, use these defaults:
|
|
|
61
62
|
- `domain_knowledge_dir` = `specs/domain-knowledge`
|
|
62
63
|
- `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
|
|
63
64
|
- `core_entities` = `specs/domain-knowledge/core-entities.md`
|
|
64
|
-
- `tech_docs_dir` = `tech-docs`
|
|
65
|
+
- `tech_docs_dir` = `specs/tech-docs`
|
|
65
66
|
- `trace_dir` = `.trace`
|
|
67
|
+
- `design_spec_dir` = `specs/design-spec`
|
|
66
68
|
|
|
67
69
|
If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
|
|
68
70
|
|
|
69
71
|
---
|
|
70
72
|
|
|
73
|
+
## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
|
|
74
|
+
|
|
75
|
+
*Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
|
|
76
|
+
|
|
77
|
+
If `services` section is present:
|
|
78
|
+
|
|
79
|
+
**1. Detect active domain** (in priority order):
|
|
80
|
+
- Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
|
|
81
|
+
- Extract from target file path: segment immediately after `prd_dir` base path
|
|
82
|
+
*(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
|
|
83
|
+
- If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
|
|
84
|
+
|
|
85
|
+
**2. Route to service** — if active domain matches a key in `services`:
|
|
86
|
+
- Override `paths.specs_dir` → `services.{domain}.specs_dir`
|
|
87
|
+
- Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
|
|
88
|
+
- Store `active_service` = `services.{domain}.path`
|
|
89
|
+
- Store `active_service_module` = `services.{domain}.module`
|
|
90
|
+
- If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
|
|
91
|
+
|
|
92
|
+
**3. Fallback** — if domain not detected or no matching service key:
|
|
93
|
+
- Keep default paths from Step 1
|
|
94
|
+
- Set `active_service = unresolved`
|
|
95
|
+
|
|
96
|
+
**4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
|
|
97
|
+
- Override `paths.prd_dir` → `{spec_source}/specs/prd`
|
|
98
|
+
- Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
|
|
99
|
+
- Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
|
|
100
|
+
- Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
|
|
101
|
+
- Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
71
105
|
## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
|
|
72
106
|
|
|
73
107
|
If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
|
|
@@ -138,6 +172,26 @@ If the file does not exist → skip silently.
|
|
|
138
172
|
|
|
139
173
|
---
|
|
140
174
|
|
|
175
|
+
## Step 6.5 — [PLATFORM] Derive active_module and platform_type
|
|
176
|
+
|
|
177
|
+
Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
| `platform_type` | Modules |
|
|
184
|
+
|---|---|
|
|
185
|
+
| `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
|
|
186
|
+
| `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
|
|
187
|
+
| `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
|
|
188
|
+
|
|
189
|
+
If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
|
|
190
|
+
|
|
191
|
+
These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
141
195
|
## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
|
|
142
196
|
|
|
143
197
|
After loading all context, synthesize and output a compact summary block.
|
|
@@ -148,10 +202,12 @@ Output exactly this block:
|
|
|
148
202
|
```
|
|
149
203
|
[CTX LOADED]
|
|
150
204
|
Stack : {language} / {framework} / {database}
|
|
205
|
+
Platform : {active_module} ({platform_type})
|
|
151
206
|
Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
|
|
152
207
|
Ticket : {ticket_prefix}-
|
|
153
208
|
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
154
209
|
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
210
|
+
Service : {active_service} ({active_service_module}) | single-service
|
|
155
211
|
Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
156
212
|
```
|
|
157
213
|
|
|
@@ -335,21 +391,23 @@ Suggest the logical next command based on workflow phase:
|
|
|
335
391
|
|
|
336
392
|
| Current command | Suggest next |
|
|
337
393
|
|-------------------------|-----------------------------------------------|
|
|
394
|
+
| /setup-ai-first | `/define-product` to start your first feature |
|
|
338
395
|
| /define-product | `/generate-prd {product-definition-file}` |
|
|
339
396
|
| /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
|
|
340
397
|
| /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
|
|
341
|
-
| /review-context (PRD) | `/generate-
|
|
398
|
+
| /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
|
|
399
|
+
| /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
|
|
342
400
|
| /generate-bdd | `/review-context {feature-file}` to verify coverage |
|
|
343
401
|
| /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
|
|
344
402
|
| /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
|
|
345
403
|
| /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
|
|
346
|
-
| /generate-code | `/generate-tests {UC-ID}`
|
|
404
|
+
| /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
|
|
347
405
|
| /generate-tests | `/run-tests {UC-ID}` |
|
|
348
406
|
| /run-tests (passing) | `/review-code {UC-ID}` |
|
|
349
407
|
| /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
|
|
350
408
|
| /review-code | `/smoke-test {UC-ID}` or create PR |
|
|
351
409
|
| /smoke-test | Create PR and link to ticket |
|
|
352
|
-
| /validate-traces | `/generate-code {UC-ID}
|
|
410
|
+
| /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
|
|
353
411
|
| /fix-bug | Create PR and link to ticket |
|
|
354
412
|
| /debug | `/fix-bug {ticket-id}` if fix needed |
|
|
355
413
|
|