@anhth2/spec-driven-dev-plugin 0.5.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 (152) hide show
  1. package/ARCHITECTURE.md +243 -0
  2. package/bin/build.js +230 -0
  3. package/bin/index.js +311 -0
  4. package/commands/debug.md +374 -0
  5. package/commands/debug.tmpl +77 -0
  6. package/commands/define-product.md +451 -0
  7. package/commands/define-product.tmpl +154 -0
  8. package/commands/fix-bug.md +379 -0
  9. package/commands/fix-bug.tmpl +82 -0
  10. package/commands/generate-bdd.md +591 -0
  11. package/commands/generate-bdd.tmpl +294 -0
  12. package/commands/generate-code.md +395 -0
  13. package/commands/generate-code.tmpl +98 -0
  14. package/commands/generate-prd.md +488 -0
  15. package/commands/generate-prd.tmpl +191 -0
  16. package/commands/generate-tech-docs.md +362 -0
  17. package/commands/generate-tech-docs.tmpl +65 -0
  18. package/commands/generate-tests.md +377 -0
  19. package/commands/generate-tests.tmpl +80 -0
  20. package/commands/refine-prd.md +408 -0
  21. package/commands/refine-prd.tmpl +111 -0
  22. package/commands/review-code.md +354 -0
  23. package/commands/review-code.tmpl +57 -0
  24. package/commands/review-context.md +646 -0
  25. package/commands/review-context.tmpl +349 -0
  26. package/commands/review-tech-docs.md +518 -0
  27. package/commands/review-tech-docs.tmpl +221 -0
  28. package/commands/run-tests.md +343 -0
  29. package/commands/run-tests.tmpl +46 -0
  30. package/commands/setup-ai-first.md +278 -0
  31. package/commands/setup-ai-first.tmpl +197 -0
  32. package/commands/smoke-test.md +366 -0
  33. package/commands/smoke-test.tmpl +69 -0
  34. package/commands/validate-traces.md +529 -0
  35. package/commands/validate-traces.tmpl +232 -0
  36. package/core/FRAMEWORK_VERSION +1 -0
  37. package/core/commands/debug.md +374 -0
  38. package/core/commands/define-product.md +451 -0
  39. package/core/commands/fix-bug.md +379 -0
  40. package/core/commands/generate-bdd.md +591 -0
  41. package/core/commands/generate-code.md +395 -0
  42. package/core/commands/generate-prd.md +488 -0
  43. package/core/commands/generate-tech-docs.md +362 -0
  44. package/core/commands/generate-tests.md +377 -0
  45. package/core/commands/refine-prd.md +408 -0
  46. package/core/commands/review-code.md +354 -0
  47. package/core/commands/review-context.md +646 -0
  48. package/core/commands/review-tech-docs.md +518 -0
  49. package/core/commands/run-tests.md +343 -0
  50. package/core/commands/setup-ai-first.md +278 -0
  51. package/core/commands/smoke-test.md +366 -0
  52. package/core/commands/validate-traces.md +529 -0
  53. package/core/hooks/data-guard.js +141 -0
  54. package/core/hooks/settings.json +18 -0
  55. package/core/modules/angular/architecture-snippets/component-patterns.md +187 -0
  56. package/core/modules/angular/module.yaml +6 -0
  57. package/core/modules/angular/stack-profile.yaml +38 -0
  58. package/core/modules/context-engineering/architecture-snippets/context-design.md +119 -0
  59. package/core/modules/context-engineering/module.yaml +9 -0
  60. package/core/modules/context-engineering/stack-profile.yaml +61 -0
  61. package/core/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
  62. package/core/modules/dotnet/module.yaml +6 -0
  63. package/core/modules/dotnet/stack-profile.yaml +50 -0
  64. package/core/modules/golang/architecture-snippets/domain-layout.md +283 -0
  65. package/core/modules/golang/module.yaml +6 -0
  66. package/core/modules/golang/stack-profile.yaml +40 -0
  67. package/core/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
  68. package/core/modules/java-spring/module.yaml +15 -0
  69. package/core/modules/java-spring/stack-profile.yaml +28 -0
  70. package/core/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
  71. package/core/modules/nextjs/module.yaml +14 -0
  72. package/core/modules/nextjs/stack-profile.yaml +74 -0
  73. package/core/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
  74. package/core/modules/php-laravel/module.yaml +15 -0
  75. package/core/modules/php-laravel/stack-profile.yaml +56 -0
  76. package/core/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
  77. package/core/modules/react/module.yaml +14 -0
  78. package/core/modules/react/stack-profile.yaml +63 -0
  79. package/core/rules/data-protection.md +80 -0
  80. package/core/rules/workflow.md +44 -0
  81. package/core/skills/code/SKILL.md +526 -0
  82. package/core/skills/debug/SKILL.md +584 -0
  83. package/core/skills/discovery/SKILL.md +363 -0
  84. package/core/skills/prd/SKILL.md +456 -0
  85. package/core/skills/setup-ai-first/SKILL.md +160 -0
  86. package/core/skills/spec/SKILL.md +361 -0
  87. package/core/skills/test/SKILL.md +862 -0
  88. package/core/steps/context-loader.md +163 -0
  89. package/core/steps/gate.md +81 -0
  90. package/core/steps/report-footer.md +53 -0
  91. package/core/steps/spawn-agent.md +123 -0
  92. package/core/templates/architecture.template.md +113 -0
  93. package/core/templates/feature.template +259 -0
  94. package/core/templates/platform-guide.template.md +145 -0
  95. package/core/templates/prd.template.md +312 -0
  96. package/core/templates/product-definition.template.md +168 -0
  97. package/core/templates/project-context.yaml +78 -0
  98. package/hooks/data-guard.js +141 -0
  99. package/hooks/settings.json +18 -0
  100. package/modules/angular/architecture-snippets/component-patterns.md +187 -0
  101. package/modules/angular/module.yaml +6 -0
  102. package/modules/angular/stack-profile.yaml +38 -0
  103. package/modules/context-engineering/architecture-snippets/context-design.md +119 -0
  104. package/modules/context-engineering/module.yaml +9 -0
  105. package/modules/context-engineering/stack-profile.yaml +61 -0
  106. package/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
  107. package/modules/dotnet/module.yaml +6 -0
  108. package/modules/dotnet/stack-profile.yaml +50 -0
  109. package/modules/golang/architecture-snippets/domain-layout.md +283 -0
  110. package/modules/golang/module.yaml +6 -0
  111. package/modules/golang/stack-profile.yaml +40 -0
  112. package/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
  113. package/modules/java-spring/module.yaml +15 -0
  114. package/modules/java-spring/stack-profile.yaml +28 -0
  115. package/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
  116. package/modules/nextjs/module.yaml +14 -0
  117. package/modules/nextjs/stack-profile.yaml +74 -0
  118. package/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
  119. package/modules/php-laravel/module.yaml +15 -0
  120. package/modules/php-laravel/stack-profile.yaml +56 -0
  121. package/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
  122. package/modules/react/module.yaml +14 -0
  123. package/modules/react/stack-profile.yaml +63 -0
  124. package/package.json +42 -0
  125. package/rules/data-protection.md +80 -0
  126. package/rules/workflow.md +44 -0
  127. package/scripts/init.sh +49 -0
  128. package/scripts/upgrade.sh +94 -0
  129. package/skills/code/SKILL.md +526 -0
  130. package/skills/code/SKILL.tmpl +176 -0
  131. package/skills/debug/SKILL.md +584 -0
  132. package/skills/debug/SKILL.tmpl +262 -0
  133. package/skills/discovery/SKILL.md +363 -0
  134. package/skills/discovery/SKILL.tmpl +147 -0
  135. package/skills/prd/SKILL.md +456 -0
  136. package/skills/prd/SKILL.tmpl +188 -0
  137. package/skills/setup-ai-first/SKILL.md +160 -0
  138. package/skills/setup-ai-first/SKILL.tmpl +107 -0
  139. package/skills/spec/SKILL.md +361 -0
  140. package/skills/spec/SKILL.tmpl +174 -0
  141. package/skills/test/SKILL.md +862 -0
  142. package/skills/test/SKILL.tmpl +296 -0
  143. package/steps/context-loader.md +163 -0
  144. package/steps/gate.md +81 -0
  145. package/steps/report-footer.md +53 -0
  146. package/steps/spawn-agent.md +123 -0
  147. package/templates/architecture.template.md +113 -0
  148. package/templates/feature.template +259 -0
  149. package/templates/platform-guide.template.md +145 -0
  150. package/templates/prd.template.md +312 -0
  151. package/templates/product-definition.template.md +168 -0
  152. package/templates/project-context.yaml +78 -0
@@ -0,0 +1,188 @@
1
+ ---
2
+ description: Generates a PRD from a product definition, or analyzes an existing PRD through 4 review lenses (QA, DEV, SA, PO) to find gaps and risks. Trigger when: "/generate-prd", "/refine-prd", "tạo PRD", "generate PRD", "phân tích PRD", "review PRD", "refine PRD", "PRD có vấn đề gì không", "check PRD quality".
3
+ ---
4
+
5
+ # PRD Skills — Generate & Refine
6
+
7
+ This skill handles two commands: `/generate-prd` to create a PRD, and `/refine-prd` to analyze it for gaps.
8
+
9
+ ---
10
+
11
+ ## /generate-prd — Generate Product Requirements Document
12
+
13
+ ### Gate
14
+
15
+ <!-- Directory: specs/product-definition/**/*.md -->
16
+ {{include:steps/gate.md}}
17
+
18
+ ### Generate
19
+
20
+ Write `specs/prd/{domain}/{slug}.md`:
21
+
22
+ ```markdown
23
+ # PRD — {Feature Name}
24
+
25
+ **Version**: 1.0
26
+ **Status**: draft
27
+ **Domain**: {domain}
28
+ **Ticket**: {TICKET_PREFIX}-{N} (if available)
29
+ **Date**: {date}
30
+
31
+ ## 1. Problem Statement
32
+ {from product-definition}
33
+
34
+ ## 2. Goals & Non-Goals
35
+
36
+ ### Goals
37
+ - {goal 1}
38
+
39
+ ### Non-Goals
40
+ - {non-goal 1}
41
+
42
+ ## 3. User Stories
43
+
44
+ As a {persona}, I want to {action} so that {benefit}.
45
+
46
+ ## 4. Use Cases
47
+
48
+ | UC-ID | Name | Priority | Description |
49
+ |-------|------|----------|-------------|
50
+ | {DOMAIN}-UC1 | {name} | High | {description} |
51
+
52
+ ## 5. Business Rules
53
+
54
+ | BR-ID | Rule | UC |
55
+ |-------|------|----|
56
+ | BR-1 | {rule} | UC1 |
57
+
58
+ ## 6. Acceptance Criteria
59
+
60
+ ### {DOMAIN}-UC1: {Name}
61
+ - AC1: Given {context}, when {action}, then {result}
62
+
63
+ ## 7. Out of Scope
64
+ {from product-definition}
65
+
66
+ ## 8. Cross-Service Dependencies
67
+ {from product-definition}
68
+
69
+ ## 9. Open Questions
70
+ - [ ] {question requiring clarification}
71
+ ```
72
+
73
+ ### Output
74
+
75
+ ```
76
+ ✅ PRD created: specs/prd/{domain}/{slug}.md
77
+ Status: draft
78
+ ```
79
+
80
+ {{include:steps/report-footer.md}}
81
+
82
+ ---
83
+
84
+ ## /refine-prd — Analyze PRD Through 4 Review Lenses
85
+
86
+ Performs a structured multi-perspective analysis of a PRD and writes findings to a YAML file for human review.
87
+
88
+ ### Gate
89
+
90
+ <!-- Directory: specs/prd/**/*.md -->
91
+ {{include:steps/gate.md}}
92
+
93
+ ### Analyze — 4 Lenses (run all four perspectives)
94
+
95
+ #### QA Lens — Test Coverage & Edge Cases
96
+ Evaluate:
97
+ - Are all acceptance criteria testable and measurable?
98
+ - Are edge cases and error scenarios specified?
99
+ - Are boundary conditions defined?
100
+ - Is there ambiguity in expected behavior?
101
+
102
+ #### DEV Lens — Technical Clarity & Feasibility
103
+ Evaluate:
104
+ - Are API inputs/outputs clearly defined?
105
+ - Are business rules unambiguous enough to implement?
106
+ - Are there performance or scalability concerns?
107
+ - Are cross-service dependencies fully described?
108
+ - Is there anything technically infeasible or risky?
109
+
110
+ #### SA Lens — Architecture & Design
111
+ Evaluate:
112
+ - Does this fit the existing architecture?
113
+ - Are there design patterns or constraints to apply?
114
+ - Is data modeling clear (entities, relationships)?
115
+ - Are there security or auth implications?
116
+
117
+ #### PO Lens — Business Value & Scope
118
+ Evaluate:
119
+ - Is scope clearly bounded?
120
+ - Are priorities clear?
121
+ - Are success metrics defined?
122
+ - Are stakeholder needs fully captured?
123
+ - Any scope creep risk?
124
+
125
+ ### Write Output
126
+
127
+ Derive the output filename from the PRD slug:
128
+ - PRD file: `specs/prd/payment/create-invoice.md` → output: `.agent/review/create-invoice-findings.yaml`
129
+ - Rule: take the PRD filename (without `.md`), append `-findings.yaml`
130
+
131
+ Write findings to `.agent/review/{prd-slug}-findings.yaml`:
132
+
133
+ ```yaml
134
+ # Generated by /refine-prd
135
+ # Review each finding and mark: accepted / rejected / needs_discussion
136
+ prd_source: "specs/prd/{domain}/{slug}.md"
137
+ generated_at: "{ISO datetime}"
138
+ status: "pending_review"
139
+
140
+ findings:
141
+ - id: "F001"
142
+ lens: "QA" # QA | DEV | SA | PO
143
+ severity: "major" # critical | major | minor
144
+ section: "§6. Acceptance Criteria"
145
+ finding: "{Clear description of the gap or issue}"
146
+ suggestion: "{Specific actionable improvement}"
147
+ status: "pending" # pending | accepted | rejected | needs_discussion
148
+
149
+ - id: "F002"
150
+ lens: "DEV"
151
+ severity: "minor"
152
+ section: "§8. Cross-Service Dependencies"
153
+ finding: "{finding}"
154
+ suggestion: "{suggestion}"
155
+ status: "pending"
156
+
157
+ summary:
158
+ total_findings: {N}
159
+ by_severity:
160
+ critical: {N}
161
+ major: {N}
162
+ minor: {N}
163
+ by_lens:
164
+ QA: {N}
165
+ DEV: {N}
166
+ SA: {N}
167
+ PO: {N}
168
+ recommendation: "APPROVED_WITH_MINOR_CHANGES | NEEDS_REVISION | BLOCKED"
169
+ ```
170
+
171
+ ### Report to User
172
+
173
+ ```
174
+ /refine-prd Complete — {PRD name}
175
+
176
+ Findings: {total} total
177
+ 🔴 Critical: {N} 🟡 Major: {N} 🟢 Minor: {N}
178
+
179
+ Top issues:
180
+ [F001] QA/major — {brief description}
181
+ [F002] DEV/minor — {brief description}
182
+
183
+ Review file: .agent/review/{prd-slug}-findings.yaml
184
+ → Open with Review Board extension (right-click file) to accept/reject each finding
185
+ → After review: update PRD and run /generate-bdd
186
+ ```
187
+
188
+ {{include:steps/report-footer.md}}
@@ -0,0 +1,160 @@
1
+ ---
2
+ description: Sets up the Spec-Driven Development framework in any backend project from scratch. Trigger when: "/setup-ai-first", "setup spec-driven workflow", "initialize ai-first framework", "cài đặt framework", "khởi tạo spec-driven", "set up this workflow", "how do I start using this plugin".
3
+ ---
4
+
5
+ # /setup-ai-first — Initialize Spec-Driven Dev in a Project
6
+
7
+ Walk the user through a one-time setup that creates all required directories, installs CLAUDE.md, and verifies the environment.
8
+
9
+ ## Precondition Check
10
+
11
+ First, ask: "Bạn đang ở project nào? Cho tôi đường dẫn root của project."
12
+
13
+ Check if already set up:
14
+ - If `.claude/commands/` exists with `.md` files → report "Already set up. Run `/validate-traces` to check status."
15
+ - If `specs/` exists → offer to re-initialize or skip
16
+
17
+ ## Step 1 — Create Directory Structure
18
+
19
+ Create the following directories (skip if already exist):
20
+
21
+ ```
22
+ {project-root}/
23
+ ├── specs/
24
+ │ ├── product-definition/ # Output of /define-product
25
+ │ ├── prd/ # Output of /generate-prd
26
+ │ └── bdd/ # Output of /generate-bdd (.feature files)
27
+ ├── tech-docs/ # Output of /generate-tech-docs
28
+ ├── .trace/ # Traceability state files (.tsv)
29
+ └── .agent/
30
+ └── review/ # Output of /refine-prd ({prd-slug}-findings.yaml)
31
+ ```
32
+
33
+ Report each directory created or already existing.
34
+
35
+ ## Step 2 — Copy Slash Commands
36
+
37
+ Tell the user:
38
+
39
+ > "Plugin này đã cài slash commands vào Claude tự động qua skill system.
40
+ > Nếu bạn muốn dùng commands trực tiếp trong Claude Code project (`.claude/commands/`), chạy lệnh sau:"
41
+
42
+ ```bash
43
+ # Copy all commands from plugin to project
44
+ mkdir -p {project-root}/.claude/commands
45
+ cp {plugin-dir}/commands/*.md {project-root}/.claude/commands/
46
+ ```
47
+
48
+ Note: The `.claude/commands/` copies are optional. Skills in this plugin work without them.
49
+
50
+ ## Step 3 — Create CLAUDE.md
51
+
52
+ Check if `{project-root}/CLAUDE.md` exists:
53
+ - If yes: ask "CLAUDE.md đã tồn tại. Merge template vào hay bỏ qua?"
54
+ - If no: create from template in `templates/architecture.template.md`
55
+
56
+ After creating, instruct:
57
+ > "Mở CLAUDE.md và điền vào các placeholder `{{...}}` với thông tin dự án của bạn.
58
+ > Đặc biệt quan trọng: §1 (project overview) và §3 (coding standards)."
59
+
60
+ ## Step 4 — Create project-context.yaml
61
+
62
+ Create `{project-root}/.agent/project-context.yaml`:
63
+
64
+ ```yaml
65
+ # Project context for AI-First workflow
66
+ # Fill in all fields before starting
67
+
68
+ project:
69
+ name: "{{PROJECT_NAME}}"
70
+ description: "{{ONE_LINE_DESCRIPTION}}"
71
+
72
+ tech_stack:
73
+ language: "{{LANGUAGE}}" # e.g. Java 21, Python 3.12, Node.js 20
74
+ framework: "{{FRAMEWORK}}" # e.g. Spring Boot 3.x, FastAPI, NestJS
75
+ build_tool: "{{BUILD_TOOL}}" # e.g. Gradle, Maven, npm
76
+ test_framework: "{{TEST_FW}}" # e.g. JUnit 5, pytest, Jest
77
+ orm: "{{ORM}}" # e.g. Hibernate/JPA, SQLAlchemy, Prisma
78
+ database: "{{DATABASE}}" # e.g. PostgreSQL, MySQL, MongoDB
79
+
80
+ conventions:
81
+ build_command: "{{BUILD_COMMAND}}" # e.g. ./gradlew build -x test
82
+ test_command: "{{TEST_COMMAND}}" # e.g. ./gradlew test
83
+ service_run: "{{RUN_COMMAND}}" # e.g. ./gradlew bootRun
84
+ ticket_prefix: "{{TICKET_PREFIX}}" # e.g. PROJ, FEAT, PD
85
+
86
+ domains: [] # List your business domains, e.g. [rental, payment, user]
87
+ ```
88
+
89
+ ## Step 5 — Verify Setup
90
+
91
+ Run a quick check:
92
+ - [ ] `specs/` directory exists
93
+ - [ ] `.trace/` directory exists
94
+ - [ ] `.agent/project-context.yaml` exists
95
+ - [ ] `CLAUDE.md` exists
96
+
97
+ Report:
98
+ ```
99
+ /setup-ai-first Complete ✅
100
+
101
+ Directories created: {N}
102
+ Files created:
103
+ ✅ CLAUDE.md (needs customization)
104
+ ✅ .agent/project-context.yaml (needs customization)
105
+ ```
106
+
107
+ # Report Footer — Standard Command Output Format
108
+
109
+ Every command report must end with this standard footer section.
110
+
111
+ ## Status Badge
112
+
113
+ Choose one based on outcome:
114
+ - `✅ Complete` — all steps succeeded, no issues found
115
+ - `❌ Failed` — command could not complete due to a blocking error
116
+ - `⚠️ Warnings` — completed with non-blocking issues that should be reviewed
117
+
118
+ ## Output Artifacts
119
+
120
+ List every file created or modified by this command:
121
+ ```
122
+ Output Artifacts:
123
+ {created|updated} {file-path} ({brief description})
124
+ {created|updated} {file-path} ({brief description})
125
+ ```
126
+
127
+ If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
128
+
129
+ ## Next Command Suggestion
130
+
131
+ Suggest the logical next command based on workflow phase:
132
+
133
+ | Current command | Suggest next |
134
+ |-------------------------|-----------------------------------------------|
135
+ | /define-product | `/generate-prd {product-definition-file}` |
136
+ | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
137
+ | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
138
+ | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
139
+ | /generate-bdd | `/review-context {feature-file}` to verify coverage |
140
+ | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
141
+ | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
142
+ | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
143
+ | /generate-code | `/generate-tests {UC-ID}` |
144
+ | /generate-tests | `/run-tests {UC-ID}` |
145
+ | /run-tests (passing) | `/review-code {UC-ID}` |
146
+ | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
147
+ | /review-code | `/smoke-test {UC-ID}` or create PR |
148
+ | /smoke-test | Create PR and link to ticket |
149
+ | /validate-traces | `/generate-code {UC-ID}` for gaps |
150
+ | /fix-bug | Create PR and link to ticket |
151
+ | /debug | `/fix-bug {ticket-id}` if fix needed |
152
+
153
+ Format the footer as:
154
+ ```
155
+ ---
156
+ Status : {badge}
157
+ {Output Artifacts block}
158
+ Next : {suggested command with example arguments}
159
+ ```
160
+
@@ -0,0 +1,107 @@
1
+ ---
2
+ description: Sets up the Spec-Driven Development framework in any backend project from scratch. Trigger when: "/setup-ai-first", "setup spec-driven workflow", "initialize ai-first framework", "cài đặt framework", "khởi tạo spec-driven", "set up this workflow", "how do I start using this plugin".
3
+ ---
4
+
5
+ # /setup-ai-first — Initialize Spec-Driven Dev in a Project
6
+
7
+ Walk the user through a one-time setup that creates all required directories, installs CLAUDE.md, and verifies the environment.
8
+
9
+ ## Precondition Check
10
+
11
+ First, ask: "Bạn đang ở project nào? Cho tôi đường dẫn root của project."
12
+
13
+ Check if already set up:
14
+ - If `.claude/commands/` exists with `.md` files → report "Already set up. Run `/validate-traces` to check status."
15
+ - If `specs/` exists → offer to re-initialize or skip
16
+
17
+ ## Step 1 — Create Directory Structure
18
+
19
+ Create the following directories (skip if already exist):
20
+
21
+ ```
22
+ {project-root}/
23
+ ├── specs/
24
+ │ ├── product-definition/ # Output of /define-product
25
+ │ ├── prd/ # Output of /generate-prd
26
+ │ └── bdd/ # Output of /generate-bdd (.feature files)
27
+ ├── tech-docs/ # Output of /generate-tech-docs
28
+ ├── .trace/ # Traceability state files (.tsv)
29
+ └── .agent/
30
+ └── review/ # Output of /refine-prd ({prd-slug}-findings.yaml)
31
+ ```
32
+
33
+ Report each directory created or already existing.
34
+
35
+ ## Step 2 — Copy Slash Commands
36
+
37
+ Tell the user:
38
+
39
+ > "Plugin này đã cài slash commands vào Claude tự động qua skill system.
40
+ > Nếu bạn muốn dùng commands trực tiếp trong Claude Code project (`.claude/commands/`), chạy lệnh sau:"
41
+
42
+ ```bash
43
+ # Copy all commands from plugin to project
44
+ mkdir -p {project-root}/.claude/commands
45
+ cp {plugin-dir}/commands/*.md {project-root}/.claude/commands/
46
+ ```
47
+
48
+ Note: The `.claude/commands/` copies are optional. Skills in this plugin work without them.
49
+
50
+ ## Step 3 — Create CLAUDE.md
51
+
52
+ Check if `{project-root}/CLAUDE.md` exists:
53
+ - If yes: ask "CLAUDE.md đã tồn tại. Merge template vào hay bỏ qua?"
54
+ - If no: create from template in `templates/architecture.template.md`
55
+
56
+ After creating, instruct:
57
+ > "Mở CLAUDE.md và điền vào các placeholder `{{...}}` với thông tin dự án của bạn.
58
+ > Đặc biệt quan trọng: §1 (project overview) và §3 (coding standards)."
59
+
60
+ ## Step 4 — Create project-context.yaml
61
+
62
+ Create `{project-root}/.agent/project-context.yaml`:
63
+
64
+ ```yaml
65
+ # Project context for AI-First workflow
66
+ # Fill in all fields before starting
67
+
68
+ project:
69
+ name: "{{PROJECT_NAME}}"
70
+ description: "{{ONE_LINE_DESCRIPTION}}"
71
+
72
+ tech_stack:
73
+ language: "{{LANGUAGE}}" # e.g. Java 21, Python 3.12, Node.js 20
74
+ framework: "{{FRAMEWORK}}" # e.g. Spring Boot 3.x, FastAPI, NestJS
75
+ build_tool: "{{BUILD_TOOL}}" # e.g. Gradle, Maven, npm
76
+ test_framework: "{{TEST_FW}}" # e.g. JUnit 5, pytest, Jest
77
+ orm: "{{ORM}}" # e.g. Hibernate/JPA, SQLAlchemy, Prisma
78
+ database: "{{DATABASE}}" # e.g. PostgreSQL, MySQL, MongoDB
79
+
80
+ conventions:
81
+ build_command: "{{BUILD_COMMAND}}" # e.g. ./gradlew build -x test
82
+ test_command: "{{TEST_COMMAND}}" # e.g. ./gradlew test
83
+ service_run: "{{RUN_COMMAND}}" # e.g. ./gradlew bootRun
84
+ ticket_prefix: "{{TICKET_PREFIX}}" # e.g. PROJ, FEAT, PD
85
+
86
+ domains: [] # List your business domains, e.g. [rental, payment, user]
87
+ ```
88
+
89
+ ## Step 5 — Verify Setup
90
+
91
+ Run a quick check:
92
+ - [ ] `specs/` directory exists
93
+ - [ ] `.trace/` directory exists
94
+ - [ ] `.agent/project-context.yaml` exists
95
+ - [ ] `CLAUDE.md` exists
96
+
97
+ Report:
98
+ ```
99
+ /setup-ai-first Complete ✅
100
+
101
+ Directories created: {N}
102
+ Files created:
103
+ ✅ CLAUDE.md (needs customization)
104
+ ✅ .agent/project-context.yaml (needs customization)
105
+ ```
106
+
107
+ {{include:steps/report-footer.md}}