@eltonssouza/development-utility-kit 0.10.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 (131) hide show
  1. package/.claude/agents/README.md +24 -0
  2. package/.claude/agents/analyst.md +198 -0
  3. package/.claude/agents/backend-developer.md +126 -0
  4. package/.claude/agents/brain-keeper.md +229 -0
  5. package/.claude/agents/code-reviewer.md +181 -0
  6. package/.claude/agents/database-engineer.md +94 -0
  7. package/.claude/agents/devops-engineer.md +141 -0
  8. package/.claude/agents/frontend-developer.md +97 -0
  9. package/.claude/agents/gate-keeper.md +118 -0
  10. package/.claude/agents/migrator.md +291 -0
  11. package/.claude/agents/mobile-developer.md +80 -0
  12. package/.claude/agents/n8n-specialist.md +94 -0
  13. package/.claude/agents/product-owner.md +115 -0
  14. package/.claude/agents/qa-engineer.md +232 -0
  15. package/.claude/agents/release-engineer.md +204 -0
  16. package/.claude/agents/scaffold.md +87 -0
  17. package/.claude/agents/security-engineer.md +199 -0
  18. package/.claude/agents/sprint-runner.md +46 -0
  19. package/.claude/agents/stack-resolver.md +104 -0
  20. package/.claude/agents/tech-lead.md +182 -0
  21. package/.claude/agents/update-template.md +54 -0
  22. package/.claude/agents/ux-designer.md +118 -0
  23. package/.claude/hooks/flow-guard.js +261 -0
  24. package/.claude/hooks/flow-state.js +197 -0
  25. package/.claude/local/CLAUDE.md +71 -0
  26. package/.claude/settings.json +55 -0
  27. package/.claude/skills/README.md +331 -0
  28. package/.claude/skills/active-project/SKILL.md +131 -0
  29. package/.claude/skills/api-integration-test/SKILL.md +84 -0
  30. package/.claude/skills/auto-test-guard/SKILL.md +239 -0
  31. package/.claude/skills/auto-test-guard/resources/backend-tests.md +20 -0
  32. package/.claude/skills/auto-test-guard/resources/e2e-tests.md +24 -0
  33. package/.claude/skills/auto-test-guard/resources/execution-report.md +49 -0
  34. package/.claude/skills/auto-test-guard/resources/frontend-tests.md +18 -0
  35. package/.claude/skills/auto-test-guard/resources/initial-setup.md +108 -0
  36. package/.claude/skills/auto-test-guard/resources/run-suite.md +48 -0
  37. package/.claude/skills/auto-test-guard/resources/senior-gate.md +19 -0
  38. package/.claude/skills/brain-keeper/SKILL.md +62 -0
  39. package/.claude/skills/brain-keeper/obsidian/app.json +9 -0
  40. package/.claude/skills/brain-keeper/obsidian/appearance.json +4 -0
  41. package/.claude/skills/brain-keeper/obsidian/core-plugins.json +20 -0
  42. package/.claude/skills/brain-keeper/obsidian/daily-notes.json +5 -0
  43. package/.claude/skills/brain-keeper/obsidian/graph.json +32 -0
  44. package/.claude/skills/brain-keeper/obsidian/snippets/folder-colors.css +90 -0
  45. package/.claude/skills/brain-keeper/obsidian/templates.json +5 -0
  46. package/.claude/skills/brain-keeper/templates/README.md +51 -0
  47. package/.claude/skills/brain-keeper/templates/adr.md +40 -0
  48. package/.claude/skills/brain-keeper/templates/bug.md +35 -0
  49. package/.claude/skills/brain-keeper/templates/daily.md +38 -0
  50. package/.claude/skills/brain-keeper/templates/feature.md +62 -0
  51. package/.claude/skills/brain-keeper/templates/meeting.md +34 -0
  52. package/.claude/skills/brain-keeper/templates/tech-debt.md +21 -0
  53. package/.claude/skills/caveman/SKILL.md +189 -0
  54. package/.claude/skills/create-stack-pack/SKILL.md +281 -0
  55. package/.claude/skills/grill-me/SKILL.md +80 -0
  56. package/.claude/skills/pair-debug/SKILL.md +288 -0
  57. package/.claude/skills/prd-ready-check/SKILL.md +86 -0
  58. package/.claude/skills/project-manager/SKILL.md +334 -0
  59. package/.claude/skills/quality-standards/SKILL.md +203 -0
  60. package/.claude/skills/quick-feature/SKILL.md +266 -0
  61. package/.claude/skills/run-sprint/SKILL.md +41 -0
  62. package/.claude/skills/scaffold/SKILL.md +60 -0
  63. package/.claude/skills/stack-discovery/SKILL.md +161 -0
  64. package/.claude/skills/test-coverage-auditor/SKILL.md +87 -0
  65. package/.claude/skills/to-issues/SKILL.md +163 -0
  66. package/.claude/skills/to-prd/SKILL.md +130 -0
  67. package/.claude/skills/update-template/SKILL.md +256 -0
  68. package/.claude/stacks/CODEOWNERS +30 -0
  69. package/.claude/stacks/README.md +97 -0
  70. package/.claude/stacks/_template.md +116 -0
  71. package/.claude/stacks/dotnet/aspire-9.md +528 -0
  72. package/.claude/stacks/go/gin-1.10.md +570 -0
  73. package/.claude/stacks/java/spring-boot-3.md +376 -0
  74. package/.claude/stacks/java/spring-boot-4.md +438 -0
  75. package/.claude/stacks/node/express-5.md +538 -0
  76. package/.claude/stacks/python/django-5.md +483 -0
  77. package/.claude/stacks/python/fastapi-0.115.md +522 -0
  78. package/.claude/stacks/typescript/angular-18.md +420 -0
  79. package/.claude/stacks/typescript/angular-19.md +397 -0
  80. package/.claude/stacks/typescript/angular-21.md +494 -0
  81. package/CLAUDE.md +472 -0
  82. package/README.md +412 -0
  83. package/bin/cli.js +848 -0
  84. package/bin/lib/adr.js +146 -0
  85. package/bin/lib/backup.js +62 -0
  86. package/bin/lib/detect-stack.js +476 -0
  87. package/bin/lib/doctor.js +527 -0
  88. package/bin/lib/help.js +328 -0
  89. package/bin/lib/identity.js +108 -0
  90. package/bin/lib/lint-allowlist.json +15 -0
  91. package/bin/lib/lint.js +798 -0
  92. package/bin/lib/local-dir.js +68 -0
  93. package/bin/lib/manifest.js +236 -0
  94. package/bin/lib/sync-all.js +394 -0
  95. package/bin/lib/version-check.js +398 -0
  96. package/dashboard/db.js +321 -0
  97. package/dashboard/package.json +22 -0
  98. package/dashboard/public/app.js +853 -0
  99. package/dashboard/public/content/docs/agents-reference.en.md +911 -0
  100. package/dashboard/public/content/docs/architecture-overview.en.md +252 -0
  101. package/dashboard/public/content/docs/autonomy-matrix.en.md +186 -0
  102. package/dashboard/public/content/docs/cli-reference.en.md +538 -0
  103. package/dashboard/public/content/docs/git-flow.en.md +525 -0
  104. package/dashboard/public/content/docs/honcho-memory.en.md +394 -0
  105. package/dashboard/public/content/docs/hooks-reference.en.md +404 -0
  106. package/dashboard/public/content/docs/pipeline.en.md +414 -0
  107. package/dashboard/public/content/docs/plugins.en.md +289 -0
  108. package/dashboard/public/content/docs/quality-gate.en.md +315 -0
  109. package/dashboard/public/content/docs/skills-reference.en.md +484 -0
  110. package/dashboard/public/content/docs/stack-rules.en.md +362 -0
  111. package/dashboard/public/content/docs/troubleshooting.en.md +565 -0
  112. package/dashboard/public/content/manifest.json +114 -0
  113. package/dashboard/public/content/manual/backend.en.md +1053 -0
  114. package/dashboard/public/content/manual/existing-project.en.md +848 -0
  115. package/dashboard/public/content/manual/frontend.en.md +1008 -0
  116. package/dashboard/public/content/manual/fullstack.en.md +1459 -0
  117. package/dashboard/public/content/manual/mobile.en.md +837 -0
  118. package/dashboard/public/content/manual/quickstart.en.md +169 -0
  119. package/dashboard/public/index.html +217 -0
  120. package/dashboard/public/style.css +857 -0
  121. package/dashboard/public/vendor/marked.min.js +69 -0
  122. package/dashboard/rtk.js +143 -0
  123. package/dashboard/server-app.js +421 -0
  124. package/dashboard/server.js +104 -0
  125. package/dashboard/test/sprint1.test.js +406 -0
  126. package/dashboard/test/sprint2.test.js +571 -0
  127. package/dashboard/test/sprint3.test.js +560 -0
  128. package/package.json +33 -0
  129. package/scripts/hooks/subagent-telemetry.sh +14 -0
  130. package/scripts/hooks/telemetry-writer.js +250 -0
  131. package/scripts/latest-versions.json +56 -0
@@ -0,0 +1,1053 @@
1
+ # Backend Manual — Java 25 + Spring Boot 4
2
+
3
+ This manual is the definitive starting point for any backend developer who
4
+ opens the `development-utility-kit` dashboard for the first time. It covers the
5
+ backend flow only (Java 25 + Spring Boot 4 + DDD), with no fluff and no
6
+ generic examples. Every command, trigger, and agent reference here was
7
+ checked against the real harness code — nothing was invented.
8
+
9
+ Prerequisites before you start:
10
+
11
+ - JDK 25 or higher installed (`java -version` should respond 25+)
12
+ - Maven 3.9+ (`mvn -v`) — the `./mvnw` wrapper is generated by the scaffold
13
+ - Docker Desktop + Docker Compose v2 (for Testcontainers + local stack)
14
+ - Node.js 18+ (required by the `duk` binary distributed via npx)
15
+ - Cowork (recommended) **or** Claude Code CLI (`claude`) authenticated
16
+
17
+ If any of these are missing, **stop here** and install them first. The
18
+ harness assumes the environment is already healthy.
19
+
20
+ ---
21
+
22
+ ## 1. Five-minute onboarding
23
+
24
+ This is the shortest path from "I have an empty folder" to "I have a Spring
25
+ Boot 4 backend with a senior+ gate running". Five steps, every command real.
26
+
27
+ ### Step 1 — Create or enter the canonical project folder
28
+
29
+ Every new project lives in `C:\development\source\projects\<name>\`. If the
30
+ folder doesn't exist yet:
31
+
32
+ ```bash
33
+ mkdir -p C:\development\source\projects\my-backend-api
34
+ cd C:\development\source\projects\my-backend-api
35
+ git init
36
+ ```
37
+
38
+ If you prefer the guided scaffold, use the interactive wrapper:
39
+
40
+ ```bash
41
+ # Windows (CMD or double-click)
42
+ C:\development\tools\development-utility-kit\scripts\new-project.bat
43
+
44
+ # Git Bash / WSL / Mac / Linux
45
+ bash /c/development/tools/development-utility-kit/scripts/new-project.sh
46
+ ```
47
+
48
+ ### Step 2 — Install the harness into the folder
49
+
50
+ The `duk` binary (installed via npx) injects `.claude/`, `CLAUDE.md`, and
51
+ the skill/agent settings. It is idempotent — run it as often as you like.
52
+
53
+ ```bash
54
+ # Recommended form (no global install):
55
+ npx @eltonssouza/development-utility-kit install
56
+
57
+ # If the duk binary is already on PATH:
58
+ duk install
59
+
60
+ # Preview what would be modified (writes nothing):
61
+ duk install --dry-run
62
+
63
+ # Install into a subdirectory only (e.g. monorepo):
64
+ duk install --sub backend
65
+ ```
66
+
67
+ Expected output: creation of `.claude/`, `CLAUDE.md`, `docs/`, and a backup
68
+ `.claude.backup-YYYYMMDD-HHMMSS/` if previous configuration existed.
69
+
70
+ ### Step 3 — Edit the `Project Identity` section of `CLAUDE.md`
71
+
72
+ This is the **only section** of `CLAUDE.md` you should edit by hand. The
73
+ remaining sections are harness-owned and will be overwritten on
74
+ `update-template` (the `Project Identity` section is preserved by the merge).
75
+
76
+ Open `CLAUDE.md` and fill in:
77
+
78
+ ```markdown
79
+ ## Project Identity
80
+
81
+ - **Project name**: `my-backend-api`
82
+ - **Project type**: `backend`
83
+ - **Primary stack**: `Java 25 + Spring Boot 4`
84
+ - **Database**: `PostgreSQL 17 + Redis 7`
85
+ - **Domain**: `e-commerce`
86
+ - **Team size**: `3 backend`
87
+ - **Additional rules**: _(leave empty if none)_
88
+ ```
89
+
90
+ The `Project type` field is decisive — bootstrap skills read this value to
91
+ decide what to scaffold.
92
+
93
+ ### Step 4 — Open Cowork or Claude Code in the folder
94
+
95
+ In any terminal **inside** the project folder:
96
+
97
+ ```bash
98
+ # Claude Code CLI:
99
+ claude
100
+
101
+ # OR open the folder in Cowork as a local session
102
+ ```
103
+
104
+ You are ready for the first conversation.
105
+
106
+ ### Step 5 — First prompt: scaffold the backend
107
+
108
+ Type **literally** into the chat:
109
+
110
+ ```text
111
+ scaffolda o backend
112
+ ```
113
+
114
+ (Yes — the trigger phrase is Portuguese by design; the skill matches the
115
+ keyword regardless of UI language. The English alias `scaffold the backend`
116
+ also works.)
117
+
118
+ The `bootstrap-backend-java` skill fires by keyword match, reads
119
+ `Project Identity`, calls Spring Initializr (Spring Boot 4.0+, Java 25+),
120
+ and generates:
121
+
122
+ ```
123
+ backend/
124
+ ├── pom.xml (Spring Boot 4 parent, Java 25)
125
+ ├── src/main/java/com/<org>/<app>/
126
+ │ ├── domain/ (model, repository ports)
127
+ │ ├── application/ (use cases, record DTOs)
128
+ │ ├── infrastructure/ (JPA adapters, security, config)
129
+ │ └── web/ (controllers, advice, ProblemDetail)
130
+ ├── src/main/resources/
131
+ │ ├── application.yml
132
+ │ └── db/migration/V1__init.sql (Flyway baseline)
133
+ ├── src/test/ (JUnit 5 + Mockito + Testcontainers)
134
+ └── README.md
135
+ docker-compose.yml (postgres + redis at root level)
136
+ ```
137
+
138
+ In parallel, the initial gate is configured: JaCoCo (coverage), Pitest
139
+ (mutation), SpotBugs, OWASP dependency-check. `gate-keeper` has what it
140
+ needs to live by from the very first commit.
141
+
142
+ From here on, you no longer touch the scaffold — every new iteration is via
143
+ chat prompt.
144
+
145
+ ---
146
+
147
+ ## 2. How the harness actually works
148
+
149
+ Before listing skills, understand the architecture. **There is no CLI
150
+ command that invokes a skill or an agent.** This is a common mistake.
151
+
152
+ ### The real `duk` CLI
153
+
154
+ The `duk` binary (in `bin/cli.js`) exposes exactly three commands:
155
+
156
+ | Command | Purpose |
157
+ |---|---|
158
+ | `duk install` | Injects `.claude/` + `CLAUDE.md` into CWD. Alias: `duk update`. |
159
+ | `duk install --sub backend` | Same, into a subfolder. |
160
+ | `duk install --dry-run` | Show the diff without writing. |
161
+ | `duk dashboard` | Start the local dashboard at `http://localhost:4242`. |
162
+ | `duk dashboard --port 4243 --no-open` | Custom port, no browser. |
163
+
164
+ There is **no** `duk grill-me`, `duk project-manager`, `duk run-sprint`, or
165
+ `duk <any-skill>`. Skills are not command-line entities — they are
166
+ `SKILL.md` files that Claude Code/Cowork **fires automatically by keyword
167
+ match in the user prompt**.
168
+
169
+ ### Skill vs Agent vs Task tool
170
+
171
+ | Layer | Lives in | How it's invoked |
172
+ |---|---|---|
173
+ | Skill | `.claude/skills/<name>/SKILL.md` | Keyword match in the user prompt |
174
+ | Agent | `.claude/agents/<name>.md` | Skill calls via Task tool (not directly by user) |
175
+ | Task tool | Claude Code built-in | Skills use it to delegate work to agents |
176
+
177
+ You talk to the skill in natural language. It delegates to the appropriate
178
+ agents through the Task tool. Agents do the real work (write code, run
179
+ tests, produce ADRs) and return to the skill, which returns to you.
180
+
181
+ ### Keyword → skill map
182
+
183
+ | Skill | Triggers (type literally; mixed PT/EN supported) |
184
+ |---|---|
185
+ | `bootstrap-backend-java` | `scaffolda o backend`, `scaffold the backend`, `bootstrap backend`, `start a Spring Boot backend` |
186
+ | `grill-me` | `grill me about <X>`, `interview me on <X>`, `stress-test the plan for <Y>`, `rubber duck` |
187
+ | `to-prd` | `generate PRD`, `create PRD`, `to-prd` |
188
+ | `to-issues` | `break into issues`, `generate issues`, `to-issues` |
189
+ | `run-sprint` | `run sprint 1`, `execute sprint 2 of PLAN_<X>.md`, `implement the sprint tasks` |
190
+ | `auto-test-guard` | `run the tests`, `generate tests`, `full suite`, `make sure nothing broke` |
191
+ | `prd-ready-check` | `ready for production?`, `DoD`, `can we ship`, `run the final checklist` |
192
+ | `api-integration-test` | `integration test`, `smoke test`, `bring everything up and test` |
193
+ | `pair-debug` | `let's debug <X>`, `investigate this bug`, `find the root cause`, `why doesn't this work` |
194
+ | `brain-keeper` | `record in the brain`, `update brain`, `daily log`, `save ADR to vault` |
195
+ | `active-project` | `/active-project <path>`, `activate project at <path>` |
196
+ | `update-template` | `update the template`, `sync with development-utility-kit`, `pull the new skills` |
197
+ | `project-manager` | catch-all — any prompt without a more specific skill |
198
+ | `caveman` | `caveman lite`, `caveman ultra`, `stop caveman` |
199
+
200
+ ---
201
+
202
+ ## 3. Skills relevant to the backend
203
+
204
+ The master table below lists every skill relevant to a backend project.
205
+ Each one has a dedicated card in the following subsections.
206
+
207
+ | Skill | When to use | Output |
208
+ |---|---|---|
209
+ | `bootstrap-backend-java` | Empty folder, after first `duk install` | `backend/` Spring Boot 4 + compose |
210
+ | `grill-me` | Vague idea, before any PRD/PLAN | `docs/discovery/DISCOVERY_<NAME>.md` |
211
+ | `to-prd` | Discovery done, missing product doc | `docs/prd/PRD_<NAME>.md` |
212
+ | `to-issues` | PRD done, you want GitHub issues | `docs/issues/ISSUES_<NAME>.md` |
213
+ | `run-sprint` | PLAN ready with sprints defined | Code + green tests (TDD) |
214
+ | `auto-test-guard` | End of task or explicit gate request | Full suite + thresholds |
215
+ | `prd-ready-check` | Before tagging a release | GO/NO-GO verdict |
216
+ | `api-integration-test` | You want a real smoke (not unit) | curl report + logs |
217
+ | `pair-debug` | Non-obvious bug, intermittent failure | hypothesis→probe→fix loop |
218
+ | `brain-keeper` | End of sprint/feature, want history | `docs/brain/` daily + feature + ADR |
219
+ | `active-project` | Fast non-interactive adoption by path | `.claude/` installed at path |
220
+ | `update-template` | Pull new skills/agents from harness | Merge into `.claude/` + backup |
221
+ | `caveman` | You want telegraphic answers | Output 65-75% smaller |
222
+
223
+ ### 3.1. `bootstrap-backend-java`
224
+
225
+ **When to use:** first time in a new `type: backend` project, or whenever
226
+ you need the standard skeleton.
227
+
228
+ **Triggers:**
229
+
230
+ ```text
231
+ scaffold the backend
232
+ scaffolda o backend
233
+ bootstrap backend
234
+ start a Spring Boot backend
235
+ ```
236
+
237
+ **What it does:**
238
+
239
+ 1. Reads `CLAUDE.md` → `Project Identity` (name, stack, db).
240
+ 2. Calls Spring Initializr with Spring Boot 4.0+ / Java 25+.
241
+ 3. Creates DDD structure (`domain/`, `application/`, `infrastructure/`, `web/`).
242
+ 4. Adds `pom.xml` with JaCoCo, Pitest, SpotBugs, OWASP DC.
243
+ 5. Creates root `docker-compose.yml` with postgres + redis.
244
+ 6. Generates first Flyway migration (`V1__init.sql`).
245
+ 7. Configures `application.yml` (dev profile, datasource, actuator).
246
+ 8. Test stub with working Testcontainers Postgres.
247
+
248
+ **Typical chat output:**
249
+
250
+ ```text
251
+ [bootstrap-backend-java]
252
+ ✓ Read CLAUDE.md → my-backend-api / e-commerce
253
+ ✓ Spring Initializr → spring-boot 4.0.0, java 25
254
+ ✓ DDD structure created at backend/
255
+ ✓ pom.xml with senior+ gate (JaCoCo 0.8.12, Pitest 1.17, SpotBugs 4.8, OWASP 10.0)
256
+ ✓ docker-compose.yml (postgres:17, redis:7)
257
+ ✓ Flyway baseline at V1__init.sql
258
+ ✓ application.yml dev profile ready
259
+ ✓ Sample test with @Testcontainers green
260
+
261
+ Suggested next step: "grill me about <first feature>"
262
+ ```
263
+
264
+ ### 3.2. `grill-me`
265
+
266
+ **When to use:** any new feature idea, before going to PRD/PLAN. The skill
267
+ runs a Socratic interview (10-30 turns) and forces you to make scope, edge
268
+ cases, priority, and success metric explicit. **On the human path, `analyst`
269
+ refuses to produce a PLAN without a valid DISCOVERY** (see ADR-013/017).
270
+
271
+ **Triggers:**
272
+
273
+ ```text
274
+ grill me about adding JWT authentication
275
+ interview me on the payment module
276
+ stress-test the plan for distributed cache
277
+ rubber duck on the orders webhook idea
278
+ ```
279
+
280
+ **Real conversation example (8 turns):**
281
+
282
+ ```text
283
+ You:
284
+ grill me about adding JWT authentication
285
+
286
+ Claude (grill-me):
287
+ > Let's understand the goal. Will JWT be issued by your own backend (login
288
+ > with email/password) or by an external IdP (Keycloak, Auth0)? I recommend
289
+ > your own backend for the MVP — less integration. Confirm?
290
+
291
+ You:
292
+ own backend
293
+
294
+ Claude:
295
+ > Refresh token: opaque (uuid in Redis) or JWT too? I recommend opaque +
296
+ > rotation on every refresh. Trade-off: one extra Redis trip vs immediate
297
+ > revocability. OK?
298
+
299
+ You:
300
+ opaque + rotation
301
+
302
+ Claude:
303
+ > RBAC: fixed roles (USER/ADMIN) or granular (permissions table)? I
304
+ > recommend fixed roles for the MVP — granularize when a 3rd user type
305
+ > appears.
306
+
307
+ You:
308
+ fixed roles, USER and ADMIN
309
+
310
+ Claude:
311
+ > Expiration policy: access 15min, refresh 7d? OK for your "stay logged in
312
+ > for a week" window?
313
+
314
+ You:
315
+ yes
316
+
317
+ Claude:
318
+ > Password: bcrypt cost 12 (Spring Security 6+ default) or argon2? Bcrypt
319
+ > covers 99% of cases. I recommend bcrypt 12 + rate limit on /login
320
+ > (5/min/IP).
321
+
322
+ You:
323
+ bcrypt 12
324
+
325
+ Claude:
326
+ > Success metric? Suggest: POST /login P95 < 200ms, expected 401 error
327
+ > rate < 5% (attack), 0 tokens leaked in logs.
328
+
329
+ You:
330
+ done
331
+
332
+ Claude:
333
+ > Persisted to docs/discovery/DISCOVERY_auth-jwt.md with 8 sections.
334
+ > Suggested next step: "generate PRD"
335
+ ```
336
+
337
+ ### 3.3. `to-prd`
338
+
339
+ **When to use:** when the DISCOVERY is done and you want a formal product
340
+ document (with Goals, User Stories, FR, NFR, Out of scope) for team
341
+ reference.
342
+
343
+ **Triggers:**
344
+
345
+ ```text
346
+ generate PRD
347
+ create PRD
348
+ to-prd
349
+ ```
350
+
351
+ **Output:** `docs/prd/PRD_<NAME>.md` with 6 sections:
352
+
353
+ 1. Overview
354
+ 2. Goals (measurable)
355
+ 3. User Stories
356
+ 4. Functional Requirements
357
+ 5. Non-functional Requirements
358
+ 6. Out of scope
359
+
360
+ ### 3.4. `to-issues`
361
+
362
+ **When to use:** PRD is ready and you want to break it into issues, ready
363
+ for `gh issue create`.
364
+
365
+ **Triggers:**
366
+
367
+ ```text
368
+ break into issues
369
+ generate issues
370
+ to-issues
371
+ ```
372
+
373
+ **Output:** `docs/issues/ISSUES_<NAME>.md` with `[ISSUE-N]`
374
+ copy-paste-ready blocks.
375
+
376
+ ### 3.5. `run-sprint`
377
+
378
+ **When to use:** a `docs/plans/PLAN_<NAME>.md` exists (produced by
379
+ `analyst`) and you want to execute a specific sprint in orchestrated TDD
380
+ mode.
381
+
382
+ **Non-negotiable prerequisite:** the PLAN must have **goal-ready DoD**
383
+ (Definition of Done expressed as a verifiable objective, not a task
384
+ checklist). `analyst` refuses to produce a PLAN without DISCOVERY.
385
+
386
+ **Triggers:**
387
+
388
+ ```text
389
+ run sprint 1 of PLAN_auth-jwt.md
390
+ execute sprint 2
391
+ implement the sprint 1 tasks
392
+ let's code sprint 1
393
+ ```
394
+
395
+ **What it does per task:**
396
+
397
+ 1. `qa-engineer` writes a failing test (JUnit 5 + Mockito or Testcontainers).
398
+ 2. `backend-developer` implements code until the test passes.
399
+ 3. `gate-keeper` validates senior+ thresholds (coverage, mutation, SpotBugs).
400
+ 4. If the gate fails, it routes back to `backend-developer` with diagnosis.
401
+ 5. If the gate passes, move on to the next task.
402
+
403
+ ### 3.6. `auto-test-guard`
404
+
405
+ **When to use:** at the end of any significant task, or explicitly.
406
+
407
+ **Triggers:**
408
+
409
+ ```text
410
+ run the tests
411
+ generate tests
412
+ test everything
413
+ full suite
414
+ make sure nothing broke
415
+ ```
416
+
417
+ **Mandatory backend thresholds:**
418
+
419
+ | Metric | Minimum | Tool |
420
+ |---|---|---|
421
+ | Line coverage | 85% | JaCoCo |
422
+ | Branch coverage | 80% | JaCoCo |
423
+ | Mutation score (domain + application) | 70% | Pitest |
424
+ | SpotBugs CRITICAL/HIGH | 0 | SpotBugs Maven |
425
+ | OWASP CVE CVSS≥7.0 | 0 | OWASP DC |
426
+ | Pyramid — % E2E | ≤30% (hard) / ≤15% (ideal) | auto count |
427
+
428
+ If any threshold fails, `gate-keeper` blocks the merge. `tech-lead` rejects
429
+ the PR.
430
+
431
+ ### 3.7. `api-integration-test`
432
+
433
+ **When to use:** real smoke — app started via docker compose plus actual
434
+ curl/HTTP. Not unit, not mock.
435
+
436
+ **Triggers:**
437
+
438
+ ```text
439
+ integration test
440
+ smoke test
441
+ bring everything up and test
442
+ ```
443
+
444
+ **What it does:**
445
+
446
+ 1. `docker compose up -d` (postgres + redis + backend).
447
+ 2. Waits for `/actuator/health` to return UP.
448
+ 3. Runs the list of critical endpoints (main CRUD, auth, error paths).
449
+ 4. Verifies ProblemDetail (RFC 9457) in error responses.
450
+ 5. Tear down + report.
451
+
452
+ ### 3.8. `prd-ready-check`
453
+
454
+ **When to use:** before tag/release/deploy. This is the final gate that
455
+ cross-references PRD/DoD with the real code state.
456
+
457
+ **Triggers:**
458
+
459
+ ```text
460
+ ready for production?
461
+ DoD
462
+ can we ship?
463
+ run the final checklist
464
+ ```
465
+
466
+ **Output:** GO or NO-GO verdict with a detailed list of what's missing.
467
+
468
+ ### 3.9. `pair-debug`
469
+
470
+ **When to use:** non-obvious bug. Intermittent failure. Error only in prod.
471
+ Behavior diverges between environments. **Never** use this in "try and see"
472
+ mode — the skill forces explicit hypotheses before any change.
473
+
474
+ **Triggers:**
475
+
476
+ ```text
477
+ let's debug this 500 on GET /users
478
+ investigate this Hibernate LazyInitException
479
+ find the root cause of the migration failure
480
+ why does this work locally but not in prod
481
+ ```
482
+
483
+ **Loop example:**
484
+
485
+ ```text
486
+ You:
487
+ let's debug this 500 on GET /api/v1/users in prod
488
+
489
+ Claude (pair-debug):
490
+ > Symptom: 500 on GET /api/v1/users only in prod.
491
+ > Hypothesis 1 (70% confidence): Lazy loading of User.roles fires outside
492
+ > a transaction. Probe: grep "@Transactional" in UserService + Hibernate
493
+ > logs for LazyInitializationException.
494
+ > Run probe? (yes/no)
495
+
496
+ You:
497
+ yes
498
+
499
+ Claude:
500
+ > Probe done. Result: UserService.findAll() has no @Transactional.
501
+ > Prod log has 47 occurrences of LazyInitializationException in the last
502
+ > 24h. Hypothesis 1 CONFIRMED.
503
+ > Fix: add @Transactional(readOnly=true) to UserService.findAll().
504
+ > Dispatching backend-developer to apply + qa-engineer for a regression
505
+ > test that fails without the fix.
506
+ ```
507
+
508
+ ### 3.10. `brain-keeper`
509
+
510
+ **When to use:** at the end of a sprint or feature, to record history in
511
+ Obsidian format (vault at `docs/brain/`).
512
+
513
+ **Triggers:**
514
+
515
+ ```text
516
+ record in the brain
517
+ update brain
518
+ daily log
519
+ save ADR to vault
520
+ ```
521
+
522
+ **Output:**
523
+
524
+ - `docs/brain/daily/2026-05-27.md`
525
+ - `docs/brain/features/<slug>.md`
526
+ - `docs/brain/decisions/ADR-NNN-<slug>.md`
527
+ - `docs/brain/architecture/tech-debt.md` (updated)
528
+ - MOC (Map of Content) regenerated
529
+
530
+ ### 3.12. `active-project`
531
+
532
+ **When to use:** fast, non-interactive adoption of an existing project at a
533
+ specific path.
534
+
535
+ **Triggers:**
536
+
537
+ ```text
538
+ /active-project C:\my-legacy-project
539
+ activate project at C:\my-legacy-project
540
+ adopt the project at C:\old-code
541
+ ```
542
+
543
+ ### 3.13. `update-template`
544
+
545
+ **When to use:** pull new skills/agents/ADRs from the harness into a
546
+ project that was already adopted.
547
+
548
+ **Triggers:**
549
+
550
+ ```text
551
+ update the template
552
+ sync with development-utility-kit
553
+ pull the new skills
554
+ ```
555
+
556
+ The `Project Identity` section of the project's `CLAUDE.md` is preserved in
557
+ the merge.
558
+
559
+ ### 3.14. `caveman`
560
+
561
+ **When to use:** when you want telegraphic answers (~65-75% fewer tokens).
562
+
563
+ **Triggers:**
564
+
565
+ ```text
566
+ caveman lite (default telegraphic mode)
567
+ caveman full (reduced markdown)
568
+ caveman ultra (max compression, clean code)
569
+ stop caveman (back to normal)
570
+ ```
571
+
572
+ By default, `caveman` is **on** with profile ULTRA for code and FULL for
573
+ `.md`.
574
+
575
+ ---
576
+
577
+ ## 4. Agents — who does what
578
+
579
+ You don't invoke agents directly. But you do need to know who is
580
+ responsible for what — so that you understand the responses and can escalate
581
+ correctly in case of conflict.
582
+
583
+ | Agent | Model | When it acts |
584
+ |---|---|---|
585
+ | `product-owner` | Opus 4.7 | Product decisions, scope, rules, priority, API contract |
586
+ | `tech-lead` | Opus 4.7 | Final technical decisions, approves/blocks merges |
587
+ | `security-engineer` | Opus 4.7 | OWASP audit, LGPD/GDPR, technical veto on high/critical |
588
+ | `architect` | Sonnet 4.6 | Architecture ADRs (DDD, Hexagonal, patterns) |
589
+ | `analyst` | Sonnet 4.6 | Produces `PLAN_*.md` with goal-ready DoD |
590
+ | `backend-developer` | Sonnet 4.6 | Java/Spring implementation (delegated by `sprint-runner`) |
591
+ | `database-engineer` | Sonnet 4.6 | Schema, index, migration, query perf |
592
+ | `qa-engineer` | Sonnet 4.6 | Writes tests (JUnit 5 + Mockito + Testcontainers) |
593
+ | `gate-keeper` | Sonnet 4.6 | Runs senior+ gate, validates thresholds |
594
+ | `code-reviewer` | Sonnet 4.6 | Initial PR review |
595
+ | `devops-engineer` | Sonnet 4.6 | Dockerfile, CI/CD, infra |
596
+ | `migrator` | Sonnet 4.6 | Java 8/11/17 → 25, Spring Boot 2/3 → 4 |
597
+ | `sprint-runner` | Sonnet 4.6 | Orchestrates the sprint, delegates in parallel |
598
+ | `brain-keeper` | Sonnet 4.6 | History in `docs/brain/` |
599
+ | `auditor` | Sonnet 4.6 | Audits `.claude/` consistency |
600
+ | `release-engineer` | Sonnet 4.6 | Version bump, CHANGELOG, tag |
601
+ | `scaffold` | Haiku 4.5 | Initial scaffold pipeline |
602
+
603
+ ### Autonomy Matrix — the master rule
604
+
605
+ Agents decide on their own. Asking the human is a rare exception. Summary:
606
+
607
+ - `product-owner` escalates to the human **only in 4 cases**: irreversible
608
+ action on customer data, relevant financial cost, breaking change in a
609
+ published public contract, identity/brand change.
610
+ - `tech-lead` escalates **only in 3 cases**: unresolvable technical
611
+ conflict, breaking change on a public contract in production, extra
612
+ infra > R$ 200/month.
613
+ - `security-engineer` holds **technical veto** on high/critical (OWASP) —
614
+ blocks merges without needing the human.
615
+ - Other agents **never** escalate to the human — they go up to PO (product)
616
+ or TL (technical).
617
+
618
+ ---
619
+
620
+ ## 5. Workflow 1 — Build a feature from scratch
621
+
622
+ Concrete example: implement `POST /api/v1/products` with JWT authentication
623
+ requiring the ADMIN role. I'll show every turn the way you'd really do it.
624
+
625
+ ### Turn 1 — Discovery
626
+
627
+ ```text
628
+ You:
629
+ grill me about creating POST /api/v1/products with JWT authentication
630
+
631
+ Claude (grill-me fires):
632
+ > Let's understand the goal. Should POST /products accept creation by any
633
+ > authenticated user or only the ADMIN role? I recommend restricting to
634
+ > ADMIN via @PreAuthorize. Confirm?
635
+ ```
636
+
637
+ ### Turn 2
638
+
639
+ ```text
640
+ You:
641
+ confirm ADMIN
642
+
643
+ Claude:
644
+ > Next: validation. Expected fields are name, price, stock. Acceptable
645
+ > price range? I recommend positive BigDecimal, max 9999999.99. Should
646
+ > name be unique per tenant? I recommend a DB-level unique constraint.
647
+ ```
648
+
649
+ ### Turn 3
650
+
651
+ ```text
652
+ You:
653
+ positive BigDecimal up to 9999999.99, name unique per tenant
654
+
655
+ Claude:
656
+ > Idempotency: can the client send the same POST twice? I recommend an
657
+ > Idempotency-Key header (UUID), 24h Redis store, returning the same
658
+ > response on the second hit. OK?
659
+ ```
660
+
661
+ ### Turns 4-9
662
+
663
+ It continues until the discovery covers: errors (ProblemDetail), success
664
+ metric, mandatory tests, observability (correlation ID), rate limit.
665
+ Around turn 10:
666
+
667
+ ```text
668
+ Claude:
669
+ > Persisted the discovery to docs/discovery/DISCOVERY_products-crud.md
670
+ > with 9 sections. Suggested next step: "generate PRD"
671
+ ```
672
+
673
+ ### Turn 11 — PRD
674
+
675
+ ```text
676
+ You:
677
+ generate PRD
678
+
679
+ Claude (to-prd):
680
+ > Created docs/prd/PRD_products-crud.md with 6 sections: Overview, Goals,
681
+ > User Stories, FR (8 items), NFR (latency, throughput, security), Out of
682
+ > scope. Next: "break into issues" or "analyst, produce the plan".
683
+ ```
684
+
685
+ ### Turn 12 — PLAN
686
+
687
+ ```text
688
+ You:
689
+ analyst, produce the plan
690
+
691
+ Claude (analyst):
692
+ > Produced docs/plans/PLAN_products-crud.md with 2 sprints, 6 tasks,
693
+ > goal-ready DoD per sprint. Sprint 1: schema + create + validation.
694
+ > Sprint 2: idempotency + rate limit + observability.
695
+ > To execute: "run sprint 1 of PLAN_products-crud.md"
696
+ ```
697
+
698
+ ### Turn 13 — Sprint execution
699
+
700
+ ```text
701
+ You:
702
+ run sprint 1 of PLAN_products-crud.md
703
+
704
+ Claude (run-sprint):
705
+ > [Sprint 1 — 3 tasks, TDD mode]
706
+ > [Task 1.1] Schema + Flyway migration
707
+ > ├─ database-engineer: V2__create_products.sql + index (name, tenant_id)
708
+ > ├─ qa-engineer: migration test via Testcontainers
709
+ > └─ gate-keeper: ✓
710
+ > [Task 1.2] DTO record + Bean Validation
711
+ > ├─ qa-engineer: failing ProductRequestTest
712
+ > ├─ backend-developer: ProductRequest record + @NotBlank + @Positive
713
+ > └─ gate-keeper: coverage 92% / mutation 78% / SpotBugs 0 ✓
714
+ > [Task 1.3] Controller + service + @PreAuthorize("hasRole('ADMIN')")
715
+ > ├─ qa-engineer: ProductControllerTest (201, 400, 403, 409)
716
+ > ├─ backend-developer: ProductController + ProductService
717
+ > └─ gate-keeper: coverage 89% / mutation 74% / SpotBugs 0 ✓
718
+ > Sprint 1 GREEN. Next: "run sprint 2" or "integration test"
719
+ ```
720
+
721
+ ### Turn 14 — Smoke
722
+
723
+ ```text
724
+ You:
725
+ integration test
726
+
727
+ Claude (api-integration-test):
728
+ > docker compose up -d (postgres + redis + backend) ...
729
+ > /actuator/health UP in 4.2s
730
+ > POST /api/v1/products with valid payload + ADMIN token → 201 ✓
731
+ > POST without token → 401 + ProblemDetail ✓
732
+ > POST with USER token → 403 + ProblemDetail ✓
733
+ > POST with duplicate name → 409 + ProblemDetail ✓
734
+ > POST with negative price → 400 + ProblemDetail (field "price") ✓
735
+ > Tear down. Integration OK.
736
+ ```
737
+
738
+ ### Turn 15 — Final gate
739
+
740
+ ```text
741
+ You:
742
+ ready for production?
743
+
744
+ Claude (prd-ready-check):
745
+ > Running ./mvnw clean verify, OWASP scan, E2E smoke, lint...
746
+ > Line coverage: 89% (>= 85%) ✓
747
+ > Branch coverage: 82% (>= 80%) ✓
748
+ > Mutation score: 74% (>= 70%) ✓
749
+ > SpotBugs: 0 CRITICAL, 0 HIGH ✓
750
+ > OWASP: 0 CVE CVSS >= 7.0 ✓
751
+ > Pyramid: 12% E2E (<= 30%) ✓
752
+ > VERDICT: GO ✓
753
+ ```
754
+
755
+ ### Turn 16 — History
756
+
757
+ ```text
758
+ You:
759
+ record in the brain
760
+
761
+ Claude (brain-keeper):
762
+ > Created:
763
+ > - docs/brain/daily/2026-05-27.md
764
+ > - docs/brain/features/products-crud.md
765
+ > - docs/brain/decisions/ADR-042-jwt-auth.md
766
+ > - docs/brain/architecture/tech-debt.md (updated)
767
+ > MOC regenerated.
768
+ ```
769
+
770
+ ---
771
+
772
+ ## 6. Workflow 2 — Debug a production bug
773
+
774
+ Scenario: mysterious 500 on `GET /api/v1/users`, only in production, does
775
+ not reproduce locally.
776
+
777
+ ```text
778
+ You:
779
+ let's debug this 500 on GET /api/v1/users in prod
780
+
781
+ Claude (pair-debug):
782
+ > Symptom: 500 on GET /api/v1/users only in prod.
783
+ > Known prod vs local diffs: prod has real data (10k users), local has 5.
784
+ > Prod connection pool 20, local 5.
785
+ > Hypothesis 1 (70% confidence): Lazy loading of User.roles fires outside
786
+ > a transaction in the controller. Locally every user has their roles
787
+ > already in the 2nd-level cache; in prod the cache mixes.
788
+ > Probe: grep "@Transactional" in UserService + UserController;
789
+ > grep "LazyInitializationException" in the last 24h of prod logs.
790
+ > Run probe? (yes/no)
791
+
792
+ You:
793
+ yes
794
+
795
+ Claude:
796
+ > Probe done.
797
+ > ✓ UserController.list() calls userService.findAll() returning List<User>.
798
+ > ✗ UserService.findAll() has NO @Transactional.
799
+ > ✗ User.roles is @OneToMany(fetch = LAZY).
800
+ > ✗ Prod logs: 47 LazyInitializationException in the last 24h, all on
801
+ > /api/v1/users.
802
+ > Hypothesis 1 CONFIRMED with 99% confidence.
803
+ >
804
+ > Proposed fix (option A — smaller blast radius):
805
+ > 1. Add @Transactional(readOnly=true) to UserService.findAll().
806
+ > 2. Map to UserResponse (record DTO) inside the transaction.
807
+ > 3. Controller only serializes the DTO — User never leaks.
808
+ >
809
+ > Proposed fix (option B — only if A doesn't cover):
810
+ > Eager fetch of roles via @EntityGraph.
811
+ >
812
+ > I recommend A — decouples the web layer from the entity.
813
+ > Dispatching backend-developer for A + qa-engineer for regression test
814
+ > (List<User> without a transaction must fail with LazyInitException).
815
+ ```
816
+
817
+ ---
818
+
819
+ ## 7. Workflow 3 — Spring Boot 2/3 → 4 migration
820
+
821
+ ```text
822
+ You:
823
+ migrate this project from Spring Boot 2.7 to 4.0
824
+
825
+ Claude (migrator):
826
+ > Phase 1 — Assessment (read-only)
827
+ > Catalogued: 23 removed APIs, 5 deprecated, 8 config changes.
828
+ > Generating MIGRATION-2.7-to-4.0.md at project root.
829
+ > Estimate: 2-3 dev days + 1 test day.
830
+ >
831
+ > Phase 2 — Quick wins (non-breaking)
832
+ > - List.of() where Arrays.asList()
833
+ > - Optional.orElseThrow() where .get()
834
+ > - records where the DTO is purely immutable
835
+ > - Pattern matching in switch
836
+ > Estimate: 2h.
837
+ >
838
+ > Phase 3 — Breaking changes (explicit ADR per major)
839
+ > 3.1 javax.* → jakarta.* (Spring Boot 3)
840
+ > 3.2 WebSecurityConfigurerAdapter → SecurityFilterChain
841
+ > 3.3 RestTemplate → RestClient (Spring Boot 4)
842
+ > 3.4 application.properties → ConfigData reorg
843
+ > Each item becomes an ADR in docs/decisions/.
844
+ >
845
+ > Phase 4 — Validation gate
846
+ > mvn verify GREEN at end of each phase, regression mandatory.
847
+ >
848
+ > Prerequisite: gate-keeper must establish a green baseline first. Run
849
+ > baseline now? (yes/no)
850
+ ```
851
+
852
+ ---
853
+
854
+ ## 8. Workflow 4 — Adopting an existing project
855
+
856
+ Three scenarios, three flows.
857
+
858
+ ### Case 1 — I'm already inside the folder
859
+
860
+ ```bash
861
+ cd C:\my-legacy-project
862
+ duk install # idempotent, takes automatic backup
863
+ # Edit CLAUDE.md > Project Identity
864
+ ```
865
+
866
+ ### Case 2 — Activate by path (non-interactive)
867
+
868
+ In any terminal with Cowork/Claude Code open, in chat:
869
+
870
+ ```text
871
+ /active-project C:\my-legacy-project
872
+ ```
873
+
874
+ ### Case 3 — Update template in an adopted project
875
+
876
+ ```bash
877
+ duk install # re-injects current harness version
878
+ ```
879
+
880
+ Or in chat:
881
+
882
+ ```text
883
+ update the template
884
+ ```
885
+
886
+ The `Project Identity` section of the project's `CLAUDE.md` is
887
+ **preserved** in the merge; the other sections are overwritten with the
888
+ latest harness version.
889
+
890
+ ---
891
+
892
+ ## 9. Cheat sheet — triggers by intent
893
+
894
+ | I want to... | Type in chat |
895
+ |---|---|
896
+ | Start a new project | `scaffold the backend` |
897
+ | Feature discovery | `grill me about <X>` |
898
+ | Generate PRD | `generate PRD` |
899
+ | Break into issues | `break into issues` |
900
+ | Generate technical plan | `analyst, produce the plan from the PRD` |
901
+ | Execute a sprint | `run sprint <N> of PLAN_<NAME>.md` |
902
+ | Run tests / gate | `run the tests` or `full suite` |
903
+ | Smoke integration | `integration test` |
904
+ | Final production gate | `ready for production?` |
905
+ | Debug a non-obvious bug | `let's debug <X>` |
906
+ | Record history | `record in the brain` |
907
+ | Coverage audit | `audit the tests` |
908
+ | Technical decision | `tech-lead, decide between <A> and <B>` |
909
+ | Security audit | `security audit` |
910
+ | Model the DB | `model the database for <X>` |
911
+ | Dockerize | `dockerize the backend` |
912
+ | Migrate version | `migrate from Spring Boot 2.7 to 4.0` |
913
+ | Save a memory | `remember that <fact>` |
914
+ | Telegraphic style | `caveman ultra` |
915
+ | Back to normal | `stop caveman` |
916
+ | Update template | `update the template` |
917
+ | Activate project by path | `/active-project <path>` |
918
+
919
+ ---
920
+
921
+ ## 10. Decision tree — which skill to use
922
+
923
+ ```
924
+ You have... Use...
925
+ ───────────────────────────────── ──────────────────────────────────
926
+ Empty folder (new project) scaffold the backend
927
+ Legacy project, first adoption duk install + edit CLAUDE.md
928
+ Legacy project at a known path /active-project <path>
929
+ Vague feature idea grill me about <X>
930
+ DISCOVERY done, missing PRD generate PRD
931
+ PRD done, want issues break into issues
932
+ PRD done, want technical PLAN analyst, produce the plan
933
+ PLAN with sprints defined run sprint <N>
934
+ Task implemented, want gate run the tests
935
+ Sprint complete integration test
936
+ Everything green, before release ready for production?
937
+ Obscure/intermittent bug let's debug <X>
938
+ Obsolete stack version migrate from <X> to <Y>
939
+ Save a preference remember that <X>
940
+ Sprint history record in the brain
941
+ Sync with updated harness update the template
942
+ Conflict between 2 technical approaches tech-lead, decide between <A> and <B>
943
+ Security vuln suspicion security audit
944
+ Don't know which skill fits just type the request — project-manager catches it
945
+ ```
946
+
947
+ ---
948
+
949
+ ## 11. Minimal `CLAUDE.md` configuration
950
+
951
+ This is the section you edit. **Don't touch the rest** — `update-template`
952
+ overwrites everything except this.
953
+
954
+ ```markdown
955
+ ## Project Identity
956
+
957
+ - **Project name**: `my-backend-api`
958
+ - **Project type**: `backend`
959
+ - **Primary stack**: `Java 25 + Spring Boot 4`
960
+ - **Database**: `PostgreSQL 17 + Redis 7`
961
+ - **Domain**: `e-commerce`
962
+ - **Team size**: `3 backend`
963
+ - **Additional rules**: _(leave empty if none)_
964
+ ```
965
+
966
+ Tips:
967
+
968
+ - `Project type: backend` unlocks `bootstrap-backend-java`.
969
+ For mobile/frontend/fullstack, adjust and use the matching bootstrap.
970
+ - `Primary stack` must mention `Java <N>` so the scaffold picks the right
971
+ JDK.
972
+ - `Database` is used by `database-engineer` to choose dialect and
973
+ Testcontainer image.
974
+ - `Additional rules` accepts free text — things like "SOX audit
975
+ mandatory", "deploy only in the 22h-04h window", etc.
976
+
977
+ ---
978
+
979
+ ## 12. Antipatterns — what NOT to do
980
+
981
+ | ❌ Wrong | ✓ Right |
982
+ |---|---|
983
+ | `duk project-manager "create endpoint"` | type `create endpoint POST /products` in chat |
984
+ | `duk grill-me` | type `grill me about <X>` in chat |
985
+ | Skipping `grill-me` and going straight to `analyst` (human path) | always go through discovery |
986
+ | Forcing an implementation while ignoring `gate-keeper` | wait for the gate to pass before moving on |
987
+ | Commit with `Co-Authored-By: Claude` | commit as a human author (CLAUDE.md forbids it) |
988
+ | Mentioning Claude/AI/LLM in commit subject/body | Conventional Commit, no trace of AI |
989
+ | `@Entity` exposed in controller | always a record DTO (separate req/res) |
990
+ | H2 in tests | `Testcontainers` with real Postgres |
991
+ | `// TODO` in committed code | `docs/brain/architecture/tech-debt.md` |
992
+ | Hardcoded credentials | `C:\development\tools\credentials\vps.txt` |
993
+ | `var` in a public method signature/return | explicit type |
994
+ | Inline `@Transactional` floating in a controller | service method with `@Transactional(readOnly=true)` |
995
+ | `permitAll()` in prod | RBAC with `@PreAuthorize` + CORS per domain |
996
+ | Log of token/PII/password | never log it — `security-engineer` vetoes |
997
+ | Flyway migration without index | index in the same `V<N>__*.sql` that creates the FK |
998
+
999
+ ---
1000
+
1001
+ ## 13. Backend troubleshooting
1002
+
1003
+ | Symptom | Likely cause | Fix |
1004
+ |---|---|---|
1005
+ | `Address already in use: 8080` | Previous app hung | `netstat -ano | findstr :8080` + `taskkill /PID <pid> /F` |
1006
+ | `java: invalid target release: 25` | Wrong JDK on PATH | `sdk use java 25.0.0-tem` or fix `JAVA_HOME` |
1007
+ | `Flyway: Found non-empty schema(s)` | Local DB dirty from a previous test | `docker compose down -v && docker compose up -d` |
1008
+ | `Flyway lock not released` | Aborted migration | `UPDATE flyway_schema_history SET success=true WHERE installed_rank=<n>` or drop schema |
1009
+ | CORS blocks the frontend call | `permitAll()` or origin not listed | configure `addAllowedOriginPattern` in `WebMvcConfigurer` |
1010
+ | Secret committed by mistake | `application.yml` with real password | rebase + `git filter-repo` + rotate credential |
1011
+ | `sprint-runner` doesn't delegate | PLAN without goal-ready DoD | re-run `analyst` with a valid DISCOVERY |
1012
+ | `gate-keeper` fails on coverage | JaCoCo not configured in pom | check `jacoco-maven-plugin` + `prepare-agent` goal |
1013
+ | Mutation score < 70% | Tests only check getters/setters | write business-rule tests in `domain/` |
1014
+ | OWASP fails with CVE ≥ 7.0 | Vulnerable dependency | bump the version; if unfeasible, acceptance ADR signed by `security-engineer` |
1015
+ | `Testcontainers` slow on the first run | postgres image not cached | `docker pull postgres:17` ahead of time |
1016
+ | 401 on an endpoint that should be public | Too-generic SecurityFilterChain | explicit `requestMatchers("/api/v1/public/**").permitAll()` |
1017
+ | `LazyInitializationException` in production | Missing `@Transactional` | add `@Transactional(readOnly=true)` in the query service |
1018
+ | Local build OK, CI fails | Plugin pinned to incompatible version | check `pom.xml` against the CI matrix |
1019
+
1020
+ ---
1021
+
1022
+ ## 15. Active hooks (summary)
1023
+
1024
+ The `.claude/settings.json` installed by `duk install` activates four hooks
1025
+ that run automatically:
1026
+
1027
+ - **UserPromptSubmit** — runs at prompt submit
1028
+ of every prompt so agents respect preferences without repetition.
1029
+ - **PreToolUse `Bash`** — blocks commands that delete test files
1030
+ (`rm src/test/...`, etc.). Hard fail.
1031
+ - **PostToolUse `Write`** — runs Prettier on freshly-written `.json`/`.md`
1032
+ files and injects a "write the matching test" reminder.
1033
+ - **Stop** — at the end of each turn, saves a project-context summary to
1034
+
1035
+
1036
+ Details: [Hooks reference](../docs/hooks-reference).
1037
+
1038
+ ---
1039
+
1040
+ ## 16. Quick glossary
1041
+
1042
+ | Term | Short definition |
1043
+ |---|---|
1044
+ | Skill | `.claude/skills/<name>/SKILL.md` file. Entry point by keyword. |
1045
+ | Agent | `.claude/agents/<name>.md` file. Executor invoked by a skill via the Task tool. |
1046
+ | Task tool | Claude Code built-in. Skills use it to delegate to agents. |
1047
+ | DISCOVERY | `docs/discovery/DISCOVERY_<X>.md`, output of `grill-me`. |
1048
+ | PRD | `docs/prd/PRD_<X>.md`, product document. Output of `to-prd`. |
1049
+ | ISSUES | `docs/issues/ISSUES_<X>.md`. Output of `to-issues`. |
1050
+ | PLAN | `docs/plans/PLAN_<X>.md`. Technical plan with sprints and goal-ready DoD. |
1051
+ | ADR | `docs/decisions/ADR-NNN-<slug>.md`. Recorded technical decision. |
1052
+ | Goal-ready DoD | Definition of Done expressed as a verifiable objective (not a checklist). |
1053
+ | Senior+ gate | Set of thresholds in `auto-test-guard` + `gate-keeper`