@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,848 @@
1
+ # Manual — Adopting an existing project
2
+
3
+ > Picked up a legacy repo? Got an old Java/Spring/Angular codebase and want the
4
+ > development-utility-kit harness without rewriting anything? This manual is for
5
+ > you. Covers initial adoption, debt audit, safe first feature, stack migration,
6
+ > and recurring template updates — without breaking production.
7
+
8
+ ## 1. Introduction
9
+
10
+ **For whom**: dev who inherited a legacy project (Java 8/11/17 + Spring Boot
11
+ 2/3, Angular 14/15/16, RN 0.70+) and wants to adopt the `development-utility-kit`
12
+ harness to get agents/skills, senior+ gate, brain-keeper
13
+ running.
14
+
15
+ **What this manual covers**:
16
+
17
+ - Installing the harness on a project WITHOUT `.claude/`
18
+ - Updating a project that ALREADY has `.claude/` (idempotent)
19
+ - Batch adoption (multiple projects via `/active-project`)
20
+ - Initial audit: structure, coverage, debt
21
+ - First feature on a legacy codebase with a GREEN baseline
22
+ - Stack migration (Java/Spring/Angular major versions)
23
+ - Recurring template update when the plugin evolves
24
+ - Antipatterns, troubleshooting, glossary
25
+
26
+ **Prerequisites**:
27
+
28
+ - Git installed, clean repository (commit or stash pending changes first)
29
+ - Node.js >= 18 (for `npx @eltonssouza/development-utility-kit install`)
30
+ - Cowork connected OR Claude Code CLI installed
31
+ - Dedicated branch (`git checkout -b chore/adopt-harness` before touching anything)
32
+ - Read/write access on the project directory
33
+
34
+ **What's NOT here**: scaffolding a new project (use `backend.en.md`,
35
+ `frontend.en.md`, `fullstack.en.md`, `mobile.en.md`). This manual is legacy only.
36
+
37
+ ## 2. 5-min onboarding — project WITHOUT `.claude/`
38
+
39
+ Scenario: you cloned a legacy repo and want to plug in the harness for the first
40
+ time.
41
+
42
+ ### 2.1 Preparation
43
+
44
+ ```bash
45
+ cd C:\my-legacy-project
46
+
47
+ # Confirm clean branch — installer does NOT touch dirty files
48
+ git status
49
+
50
+ # Dedicated branch for adoption (NEVER run on main/develop directly)
51
+ git checkout -b chore/adopt-harness
52
+ ```
53
+
54
+ ### 2.2 Install via npx (recommended)
55
+
56
+ ```bash
57
+ npx @eltonssouza/development-utility-kit install
58
+ ```
59
+
60
+ Expected output:
61
+
62
+ ```text
63
+ > development-utility-kit install
64
+ > Detecting project type...
65
+ ✓ Detected type: fullstack (backend/pom.xml + frontend/angular.json)
66
+ ✓ Backup created at .claude.backup-2026-05-27T14-32-18/ (if .claude already existed)
67
+ ✓ .claude/agents/ — 25 agents installed
68
+ ✓ .claude/skills/ — 18 skills installed
69
+ ✓ .claude/settings.json — hooks configured
70
+ ✓ CLAUDE.md — generated/merged preserving Project Identity
71
+ ✓ docs/brain/ — provisioned if absent
72
+ ✓ Install completed in 3.2s
73
+
74
+ Next step: edit CLAUDE.md → ## Project Identity with the REAL current state of the project.
75
+ ```
76
+
77
+ ### 2.3 Install via global binary
78
+
79
+ If you've already run `npx @eltonssouza/development-utility-kit install` on the
80
+ host and have `duk` on PATH:
81
+
82
+ ```bash
83
+ cd C:\my-legacy-project
84
+ duk install
85
+ ```
86
+
87
+ `duk install` and `duk update` are aliases — same behavior. Use whichever you
88
+ prefer; `update` makes it explicit you're re-injecting on a project that
89
+ already has the harness.
90
+
91
+ ### 2.4 Preview without writing
92
+
93
+ ```bash
94
+ duk install --dry-run
95
+ ```
96
+
97
+ Prints what WOULD be written without touching any file. Use this on sensitive
98
+ projects before adopting.
99
+
100
+ ### 2.5 Subfolder (monorepo)
101
+
102
+ If the fullstack project lives in a subdirectory:
103
+
104
+ ```bash
105
+ cd C:\my-monorepo
106
+ duk install --sub backend
107
+ duk install --sub frontend
108
+ ```
109
+
110
+ Each subfolder gets its own `.claude/` + `CLAUDE.md`, with isolated
111
+ `Project Identity`.
112
+
113
+ ### 2.6 Edit `CLAUDE.md → Project Identity`
114
+
115
+ The template injects a `## Project Identity` section with placeholders. Replace
116
+ them with the REAL state of the project (not the desired state):
117
+
118
+ ```markdown
119
+ ## Project Identity
120
+
121
+ - **Project name**: `legacy-erp`
122
+ - **Project type**: `fullstack`
123
+ - **Primary stack**: `Java 11 + Spring Boot 2.7 + Angular 14`
124
+ - **Database**: `Oracle 19c + Redis 6`
125
+ - **Domain**: `Financial ERP`
126
+ - **Team size**: `5 backend, 2 frontend`
127
+ - **Additional rules**: |
128
+ - JUnit 4 in use (JUnit 5 migration tracked in ADR-031)
129
+ - H2 in legacy tests
130
+ - Modernization to Java 25 + SB 4 in backlog (ADR-040)
131
+ ```
132
+
133
+ ### 2.7 Bring up the dashboard (optional)
134
+
135
+ ```bash
136
+ duk dashboard
137
+ ```
138
+
139
+ Opens `http://localhost:4242` with manuals, agents, skills, and ADRs of the
140
+ harness for offline reference.
141
+
142
+ ### 2.8 Open Cowork or Claude Code
143
+
144
+ From here the chat has access to all agents/skills. Recommended first prompt:
145
+
146
+ ```text
147
+ auditor compares .claude structure with official template
148
+ ```
149
+
150
+ Confirms the install came out clean.
151
+
152
+ ## 3. Onboarding — project ALREADY HAS `.claude/`
153
+
154
+ Scenario: the repo was adopted before (by you or another dev) and you want to
155
+ update.
156
+
157
+ ### 3.1 Update via CLI (idempotent)
158
+
159
+ ```bash
160
+ cd C:\my-legacy-project
161
+ git checkout -b chore/update-harness
162
+ duk install
163
+ ```
164
+
165
+ The installer:
166
+
167
+ - Detects existing `.claude/`
168
+ - Creates backup at `.claude.backup-<timestamp>/`
169
+ - Overwrites `agents/`, `skills/`, `settings.json` with current version
170
+ - MERGES `CLAUDE.md`: preserves `## Project Identity`, overwrites other
171
+ sections with the new plugin version
172
+ - Prints summary diff
173
+
174
+ ### 3.2 Update via chat
175
+
176
+ ```text
177
+ > "update the template"
178
+ ```
179
+
180
+ Triggers the `update-template` agent (model: haiku, it's mechanical). Same
181
+ effect as `duk install`, but you watch it via chat.
182
+
183
+ ### 3.3 Sync with development-utility-kit
184
+
185
+ ```text
186
+ > "sync with development-utility-kit"
187
+ > "bring in the new skills"
188
+ ```
189
+
190
+ Same triggers as `update-template`. Use whichever vocabulary feels natural.
191
+
192
+ ## 4. Batch adoption — multiple projects
193
+
194
+ If you have 5+ legacy repos and want to adopt them all without entering each:
195
+
196
+ ```text
197
+ /active-project C:/projects/legacy-1
198
+ /active-project C:/projects/legacy-2 --force-type=backend
199
+ /active-project C:/projects/legacy-3 --template=C:/development/tools/development-utility-kit
200
+ /active-project C:/projects/legacy-4 --dry-run
201
+ ```
202
+
203
+ ### 4.1 `/active-project` flags
204
+
205
+ - `--dry-run` — preview, writes nothing
206
+ - `--force-type=<backend|frontend|fullstack|mobile>` — force type when
207
+ auto-detect gets it wrong (e.g. backend with `package.json` for build tools
208
+ but actually Java)
209
+ - `--template=<path>` — use an alternate template path (local forks, pending
210
+ upstream fix)
211
+ - `--skip-brain` — don't provision `docs/brain/`
212
+
213
+ ### 4.2 Fast-lane vs interactive
214
+
215
+ | Skill | Mode | When to use |
216
+ |---|---|---|
217
+ | `active-project` | Non-interactive, path-driven | Batch, multiple projects, CI |
218
+ | `update-template` | Interactive, prompt-driven | Single project, manual validation |
219
+ | `duk install` (CLI) | Non-interactive, CWD-driven | Local, first contact |
220
+
221
+ All three converge on the same result: `.claude/` + `CLAUDE.md` at the current
222
+ version.
223
+
224
+ ## 5. Workflow 1 — Initial audit (day 1)
225
+
226
+ You just installed the harness. Before touching code, audit the state.
227
+
228
+ ### Turn 1 — compare with official template
229
+
230
+ ```text
231
+ You:
232
+ auditor compares .claude structure with official template
233
+
234
+ Claude (auditor):
235
+ > Diff vs template development-utility-kit v5.18.0:
236
+ > .claude/agents/: 25 agents, all up to date ✓
237
+ > .claude/skills/: 18 skills, 1 outdated:
238
+ > - auto-test-guard V5.13 (current V5.18) — pyramid ratio gate missing
239
+ > CLAUDE.md: Project Identity OK ✓
240
+ > docs/brain/: structure missing
241
+ > .claude/settings.json: custom PostToolUse hook preserved
242
+ > Recommend: "update the template" for skill sync, then "register in the brain"
243
+ > to provision docs/brain/.
244
+ ```
245
+
246
+ ### Turn 2 — audit tests
247
+
248
+ ```text
249
+ You:
250
+ audit the tests
251
+
252
+ Claude (test-coverage-auditor):
253
+ > Backend src/main/java/: 187 classes, 142 with tests (76%)
254
+ > Frontend src/app/: 87 .ts, 51 with .spec.ts (59%)
255
+ > JaCoCo: 71% lines (below 85% threshold)
256
+ > JaCoCo branches: 64% (below 80%)
257
+ > PIT mutation: not configured (gate requires 70% in domain/application)
258
+ >
259
+ > P0 (business rule without test): 3 use cases
260
+ > - PaymentUseCase.calculateTax — 4 branches, 0 tests
261
+ > - OrderUseCase.applyDiscount — 6 branches, 0 tests
262
+ > - InventoryUseCase.reserve — 8 branches, 0 tests
263
+ > P1 (partial, edges missing): 8 classes
264
+ > P2 (utility, low criticality): 23 classes
265
+ > P3 (DTO/config): 12 classes
266
+ >
267
+ > Verdict PRD-ready: NO-GO.
268
+ > Full report in docs/brain/architecture/tech-debt.md
269
+ ```
270
+
271
+ ### Turn 3 — prioritize
272
+
273
+ ```text
274
+ You:
275
+ tech-lead prioritizes P0/P1 and creates ADR for debt payment
276
+
277
+ Claude (tech-lead):
278
+ > Plan:
279
+ > 1. P0 PaymentUseCase — 2 days (estimated by @qa-engineer)
280
+ > 2. P0 OrderUseCase — 1 day
281
+ > 3. P0 InventoryUseCase — 1 day
282
+ > 4. P1 (8 classes) — 1 week, parallelizable by sub-team
283
+ > 5. P2 — backlog, pay along with features that touch the code
284
+ >
285
+ > ADR-040 created in docs/adr/ADR-040-coverage-debt-payment.md:
286
+ > - Context: RED gate blocks new features
287
+ > - Decision: pay P0+P1 in a dedicated sprint before release
288
+ > - Consequences: 2 weeks without new features, GREEN gate in 14 days
289
+ >
290
+ > Sprint 0 (debt-payment) created in docs/sprints/SPRINT-0.md.
291
+ > Recommend: "run sprint 0" to start.
292
+ ```
293
+
294
+ ### Turn 4 — provision vault
295
+
296
+ ```text
297
+ You:
298
+ register in the brain
299
+
300
+ Claude (brain-keeper):
301
+ > docs/brain/ provisioned:
302
+ > ├── MOC.md (map of content)
303
+ > ├── architecture/
304
+ > │ ├── tech-debt.md (auditor report)
305
+ > │ └── decisions.md (ADR index)
306
+ > ├── features/
307
+ > ├── daily/2026-05-27.md
308
+ > └── .obsidian/ (color snippet, initial config)
309
+ > Vault ready for Obsidian. Open with File > Open Folder.
310
+ ```
311
+
312
+ ### Turn 5 — memorize context
313
+
314
+ ```text
315
+ You:
316
+ remember that the project is on Java 11 + Spring Boot 2.7, modernization to
317
+ Java 25 + SB 4 planned for Q3. JUnit 4 still in 23 tests.
318
+
319
+ ```
320
+
321
+ ## 6. Workflow 2 — First feature on legacy
322
+
323
+ Rule: never start a feature on a project with a RED gate. The harness protects you.
324
+
325
+ ### Turn 1 — request
326
+
327
+ ```text
328
+ You:
329
+ grill me about adding CSV export of sales
330
+
331
+ Claude (grill-me):
332
+ > Before starting the discovery interview: is gate-keeper GREEN on the current
333
+ > project state? Without a green baseline, adding a feature on top of debt is
334
+ > stacking liability.
335
+ > Run "run the tests" first to validate.
336
+ ```
337
+
338
+ ### Turn 2 — validate baseline
339
+
340
+ ```text
341
+ You:
342
+ run the tests
343
+
344
+ Claude (gate-keeper):
345
+ > Full suite:
346
+ > mvn verify ......................... FAIL (3 tests RED after develop merge)
347
+ > Backend coverage ................... 71% (below 85%)
348
+ > PIT mutation ....................... not configured
349
+ > SpotBugs ........................... 2 HIGH
350
+ > Frontend coverage .................. 59%
351
+ > ESLint ............................. 14 warnings
352
+ > Playwright ......................... PASS
353
+ >
354
+ > Verdict: RED. Don't start a new feature. Recommend:
355
+ > 1. "tech-lead diagnoses the 3 red tests"
356
+ > 2. "gate-keeper generates tests for P0 of tech-debt.md"
357
+ > 3. Then: feature.
358
+ ```
359
+
360
+ ### Turn 3 — pay debt first
361
+
362
+ ```text
363
+ You:
364
+ gate-keeper generate tests for the 3 P0 from tech-debt.md
365
+
366
+ Claude:
367
+ > Dispatch in parallel:
368
+ > - qa-engineer → PaymentUseCase (18 tests, branches + edge cases)
369
+ > - qa-engineer → OrderUseCase (24 tests)
370
+ > - qa-engineer → InventoryUseCase (32 tests)
371
+ > Total: 74 new tests in domain/application.
372
+ >
373
+ > Re-run of the gate:
374
+ > JaCoCo lines ................... 86% ✓
375
+ > JaCoCo branches ................ 81% ✓
376
+ > PIT mutation (configured) ...... 71% ✓
377
+ > SpotBugs ....................... 0 HIGH ✓
378
+ > Frontend ....................... 59% (still below, P1 backlog)
379
+ >
380
+ > Verdict: GREEN on backend. Frontend still P1 but does not block backend
381
+ > feature. You can proceed.
382
+ ```
383
+
384
+ ### Turn 4 — normal discovery
385
+
386
+ ```text
387
+ You:
388
+ now grill me about adding CSV export of sales
389
+
390
+ Claude (grill-me):
391
+ > Discovery interview, 10-15 turns. Question 1/N:
392
+ > What's the definition of "sale" in the export context? Order completed?
393
+ > Order shipped? Order with confirmed payment? Each changes the SQL filter.
394
+ > ...
395
+ > [full interview]
396
+ > Output: docs/discovery/DISCOVERY-csv-export-sales.md
397
+ ```
398
+
399
+ From here the flow is standard (analyst → architect → sprint-runner →
400
+ gate-keeper → code-reviewer → tech-lead). See `pipeline.en.md` for details.
401
+
402
+ ## 7. Workflow 3 — Stack migration (migrator)
403
+
404
+ Full example: Java 11 + Spring Boot 2.7 → Java 25 + Spring Boot 4.0.
405
+
406
+ ### Turn 1 — request
407
+
408
+ ```text
409
+ You:
410
+ migrate this project from Java 11 + Spring Boot 2.7 to Java 25 + Spring Boot 4
411
+
412
+ Claude (migrator):
413
+ > Mandatory prerequisite: gate-keeper GREEN baseline. A major migration on a
414
+ > project with RED tests or coverage below threshold = Russian roulette.
415
+ > Confirm gate-keeper returned GREEN in the last 24h? (yes/no)
416
+ ```
417
+
418
+ ### Turn 2 — confirmation
419
+
420
+ ```text
421
+ You:
422
+ yes, ran it yesterday and came back GREEN
423
+
424
+ Claude (migrator):
425
+ > Plan in 4 phases. Each phase ends with gate-keeper validation.
426
+ >
427
+ > Phase 1 — Assessment (read-only, 1 day)
428
+ > Generates docs/migrations/MIGRATION-java11-springboot2.7-to-java25-springboot4.md
429
+ > - 47 removed APIs in use (List.of, var inference, switch expressions)
430
+ > - 12 deprecated APIs (RestTemplate → RestClient, WebSecurityConfigurerAdapter)
431
+ > - 8 application.yml changes (jakarta.* namespace, renamed properties)
432
+ > - 5 dependencies without Spring Boot 4 compatible version
433
+ > - hibernate-core 5.6 → 6.5
434
+ > - lombok 1.18.20 → 1.18.32
435
+ > - mapstruct 1.4 → 1.6
436
+ > - testcontainers 1.16 → 1.20
437
+ > - mockito 3.12 → 5.14
438
+ > - 23 JUnit 4 tests (migrate to JUnit 5 in parallel)
439
+ >
440
+ > Phase 2 — Quick wins non-breaking (1 day)
441
+ > ✓ List.of() / Map.of() where applicable
442
+ > ✓ Optional.orElseThrow()
443
+ > ✓ Records where DTOs became immutable
444
+ > ✓ Pattern matching for instanceof
445
+ > gate-keeper validation: GREEN ✓
446
+ >
447
+ > Phase 3 — Breaking changes (4-6 days, ADR per major cross)
448
+ > ADR-041: Java 11 → 17 LTS (text blocks, sealed classes)
449
+ > ADR-042: Java 17 → 21 LTS (virtual threads, sequenced collections)
450
+ > ADR-043: Java 21 → 25 (stream gatherers, scoped values stable)
451
+ > ADR-044: Spring Boot 2.7 → 3.0 (jakarta.* migration — highest risk)
452
+ > ADR-045: 3.0 → 3.2 (optional Native Image)
453
+ > ADR-046: 3.2 → 4.0 (SecurityFilterChain, RestClient, ProblemDetail RFC 9457)
454
+ > gate-keeper validation: GREEN on EACH cross ✓
455
+ >
456
+ > Phase 4 — Final validation (1 day)
457
+ > mvn verify ...................... ✓
458
+ > PIT mutation .................... 74% ✓
459
+ > SpotBugs ........................ 0 HIGH ✓
460
+ > OWASP DC ........................ 0 CVE CVSS ≥ 7.0 ✓
461
+ > Smoke test in staging ........... 48h mandatory
462
+ >
463
+ > Total estimate: 7-9 working days. PR per phase (6 PRs total). Rollback plan:
464
+ > revert phase PR + controlled downgrade via maven profile.
465
+ >
466
+ > Confirm kickoff? (yes for Phase 1 / no to abort)
467
+ ```
468
+
469
+ ### Turn 3 — execution
470
+
471
+ ```text
472
+ You:
473
+ yes
474
+
475
+ Claude (migrator):
476
+ > Phase 1 started. Output in docs/migrations/MIGRATION-*.md in ~10 minutes.
477
+ > Next expected prompt: "phase 2" after you review the assessment.
478
+ ```
479
+
480
+ ### Why one ADR per major cross?
481
+
482
+ Each major jump (Java 11→17→21→25, SB 2.7→3.0→3.2→4.0) has its own trade-offs:
483
+ deps, breaking changes, lib velocity. A single ADR "migrate from X to Y" loses
484
+ traceability. One ADR per cross keeps the decision history clear and enables
485
+ granular rollback.
486
+
487
+ ## 8. Workflow 4 — Recurring debt audit
488
+
489
+ Audit isn't a one-time event. Run quarterly or after long sprints.
490
+
491
+ ```text
492
+ You:
493
+ audit coverage and update tech-debt.md
494
+
495
+ Claude (test-coverage-auditor):
496
+ > Comparison with previous audit (2026-04-01):
497
+ > JaCoCo lines coverage ............ 71% → 86% ✓
498
+ > JaCoCo branches coverage ......... 64% → 81% ✓
499
+ > PIT mutation ..................... not configured → 74% ✓
500
+ > Frontend coverage ................ 59% → 68% (P1 still open)
501
+ >
502
+ > P0 closed ........................ 3 → 0 ✓
503
+ > P1 closed ........................ 8 → 2 (6 paid)
504
+ > P2 closed ........................ 23 → 19 (4 paid via feature work)
505
+ > P3 ............................... 12 → 12 (unchanged)
506
+ >
507
+ > New P0 ........................... 0 ✓
508
+ > New P1 ........................... 1
509
+ > - ExportCsvUseCase.streamLargeBatch: >100k rows edge case untested
510
+ >
511
+ > Verdict PRD-ready: GO.
512
+ >
513
+ > docs/brain/architecture/tech-debt.md updated.
514
+ > docs/brain/daily/2026-05-27.md got the audit entry.
515
+ ```
516
+
517
+ ## 9. Workflow 5 — Recurring template update
518
+
519
+ When the `development-utility-kit` plugin evolves (new agent, skill, base ADR),
520
+ you'll want to pull it into your project.
521
+
522
+ ### Via CLI
523
+
524
+ ```bash
525
+ cd C:\my-project
526
+ git checkout -b chore/update-harness-2026-05
527
+ duk install
528
+ ```
529
+
530
+ Output:
531
+
532
+ ```text
533
+ ✓ Backup: .claude.backup-2026-05-27T15-12-04/
534
+ ✓ 2 skills updated (auto-test-guard, brain-keeper)
535
+ ✓ 1 new agent (release-engineer-v2)
536
+ ✓ settings.json overwritten (3 new hooks)
537
+ ✓ CLAUDE.md merged — Project Identity preserved
538
+ ✓ docs/brain/ untouched (history is never overwritten)
539
+ ```
540
+
541
+ ### Via chat
542
+
543
+ ```text
544
+ > "update the template"
545
+ > "sync with development-utility-kit"
546
+ > "bring in the new skills"
547
+ ```
548
+
549
+ All trigger the `update-template` agent (haiku). Result identical to CLI.
550
+
551
+ ### Update policy
552
+
553
+ - Update on demand, not by habit
554
+ - ALWAYS on a dedicated branch (`chore/update-harness-<date>`)
555
+ - Review diff in `.claude/settings.json` (hooks can change behavior)
556
+ - Confirm `## Project Identity` in `CLAUDE.md` is intact
557
+ - Run `auditor` afterwards to validate
558
+ - Test 1-2 critical skills before merge (`audit the tests`, `run the tests`)
559
+ - Keep `.claude.backup-*` backup for 7 days before removing
560
+
561
+ ## 10. Cheat sheet — triggers for existing projects
562
+
563
+ | I want to... | Type |
564
+ |---|---|
565
+ | Adopt project without .claude/ | `duk install` (terminal) OR `/active-project <path>` (chat) |
566
+ | Update template | `duk install` (terminal) OR `update the template` (chat) |
567
+ | Compare with official template | `auditor compares .claude structure with official template` |
568
+ | Audit coverage | `audit the tests` |
569
+ | Prioritize debt | `tech-lead prioritizes P0/P1` |
570
+ | Generate missing tests | `gate-keeper generates tests for P0` |
571
+ | Migrate Spring 2/3 → 4 | `migrate from Spring Boot <X> to 4` |
572
+ | Migrate legacy Java | `migrate Java <X> to 25` |
573
+ | Migrate Angular 14-20 → 21 | `migrate Angular <X> to 21` |
574
+ | First feature on legacy | `run the tests` → `grill me about <X>` |
575
+ | Bug on legacy | `let's debug <X>` |
576
+ | PRD-ready check | `is this ready for production?` |
577
+ | Batch adoption | `/active-project <path>` repeated |
578
+ | Remember state | `remember that the project is on <stack>` |
579
+ | Register feature/ADR/debt | `register in the brain` |
580
+ | Debt-payment sprint | `run sprint 0` (after tech-lead plan) |
581
+
582
+ ## 11. Decision tree
583
+
584
+ ```text
585
+ .claude/ absent in the project?
586
+ → duk install (CLI) or /active-project <path> (chat batch)
587
+
588
+ .claude/ present but outdated?
589
+ → duk install (idempotent) OR "update the template"
590
+
591
+ Don't know the test state?
592
+ → "audit the tests" (test-coverage-auditor)
593
+
594
+ Coverage bad, going to prod tomorrow?
595
+ → "is this ready for production?" (prd-ready-check)
596
+ → "tech-lead prioritizes P0/P1"
597
+
598
+ Legacy stack (Java 8/11/17, Spring 2/3, Angular 14-20)?
599
+ → "migrate from <X> to <Y>" (migrator)
600
+ → ALWAYS with GREEN baseline first
601
+
602
+ About to start a new feature?
603
+ → "run the tests" → gate GREEN? → "grill me about <X>"
604
+ → Gate RED? → pay debt first
605
+
606
+ Several projects to adopt at once?
607
+ → "/active-project <path>" in batch (non-interactive)
608
+
609
+ Obscure/intermittent bug on legacy?
610
+ → "let's debug <X>" (pair-debug, hypothesis-driven)
611
+
612
+ Want project history/MOC?
613
+ → "register in the brain" (brain-keeper)
614
+ → Open docs/brain/ in Obsidian
615
+ ```
616
+
617
+ ## 12. CLAUDE.md Project Identity — declare REALITY
618
+
619
+ Common mistake: declare the DESIRED stack ("Java 25 + Spring Boot 4") in a
620
+ project still running Java 11 + SB 2.7. Agents will then suggest APIs that
621
+ don't exist yet, generate incompatible tests, and the gate becomes noise.
622
+
623
+ **Rule**: `Project Identity` reflects the CURRENT state. Use `Additional rules`
624
+ to annotate deviations and modernization plan.
625
+
626
+ ### Correct example
627
+
628
+ ```markdown
629
+ ## Project Identity
630
+
631
+ - **Project name**: `legacy-erp`
632
+ - **Project type**: `fullstack`
633
+ - **Primary stack**: `Java 11 + Spring Boot 2.7 + Angular 14`
634
+ - **Database**: `Oracle 19c + Redis 6`
635
+ - **Domain**: `Financial ERP`
636
+ - **Team size**: `5 backend, 2 frontend`
637
+ - **Additional rules**: |
638
+ - JUnit 4 still in use (JUnit 5 migration in ADR-031)
639
+ - H2 in legacy tests (Testcontainers replacement in ADR-028)
640
+ - Hibernate 5.6, DO NOT use Hibernate 6 APIs
641
+ - javax.* namespace (DO NOT migrate to jakarta.* yet)
642
+ - RestTemplate in use (RestClient only after SB 3.x — ADR-044)
643
+ - Target modernization Java 25 + SB 4 in backlog (ADR-040)
644
+ ```
645
+
646
+ ### What goes in `Additional rules`
647
+
648
+ - Lib/framework versions that diverge from the harness target
649
+ - Temporary migration decisions ("don't auto-convert X")
650
+ - Local conventions ("NEVER use Lombok @SneakyThrows")
651
+ - Referenced ADRs (link to `docs/adr/ADR-NNN-*.md`)
652
+
653
+ ### What NOT to touch
654
+
655
+ Other sections (`## Claude Model`, `## Mandatory Stack and Versions`,
656
+ `## Skills`, etc.) are plugin baseline. Don't edit manually — use `duk install`
657
+ / `update-template` to receive updates. Local edits in those sections become
658
+ conflict on the next merge.
659
+
660
+ ## 13. Antipatterns
661
+
662
+ ### Adoption
663
+
664
+ - `duk install` directly on `main`/`master`/`develop` — always dedicated branch
665
+ - Deleting `.claude.backup-<timestamp>/` before testing — wait 7 days
666
+ - Overwriting `Project Identity` with desired stack, not current
667
+ - Manually editing `.claude/agents/*.md` (lost on next update)
668
+ - Modifying base sections of `CLAUDE.md` (only `Project Identity` is yours)
669
+ - Running `duk install` in a directory that's not a git repo (installer aborts)
670
+
671
+ ### Execution
672
+
673
+ - Starting a new feature with RED gate
674
+ - Major migration without green baseline
675
+ - Skipping ADRs on migration (each major cross needs an ADR)
676
+ - Forcing automatic migration of everything instead of in phases
677
+ - Ignoring P0 from `test-coverage-auditor`
678
+ - Mixing debt payment with new feature in the same PR
679
+
680
+ ### Commits
681
+
682
+ - `Co-Authored-By: Claude` (CLAUDE.md forbids)
683
+ - Mentioning Claude/Anthropic/AI/LLM in commits (NON-NEGOTIABLE)
684
+ - Committing directly to `main`/`master` — always via PR
685
+
686
+ ### CLI
687
+
688
+ - `duk <skill>` — DOES NOT EXIST. Skills trigger via keyword in chat
689
+ - `duk migrate` — DOES NOT EXIST. Migration is via chat (`migrate from X to Y`)
690
+ - `duk audit` — DOES NOT EXIST. Audit is via chat (`audit the tests`)
691
+ - Asking the user for credentials — read from
692
+ `C:\development\tools\credentials\vps.txt`
693
+
694
+ ## 14. Troubleshooting
695
+
696
+ | Symptom | Cause | Solution |
697
+ |---|---|---|
698
+ | `duk install` fails with "not a git repo" | Target directory isn't a git repo | `git init` or abort — installer requires git |
699
+ | `duk install` fails with `git pull` error | Target directory has pending changes | `git commit` or `git stash` first |
700
+ | Directory exists but isn't a git repo | Detected but invalid | Installer aborts with exit 1 — init git or remove directory |
701
+ | `auditor` reports outdated agents | Template evolved | `duk install` re-injects |
702
+ | `auditor` reports custom skills deleted | Overwritten by update | Restore from `.claude.backup-<date>/skills/` |
703
+ | `migrator` refuses to start | Gate baseline isn't GREEN | `run the tests`, pay debt, try again |
704
+ | `test-coverage-auditor` returns P0 | Business rules without tests | DO NOT skip; generate tests (`gate-keeper generates...`) OR create a documented acceptance ADR |
705
+ | `update-template` botched `CLAUDE.md` merge | Conflict in automatic merge | `cp CLAUDE.md.bak.<date> CLAUDE.md` + manual section merge |
706
+ | `.obsidian/` absent after adoption | brain-keeper didn't run | `register in the brain` provisions the vault |
707
+ | Obsidian vault without `MOC.md` | New vault, brain-keeper hasn't run yet | `register in the brain` creates MOC and indices |
708
+ | `settings.json` customizations lost | Merge overwrote on update | Restore from `.claude.backup-<date>/settings.json` |
709
+ | Agents with old path after update | Incomplete backup | `duk install --force` or remove `.claude/` and reinstall |
710
+ | `npx @eltonssouza/development-utility-kit install` fails with EACCES | Permission on target directory | Run as admin OR `--path <dir-with-permission>` |
711
+ | `duk install --sub <folder>` doesn't detect type | Subfolder without `pom.xml`/`package.json` at root | `--force-type=<backend\|frontend>` |
712
+ | Dashboard 4242 won't start | Port in use or Node < 18 | `node -v` and free the port |
713
+ | `/active-project` doesn't recognize path | Path with spaces or backslash | Use forward slash: `C:/projects/legacy-1` |
714
+
715
+ ## 16. Active hooks after `duk install`
716
+
717
+ The `.claude/settings.json` injected by the harness activates these hooks
718
+ (summary):
719
+
720
+ - **PreToolUse Bash** — blocks dangerous commands: `rm -rf` in tests,
721
+ `git push --force` to `main`, `DROP DATABASE`, etc.
722
+ - **PostToolUse Edit/Write** — runs `prettier`/`spotless` inline on edited
723
+ files and fires a reminder if the file is production code without a matching
724
+ test
725
+ - **Stop** — records session history at session end (deltas,
726
+ decisions, ADRs created)
727
+
728
+ Full details: `[Hooks reference](../docs/hooks-reference)`.
729
+
730
+ Local customizations in `.claude/settings.json` are preserved until the next
731
+ `duk install`. To preserve across updates, edit via the `update-template`
732
+ agent rather than manually, or annotate the customization in `Additional rules`
733
+ of `CLAUDE.md` (alerts the template on the next merge).
734
+
735
+ ## 17. Flow guarantee (S2 — ADR-036/ADR-041)
736
+
737
+ Every prompt now passes through the **flow-guard** hook before the model sees it.
738
+
739
+ ### What it does
740
+
741
+ 1. Injects `[FLOW STATE: <stage> | status: OK/BLOCK/BYPASS]` into every prompt.
742
+ 2. Classifies the prompt into one of 4 lanes:
743
+ - **greenfield** — new project, no artifacts yet → requires `grill-me` first
744
+ - **brownfield** — existing project, implementation intent → requires DISCOVERY_*.md
745
+ - **sprint** — explicit sprint run → requires PLAN_*.md
746
+ - **small-task** — trivial / conversational → routes directly
747
+ 3. Hard-blocks brownfield/sprint work missing its prerequisite artifact.
748
+ 4. Honors `flow: skip-guard` anywhere in the prompt (audited in `.flow-state.json`).
749
+
750
+ ### project-manager as front-controller
751
+
752
+ `project-manager` is the universal front door for every development task:
753
+
754
+ | Domain count | Mode | Dispatch |
755
+ |---|---|---|
756
+ | 1 | ROUTE | 1 specialist agent |
757
+ | 2–5 (independent) | ORCHESTRATE | ≤5 agents in parallel, shared `run_group_id` |
758
+ | >5 or dependent | ESCALATE | → `grill-me` → `analyst` → `sprint-runner` |
759
+
760
+ ORCHESTRATE enforces three invariants before marking any subtask `[PAR]`:
761
+ paths must be disjoint, no output dependency, STACK CONTEXT injected per Task.
762
+
763
+ ### Bypass
764
+
765
+ Add `flow: skip-guard` to the prompt. The bypass is logged with timestamp and session ID to `.flow-state.json` (gitignored). `duk lint` verifies the hook is registered.
766
+
767
+ ---
768
+
769
+ ## 18. Processes panel (S4 — ADR-045)
770
+
771
+ The dashboard now shows **recent orchestration runs** for each project.
772
+
773
+ ### How to use
774
+
775
+ 1. Open `duk dashboard` → Dashboard tab.
776
+ 2. Click any project in the **Projects** list.
777
+ 3. A **Processes** panel appears below the three cards.
778
+ 4. Each row is a `run_group_id` (one per ORCHESTRATE dispatch).
779
+ 5. Click a row to expand it — shows each parallel agent with type, model, and status.
780
+ 6. The panel auto-refreshes every 5 s.
781
+
782
+ ### What gets recorded
783
+
784
+ Phase A (current): `run_group_id`, `parent`, `agent_type`, `model`,
785
+ `project_path`, `session_id`, `ended_at`, `status` — written after each agent
786
+ finishes (`SubagentStop`). Phase B (live in-flight) is deferred — no
787
+ `SubagentStart` hook exists in Claude Code today.
788
+
789
+ ### Typical display
790
+
791
+ ```
792
+ rg-20260530-prod [completed] 3 agents ▶
793
+ ├── backend-developer sonnet completed
794
+ ├── frontend-developer sonnet completed
795
+ └── database-engineer sonnet completed
796
+ ```
797
+
798
+ ---
799
+
800
+ ## 19. Operational guard-rails
801
+
802
+ **Mass edits in the native environment**: prefer Cowork or a sandbox for bulk
803
+ read/validate operations. Direct mass file edits via the Claude Code CLI in the
804
+ native environment can trigger OS-level locks or antivirus scans on Windows.
805
+ `duk doctor` reminds you of this when run.
806
+
807
+ **Never commit credentials**: `C:\development\tools\credentials\vps.txt` is
808
+ read by skills at runtime — it must never be staged or pushed.
809
+
810
+ **Install on dirty tree**: `duk install` will detect local modifications via
811
+ `.MANIFEST` (sha256) and refuse to overwrite without `--force`. Always start
812
+ from a clean branch.
813
+
814
+ ---
815
+
816
+ ## 20. Quick glossary
817
+
818
+ - **skill** — keyword-based entry point (`.claude/skills/<name>/SKILL.md`)
819
+ - **agent** — specialized executor (`.claude/agents/<name>.md`)
820
+ - **Task tool** — mechanism that lets a skill call an agent
821
+ - **PLAN** — `docs/plans/PLAN_*.md`, analyst output with goal-ready DoD
822
+ - **PRD** — `docs/prd/PRD_*.md`, product requirements (`to-prd`)
823
+ - **ADR** — Architecture Decision Record in `docs/adr/`
824
+ - **goal-ready DoD** — Definition of Done the sprint-runner can execute
825
+ - **senior+ gate** — threshold set in CLAUDE.md (`Senior+ Quality Gate`)
826
+ - **Obsidian vault** — `docs/brain/` opened in Obsidian for history/MOC
827
+ - **Autonomy Matrix** — who decides what without asking the human (CLAUDE.md)
828
+ - **P0/P1/P2/P3** — debt severity from `test-coverage-auditor`:
829
+ - P0: business rule without test — BLOCKS release
830
+ - P1: partial, edges missing — pay in dedicated sprint
831
+ - P2: utility, low criticality — pay along with features
832
+ - P3: DTO/config — perpetual backlog
833
+ - **Project Identity** — `CLAUDE.md` section YOU edit; rest is baseline
834
+ - **GREEN baseline** — gate-keeper returned OK on current state
835
+ - **`.claude.backup-<timestamp>/` backup** — automatic copy before
836
+ `duk install` overwrites
837
+ - **MOC** — Map of Content, vault's main index at `docs/brain/MOC.md`
838
+
839
+ ## 18. Cross references
840
+
841
+ - [Architecture overview](../docs/architecture-overview)
842
+ - [Agents reference](../docs/agents-reference)
843
+ - [Skills reference](../docs/skills-reference)
844
+ - [Pipeline](../docs/pipeline)
845
+ - [Quality gate](../docs/quality-gate)
846
+ - [Stack rules](../docs/stack-rules)
847
+ - [Autonomy matrix](../docs/autonomy-matrix)
848
+ - [Hooks reference](../docs/hooks-referenc