@eltonssouza/development-utility-kit 1.0.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 (137) hide show
  1. package/.claude/agents/analyst.md +198 -0
  2. package/.claude/agents/backend-developer.md +126 -0
  3. package/.claude/agents/brain-keeper.md +229 -0
  4. package/.claude/agents/code-reviewer.md +181 -0
  5. package/.claude/agents/database-engineer.md +94 -0
  6. package/.claude/agents/devops-engineer.md +141 -0
  7. package/.claude/agents/frontend-developer.md +97 -0
  8. package/.claude/agents/gate-keeper.md +118 -0
  9. package/.claude/agents/migrator.md +291 -0
  10. package/.claude/agents/mobile-developer.md +80 -0
  11. package/.claude/agents/n8n-specialist.md +94 -0
  12. package/.claude/agents/product-owner.md +115 -0
  13. package/.claude/agents/qa-engineer.md +232 -0
  14. package/.claude/agents/release-engineer.md +204 -0
  15. package/.claude/agents/scaffold.md +87 -0
  16. package/.claude/agents/security-engineer.md +199 -0
  17. package/.claude/agents/sprint-runner.md +44 -0
  18. package/.claude/agents/stack-resolver.md +84 -0
  19. package/.claude/agents/tech-lead.md +182 -0
  20. package/.claude/agents/update-template.md +54 -0
  21. package/.claude/agents/ux-designer.md +118 -0
  22. package/.claude/settings.json +44 -0
  23. package/.claude/skills/README.md +332 -0
  24. package/.claude/skills/active-project/SKILL.md +129 -0
  25. package/.claude/skills/api-integration-test/SKILL.md +64 -0
  26. package/.claude/skills/auto-test-guard/SKILL.md +237 -0
  27. package/.claude/skills/auto-test-guard/resources/backend-tests.md +20 -0
  28. package/.claude/skills/auto-test-guard/resources/e2e-tests.md +24 -0
  29. package/.claude/skills/auto-test-guard/resources/execution-report.md +49 -0
  30. package/.claude/skills/auto-test-guard/resources/frontend-tests.md +18 -0
  31. package/.claude/skills/auto-test-guard/resources/initial-setup.md +108 -0
  32. package/.claude/skills/auto-test-guard/resources/run-suite.md +48 -0
  33. package/.claude/skills/auto-test-guard/resources/senior-gate.md +19 -0
  34. package/.claude/skills/brain-keeper/SKILL.md +60 -0
  35. package/.claude/skills/brain-keeper/obsidian/app.json +9 -0
  36. package/.claude/skills/brain-keeper/obsidian/appearance.json +4 -0
  37. package/.claude/skills/brain-keeper/obsidian/core-plugins.json +20 -0
  38. package/.claude/skills/brain-keeper/obsidian/daily-notes.json +5 -0
  39. package/.claude/skills/brain-keeper/obsidian/graph.json +32 -0
  40. package/.claude/skills/brain-keeper/obsidian/snippets/folder-colors.css +90 -0
  41. package/.claude/skills/brain-keeper/obsidian/templates.json +5 -0
  42. package/.claude/skills/brain-keeper/templates/README.md +51 -0
  43. package/.claude/skills/brain-keeper/templates/adr.md +40 -0
  44. package/.claude/skills/brain-keeper/templates/bug.md +35 -0
  45. package/.claude/skills/brain-keeper/templates/daily.md +38 -0
  46. package/.claude/skills/brain-keeper/templates/feature.md +62 -0
  47. package/.claude/skills/brain-keeper/templates/meeting.md +34 -0
  48. package/.claude/skills/brain-keeper/templates/tech-debt.md +21 -0
  49. package/.claude/skills/caveman/SKILL.md +187 -0
  50. package/.claude/skills/create-stack-pack/SKILL.md +281 -0
  51. package/.claude/skills/grill-me/SKILL.md +79 -0
  52. package/.claude/skills/honcho-memory/SKILL.md +207 -0
  53. package/.claude/skills/honcho-memory/docs/api-endpoints-verified.md +75 -0
  54. package/.claude/skills/honcho-memory/hooks/on-prompt-submit.js +221 -0
  55. package/.claude/skills/honcho-memory/hooks/on-stop.js +193 -0
  56. package/.claude/skills/honcho-memory/lib/honcho-client.js +363 -0
  57. package/.claude/skills/honcho-memory/lib/memory-injector.js +93 -0
  58. package/.claude/skills/honcho-memory/package.json +32 -0
  59. package/.claude/skills/honcho-memory/scripts/cli.js +370 -0
  60. package/.claude/skills/honcho-memory/scripts/setup.js +109 -0
  61. package/.claude/skills/honcho-memory/tests/t001-api-endpoints-verified.test.js +89 -0
  62. package/.claude/skills/honcho-memory/tests/t002-structure.test.js +97 -0
  63. package/.claude/skills/honcho-memory/tests/t003-honcho-client.test.js +162 -0
  64. package/.claude/skills/honcho-memory/tests/t004-soft-delete.test.js +259 -0
  65. package/.claude/skills/honcho-memory/tests/t005-memory-injector.test.js +175 -0
  66. package/.claude/skills/honcho-memory/tests/t006-on-prompt-submit.test.js +215 -0
  67. package/.claude/skills/honcho-memory/tests/t007-on-stop.test.js +165 -0
  68. package/.claude/skills/honcho-memory/tests/t008-cli.test.js +214 -0
  69. package/.claude/skills/honcho-memory/tests/t009-setup.test.js +232 -0
  70. package/.claude/skills/honcho-memory/tests/t010-skill-md.test.js +114 -0
  71. package/.claude/skills/honcho-memory/tests/t011-settings-hooks.test.js +105 -0
  72. package/.claude/skills/honcho-memory/tests/t012-docs-update.test.js +106 -0
  73. package/.claude/skills/honcho-memory/tests/t013-smoke-e2e.test.js +90 -0
  74. package/.claude/skills/pair-debug/SKILL.md +288 -0
  75. package/.claude/skills/prd-ready-check/SKILL.md +58 -0
  76. package/.claude/skills/project-manager/SKILL.md +167 -0
  77. package/.claude/skills/quality-standards/SKILL.md +201 -0
  78. package/.claude/skills/quick-feature/SKILL.md +264 -0
  79. package/.claude/skills/run-sprint/SKILL.md +342 -0
  80. package/.claude/skills/scaffold/SKILL.md +58 -0
  81. package/.claude/skills/stack-discovery/SKILL.md +159 -0
  82. package/.claude/skills/test-coverage-auditor/SKILL.md +59 -0
  83. package/.claude/skills/to-issues/SKILL.md +163 -0
  84. package/.claude/skills/to-prd/SKILL.md +130 -0
  85. package/.claude/skills/update-template/SKILL.md +254 -0
  86. package/.claude/stacks/CODEOWNERS +30 -0
  87. package/.claude/stacks/README.md +88 -0
  88. package/.claude/stacks/_template.md +116 -0
  89. package/.claude/stacks/java/spring-boot-3.md +376 -0
  90. package/.claude/stacks/java/spring-boot-4.md +438 -0
  91. package/.claude/stacks/typescript/angular-18.md +420 -0
  92. package/.claude/stacks/typescript/angular-19.md +397 -0
  93. package/.claude/stacks/typescript/angular-21.md +494 -0
  94. package/CLAUDE.md +453 -0
  95. package/README.md +391 -0
  96. package/bin/cli.js +773 -0
  97. package/bin/lib/backup.js +62 -0
  98. package/bin/lib/detect-stack.js +476 -0
  99. package/bin/lib/help.js +233 -0
  100. package/bin/lib/identity.js +108 -0
  101. package/bin/lib/local-dir.js +69 -0
  102. package/bin/lib/manifest.js +236 -0
  103. package/bin/lib/sync-all.js +394 -0
  104. package/bin/lib/version-check.js +398 -0
  105. package/dashboard/db.js +199 -0
  106. package/dashboard/package.json +22 -0
  107. package/dashboard/public/app.js +709 -0
  108. package/dashboard/public/content/docs/agents-reference.en.md +911 -0
  109. package/dashboard/public/content/docs/architecture-overview.en.md +260 -0
  110. package/dashboard/public/content/docs/autonomy-matrix.en.md +186 -0
  111. package/dashboard/public/content/docs/git-flow.en.md +525 -0
  112. package/dashboard/public/content/docs/honcho-memory.en.md +394 -0
  113. package/dashboard/public/content/docs/hooks-reference.en.md +420 -0
  114. package/dashboard/public/content/docs/pipeline.en.md +400 -0
  115. package/dashboard/public/content/docs/quality-gate.en.md +315 -0
  116. package/dashboard/public/content/docs/skills-reference.en.md +500 -0
  117. package/dashboard/public/content/docs/stack-rules.en.md +362 -0
  118. package/dashboard/public/content/docs/troubleshooting.en.md +637 -0
  119. package/dashboard/public/content/manifest.json +102 -0
  120. package/dashboard/public/content/manual/backend.en.md +1138 -0
  121. package/dashboard/public/content/manual/existing-project.en.md +831 -0
  122. package/dashboard/public/content/manual/frontend.en.md +1065 -0
  123. package/dashboard/public/content/manual/fullstack.en.md +1508 -0
  124. package/dashboard/public/content/manual/mobile.en.md +866 -0
  125. package/dashboard/public/index.html +108 -0
  126. package/dashboard/public/style.css +610 -0
  127. package/dashboard/public/vendor/marked.min.js +69 -0
  128. package/dashboard/rtk.js +143 -0
  129. package/dashboard/server-app.js +403 -0
  130. package/dashboard/server.js +104 -0
  131. package/dashboard/test/sprint1.test.js +406 -0
  132. package/dashboard/test/sprint2.test.js +571 -0
  133. package/dashboard/test/sprint3.test.js +560 -0
  134. package/package.json +33 -0
  135. package/scripts/hooks/subagent-telemetry.sh +14 -0
  136. package/scripts/hooks/telemetry-writer.js +250 -0
  137. package/scripts/latest-versions.json +56 -0
package/CLAUDE.md ADDED
@@ -0,0 +1,453 @@
1
+ ## Project Identity
2
+
3
+ > **Modifique apenas esta seção ao adotar o plugin em um novo projeto.**
4
+ > Todas as demais seções são base do plugin e não devem ser alteradas diretamente
5
+ > — use `update-template` para receber atualizações.
6
+
7
+ - **Project name**: `<project-name>`
8
+ - **Project type**: `backend` | `frontend` | `fullstack` | `mobile` | `library` | `cli` | `data-pipeline`
9
+ - **Primary stack**: `<lang> <version> + <framework> <version>` (ex: `Java 21 + Spring Boot 3.2`, `Java 25 + Spring Boot 4.0`, `TypeScript + Angular 21`, `Python 3.12 + Django 5`, `Go 1.23 + Gin 1.10`, `React Native 0.84 + Expo SDK 54`)
10
+ - **Database**: `<engine + version>` (ex: `PostgreSQL 17 + Redis 7`, `MongoDB 7`, `nenhum`)
11
+ - **Domain**: `<ex: e-commerce, fintech, healthcare>`
12
+ - **Team size**: `<ex: 3 fullstack>`
13
+ - **Additional rules**: _(deixe vazio se não houver — use para declarar desvios temporários do harness target)_
14
+
15
+
16
+ <!-- PLUGIN BASE — não editar abaixo. Use update-template para receber atualizações. -->
17
+
18
+ # Stack Architect Agent — Project Context
19
+
20
+ Always respond in **Brazilian Portuguese**. (Assistant chat only — agents/skills/commands content is in English.)
21
+
22
+ Style: **caveman** on by default — ULTRA for code, FULL for `.md`, LITE for contract/PRD. See [`.claude/skills/caveman/SKILL.md`](.claude/skills/caveman/SKILL.md). To turn off: `stop caveman`.
23
+
24
+ ---
25
+
26
+ ## Claude Model
27
+
28
+ - Default (main session): `claude-opus-4-7` (Opus 4.7). Agentic work + architectural decisions.
29
+ - **Commits**: NUNCA mencionar Claude/Anthropic/AI/LLM/assistant em subject, body ou trailers. Sem `Co-Authored-By: Claude`. Commits devem parecer escritos 100% pelo dev humano. Ver seção `Commit — Restrições obrigatórias`.
30
+
31
+ ### Sub-agents — model per agent (master rule)
32
+
33
+ Opus is expensive. Use only where the decision is irreversible, macro trade-off, or technical veto. Sonnet = default. Haiku = mechanical.
34
+
35
+ | Model | When to use | Agents |
36
+ |---|---|---|
37
+ | **Opus 4.7** | Top technical authority on irreversible cross-cutting decisions | `tech-lead` |
38
+ | **Sonnet 4.6** | Product decision, implementation, orchestration, technical decomposition, review, test, UI, history recording | `product-owner`, `analyst`, `backend-developer`, `frontend-developer`, `mobile-developer`, `n8n-specialist`, `ux-designer`, `database-engineer`, `devops-engineer`, `qa-engineer`, `code-reviewer`, `security-engineer`, `gate-keeper`, `sprint-runner`, `brain-keeper`, `release-engineer`, `migrator` |
39
+ | **Haiku 4.5** | Scaffold, template sync, stack resolution (mechanical) | `scaffold`, `update-template`, `stack-resolver` |
40
+
41
+ **Non-negotiable**: never promote an agent to Opus without justification "irreversible decision or macro trade-off". Routine implementation always Sonnet.
42
+
43
+ ---
44
+
45
+ ## Stack Architecture (per ADR-026 / ADR-027 / ADR-029)
46
+
47
+ The harness is **stack-agnostic by default**. Stack-specific rules (Java vs Python vs Go, Spring Boot 3 vs 4, Angular 18 vs 21) live in **knowledge packs** at `.claude/stacks/<lang>/<framework>-<major>.md`, NOT hardcoded in agents or this CLAUDE.md.
48
+
49
+ ### How it works
50
+
51
+ 1. **Project declares stack** in `## Project Identity` above.
52
+ 2. **`stack-resolver` agent** reads Project Identity, locates matching pack, returns rendered STACK CONTEXT block.
53
+ 3. **Skills (`run-sprint`, `auto-test-guard`, `quick-feature`, `pair-debug`)** invoke `stack-resolver` at Step 0, inject STACK CONTEXT into downstream agent prompts (pre-resolution — Layer 1 of ADR-026 defense).
54
+ 4. **Specialist agents** (`backend-developer`, `frontend-developer`, etc.) consume STACK CONTEXT from the prompt and apply stack-specific patterns from the pack (Layer 2).
55
+ 5. **Agents emit `[STACK: <lang>/<framework>-<major> | PACK: loaded|none]`** as first output line for post-hoc validation (Layer 3).
56
+
57
+ ### Pack lifecycle
58
+
59
+ - `active` (in use) → `deprecated` (no project references it) → `archived` (preserved for history).
60
+ - Up to 3 active packs per language allowed (legacy / current / next).
61
+ - New major = new pack file (do NOT update in-place).
62
+ - Annual security review per active pack (1h/pack/year per ADR-027).
63
+
64
+ ### Project Identity → pack resolution
65
+
66
+ - `Primary stack: Java 21 + Spring Boot 3.2` → `.claude/stacks/java/spring-boot-3.md`
67
+ - `Primary stack: Java 25 + Spring Boot 4.0` → `.claude/stacks/java/spring-boot-4.md`
68
+ - `Primary stack: TypeScript + Angular 21` → `.claude/stacks/typescript/angular-21.md`
69
+ - `Primary stack: Python 3.12 + Django 5` → `.claude/stacks/python/django-5.md` (create via `create-stack-pack` if missing)
70
+
71
+ ### Pack missing? → skill `create-stack-pack`
72
+
73
+ When `stack-resolver` finds no pack for declared stack, dispatches `create-stack-pack` skill — conversational generator (8 questions) using `.claude/stacks/_template.md` as base. PRs back to harness repo for reuse across projects.
74
+
75
+ ### Active stack packs (this harness — index)
76
+
77
+ See `.claude/stacks/README.md` for the up-to-date index. Current active packs:
78
+ - `java/spring-boot-3` (legacy maintenance — Java 17/21 + SB 3.2+)
79
+ - `java/spring-boot-4` (greenfield default — Java 25 + SB 4.0+)
80
+ - `typescript/angular-18`, `angular-19`, `angular-21`
81
+
82
+ ### Local overrides (`.claude/local/`)
83
+
84
+ Per ADR-032: customizations specific to one project go in `.claude/local/stacks/`, `.claude/local/agents/`, `.claude/local/skills/`. Loader priority: `local/` wins over harness. Never touched by `duk install`.
85
+
86
+ ---
87
+
88
+ ## Skills (Cowork + Claude Code)
89
+
90
+ Skills in `.claude/skills/` trigger automatically by keyword. **Single entry layer** — commands deleted 2026-05-25. Default entry point for every prompt.
91
+
92
+ | Skill | When it triggers | Output |
93
+ |---|---|---|
94
+ | `caveman` | Always on; "caveman lite/full/ultra", "stop caveman" | Telegraphic output (~65–75% fewer tokens) |
95
+ | `project-manager` | **Catch-all fallback**: any task without a more specific skill — "create endpoint", "review code", "dockerize", "audit security", "design DB", "create mobile app", "n8n workflow", "wireframe", "migrate", "release prep", "architecture decision", "break into requirements" | Routes to ONE specialist agent (analyst, architect, backend-developer, frontend-developer, code-reviewer, database-engineer, devops-engineer, mobile-developer, n8n-specialist, product-owner, qa-engineer, security-engineer, tech-lead, ux-designer, migrator, release-engineer, auditor) via Task tool |
96
+ | `scaffold` | "scaffold the project", "scaffold backend", "scaffold frontend", "bootstrap fullstack", "monta o esqueleto", "scaffolda o projeto" | Reads `type:` from `## Project Identity`; dispatches to `scaffold` agent for backend/frontend/fullstack pipeline |
97
+ | `run-sprint` | "run sprint X", "execute the sprint" | Sprint implemented with green tests via `sprint-runner` agent |
98
+ | `api-integration-test` | "test integration", "smoke" | Real report (curl + Chrome MCP) |
99
+ | `auto-test-guard` | End of task; "run tests", "generate tests", "full suite" | Generates tests + full regression via `gate-keeper` agent. Blocks if it breaks. |
100
+ | `prd-ready-check` | "PRD-ready?", "DoD" | GO / NO-GO |
101
+ | `test-coverage-auditor` | "audit coverage", "debt map" | Debt report + P0/P1 notes. Gate in `prd-ready-check`. |
102
+ | `pair-debug` | "pair debug", "investigate this bug", "find root cause" | Hypothesis-driven debug loop (no "try and see") |
103
+ | `grill-me` | "grill me", "me entrevista sobre", "stress-test o plano" (opt-in) | Discovery interview → `DISCOVERY_*.md` + handoff to `analyst` (ADR-011 + ADR-013) |
104
+ | `brain-keeper` | End PLAN_*; "record in brain", "update brain" | Provisions `docs/brain/` + `.obsidian/` with color snippet; daily/feature/ADR/bug/tech-debt/migrations + MOC |
105
+ | `update-template` | "update template", "sync with development-utility-kit" | Syncs `.claude/`, `CLAUDE.md` (merge + backup, hash-based drift detection) — preserves `Project Identity` |
106
+ | `to-prd` | "to-prd", "gera PRD", "cria PRD" (opt-in, after `grill-me`) | Reads `DISCOVERY_*.md` → writes `docs/prd/PRD_*.md` |
107
+ | `to-issues` | "to-issues", "quebra em issues", "gera issues" (opt-in, after `to-prd`) | Reads `PRD_*.md` → writes `docs/issues/ISSUES_*.md` ready for `gh issue create` |
108
+ | `active-project` | "ativar projeto em `<path>`", "adota o projeto `<path>`" | Path-driven, non-interactive adoption — fast lane of `update-template` |
109
+ | `honcho-memory` | "lembra que", "remember that", "memoriza", "/honcho save", "/honcho search", "/honcho list", "/honcho forget", "/honcho status", "/honcho setup" | Persistent cross-session memory via Honcho v3 self-hosted (per-dev instance). Memorizes **user habits + project context**, not technical rules (those live in packs — see ADR-031) |
110
+
111
+ See [`.claude/skills/README.md`](.claude/skills/README.md) and [`.claude/stacks/README.md`](.claude/stacks/README.md).
112
+
113
+ **Architecture rule**: 2 layers — Skill (entry point) + Agent (executor). No commands. Specific skills win by keyword match; everything else falls into `project-manager`.
114
+
115
+ ---
116
+
117
+ ## Sub-Agent Routing
118
+
119
+ | Task | Agent | When to use |
120
+ |---|---|---|
121
+ | **Product/business** | **`product-owner`** | Top authority. Scope, rule, priority, flow, UX, MVP, persona, metric, API contract. Decides. Escalates only in 4 irreversible situations. |
122
+ | Technical decomposition + PLAN_*.md | `analyst` | PO decision → technical plan with goal-ready DoD. Human path requires discovery artifact from `grill-me` (per ADR-013 + ADR-017). Autonomous callers (`sprint-runner`, `release-engineer`, `quick-feature`) exempt via `caller:` signal in Task prompt. |
123
+ | Stack resolution (mechanical) | `stack-resolver` | Reads Project Identity, locates pack, returns STACK CONTEXT block. Invoked by orchestrating skills at Step 0 (per ADR-026). |
124
+ | **Technical + coordination + architecture** | **`tech-lead`** | Top technical authority. Stack, pattern, refactor, debt, lib, integration, macro architecture, ADR, final review. Decides. Escalates only in 3 situations. |
125
+ | UI/UX + wireframes | `ux-designer` | Screens, flows, a11y, design system (UI lib from STACK CONTEXT) |
126
+ | Backend implementation | `backend-developer` | Endpoint, service, DTO, repository (patterns from STACK CONTEXT pack) |
127
+ | Frontend implementation | `frontend-developer` | Component, service, route, state (framework specifics from pack) |
128
+ | Mobile | `mobile-developer` | iOS/Android, native modules, push, biometric, store deploy (RN/Flutter/native via pack) |
129
+ | Database | `database-engineer` | Schema, index, query, migration, perf (engine specifics from pack) |
130
+ | Infra + deploy | `devops-engineer` | Docker, K8s, CI/CD, cloud (build commands from pack) |
131
+ | Code review | `code-reviewer` | PR initial review (rules from pack) |
132
+ | Security + LGPD | `security-engineer` | OWASP, LGPD audit (impl from pack `## Security` — mandatory per ADR-027) |
133
+ | Tests (write) | `qa-engineer` | Unit, integration, E2E (framework specifics from pack + `quality-standards` skill) |
134
+ | Tests (gate) | `gate-keeper` | Run senior+ gate, validate thresholds, block merge |
135
+ | n8n | `n8n-specialist` | Workflow, integration, AI agent, webhook, deploy |
136
+ | Sprint execution | `sprint-runner` | Executes Sprint N of PLAN, delegates in parallel (Stage 0 stack-resolver) |
137
+ | Scaffold (new project) | `scaffold` | Reads Project type + stack, runs appropriate pipeline |
138
+ | Release flow | `release-engineer` | Version bump, CHANGELOG, tag, commands for human |
139
+ | Stack migration | `migrator` | Consumes 2 packs (FROM + TO), multi-major incremental, fullstack sequential (per ADR-030) |
140
+ | History recording (Obsidian vault) | `brain-keeper` | End of PLAN_*: daily, feature, ADR, bug, tech-debt, migration in `docs/brain/` |
141
+
142
+ ### Delegation rules
143
+
144
+ - **Parallel**: independent tasks without shared files.
145
+ - **Sequential**: output feeds the next (API → consuming component).
146
+ - **Don't delegate**: trivial.
147
+
148
+ ---
149
+
150
+ ## Autonomy Matrix (MASTER RULE)
151
+
152
+ **Non-negotiable**: agents decide on their own. Asking the human = rare exception. No "I wonder if the user wants X or Y" — the responsible agent **decides and proceeds**.
153
+
154
+ ### Who decides what
155
+
156
+ | Domain | Agent | Behavior |
157
+ |---|---|---|
158
+ | Product, scope, rule, UX, flow, priority, MVP, persona, API contract | `product-owner` | **Decides alone.** |
159
+ | Stack, pattern, refactor, lib, tool, debt, macro architecture, integration, final review | `tech-lead` | **Decides alone.** Approves/blocks merges. |
160
+ | DB schema, index, migration, perf | `database-engineer` → `tech-lead` (if cross-cutting) | DB engineer decides; TL approves if it affects >1 context. |
161
+ | Security, vuln, OWASP, LGPD | `security-engineer` | **Technical veto** on high/critical — blocks merge without human. |
162
+ | Infra, cost, deploy, CI/CD | `devops-engineer` → `tech-lead` (if >R$200/month) | DevOps decides, except for relevant cost. |
163
+ | UI, microinteraction, tokens, a11y | `ux-designer` → `product-owner` (flow/scope) | UX decides "how visual", PO decides "what". |
164
+ | Implementation | `backend-developer` / `frontend-developer` / `mobile-developer` | Implement what TL defined. Product question → PO. Technical question → TL. **Don't escalate to human.** |
165
+ | Tests, coverage, gate | `gate-keeper` | Blocks if senior+ gate fails. Returns to developer. |
166
+ | Triage between agents | `tech-lead` | Conflict between developers → TL. Conflict TL × PO → joint negotiation. |
167
+
168
+ ### When to escalate to the human (and ONLY when)
169
+
170
+ **PO escalates ONLY in:**
171
+ 1. Irreversible action on real customer data (delete/overwrite without recovery).
172
+ 2. Relevant financial cost (paid SaaS, tier change).
173
+ 3. Breaking change on PUBLIC contract already published (external client).
174
+ 4. Identity/brand change approved by another area.
175
+
176
+ **TL escalates ONLY in:**
177
+ 1. Technical requirement conflict that cannot be resolved with grounding.
178
+ 2. Breaking change on public production contract (window with external client).
179
+ 3. Infra cost > R$ 200/month additional.
180
+
181
+ **Specialists NEVER escalate to the human** — they go up to PO (product) or TL (technical).
182
+
183
+ ### Form of escalation (when justified)
184
+
185
+ Never an open question. Always **proposal + recommendation + impact of the opposite decision**:
186
+
187
+ > "Provision managed Redis Cluster (+R$ 380/month) to support 10x traffic in 6 months. I recommend approving now; if we keep single-node, cache queue in 2 months."
188
+
189
+ ---
190
+
191
+ ## Senior+ Quality Gate (NON-NEGOTIABLE)
192
+
193
+ A task = complete only after `auto-test-guard` GREEN on **all** items. No exception. `tech-lead` blocks the merge if anything fails.
194
+
195
+ These thresholds are **universal across stacks**. Stack-specific tooling (JaCoCo vs coverage.py vs go cover, JUnit vs pytest vs go test) comes from the pack `## Testing` and `## Build & run commands` sections.
196
+
197
+ | Metric | Threshold | Tool category |
198
+ |---|---|---|
199
+ | Backend coverage (lines) | >= **85%** | Coverage tool from pack (JaCoCo / coverage.py / go cover / ...) |
200
+ | Backend coverage (branches) | >= **80%** | Same |
201
+ | **Backend mutation score** | >= **70%** in domain + application layers | Mutation tool from pack (PIT / mutmut / go-mutesting / ...) |
202
+ | Frontend coverage (statements) | >= **85%** | Jest --coverage / Vitest --coverage |
203
+ | Frontend coverage (branches) | >= **80%** | Same |
204
+ | Static analysis | 0 CRITICAL, 0 HIGH | Stack-specific (SpotBugs / mypy / golangci-lint / ESLint strict / ...) |
205
+ | SonarLint/SonarQube (if configured) | 0 CRITICAL, 0 HIGH, 0 unreviewed hotspot | Sonar |
206
+ | Dependency vuln scan | 0 CVE with CVSS >= 7.0 | Stack-specific (OWASP DC / npm audit / safety / govulncheck / ...) |
207
+ | ESLint frontend | 0 errors, 0 warnings on new code | `eslint --max-warnings 0` |
208
+ | Playwright E2E | 100% green, critical flows covered | Playwright |
209
+ | Browser console in E2E | 0 errors | Chrome MCP |
210
+ | **A11y violations (component)** | 0 `serious` / 0 `critical` | jest-axe |
211
+ | **A11y violations (E2E)** | 0 `serious` / 0 `critical` | @axe-core/playwright |
212
+ | **Performance score (Lighthouse)** | >= **0.80** (median of 3 runs) | @lhci/cli |
213
+ | **LCP (Largest Contentful Paint)** | <= **2500ms** | @lhci/cli |
214
+ | **CLS (Cumulative Layout Shift)** | <= **0.1** | @lhci/cli |
215
+ | **TBT (Total Blocking Time)** | <= **300ms** | @lhci/cli |
216
+ | **Testing pyramid ratio (E2E)** | <= **30%** of total tests (hard-fail above; ideal <= 15%) | `auto-test-guard` count |
217
+
218
+ **Senior+ gate references ADR-007 for a11y + Lighthouse + pyramid thresholds.**
219
+
220
+ **Standard senior+ flow (per ADR-008)**:
221
+ 1. `product-owner` decides requirements.
222
+ 2. `analyst` produces PLAN_*.md with goal-ready DoD.
223
+ 3. `tech-lead` proposes ADR when there is a macro decision; approves.
224
+ 4. `sprint-runner` executes Sprint N with Stage 0 stack-resolver, delegating in parallel; `qa-engineer` writes tests.
225
+ 5. `gate-keeper` generates missing tests + runs the full senior+ gate (coverage, mutation, a11y, Lighthouse, pyramid).
226
+ 6. `code-reviewer` initial review (consulting pack § Anti-patterns).
227
+ 7. `tech-lead` final review → approves merge OR returns.
228
+
229
+ **Human never interrupted** — except in the 4 of the PO or 3 of the TL.
230
+
231
+ ---
232
+
233
+ ## Universal Code Conventions
234
+
235
+ **Stack-specific conventions live in the pack** (`.claude/stacks/<lang>/<framework>-<major>.md` § Code patterns + § Anti-patterns). The conventions below apply **regardless of stack**.
236
+
237
+ - **DTOs separated from domain entities**. Never expose ORM entities directly through API contracts.
238
+ - **Validation before domain logic**. Use the validation library from the pack.
239
+ - **Error handling explicit**. Never swallow exceptions silently. Map to domain exceptions; map to API error response from the pack.
240
+ - **No `// TODO` / `// FIXME` in committed code**. Track in `docs/brain/architecture/tech-debt.md` with owner + deadline.
241
+ - **Tests are non-negotiable**. Unit + integration + E2E per stack tooling (from pack). Mutation testing on critical layers.
242
+ - **Real engines in integration tests**. Never SQLite / H2 / in-memory as production DB stand-in. Use Testcontainers / equivalent.
243
+ - **APIs versioned** (`/api/v1/...`). Pagination via metadata wrapper.
244
+ - **Logs structured** (JSON), correlation ID propagated. **Never log token, password, PII**.
245
+ - **External calls** have explicit timeout + retry policy + circuit breaker.
246
+ - **Idempotency** on mutating actions when relevant (`Idempotency-Key` header, dedup window).
247
+ - **Secrets** never in committed files. Use env vars / vault.
248
+
249
+ ## Universal SOLID + Clean Code
250
+
251
+ - **Clean Code + SOLID** applied through code, without naming names ostentatiously.
252
+ - **No premature abstraction**. Interface for one implementation = code smell.
253
+ - **Never suggest a technology without justification**. Simplest solution = best.
254
+
255
+ ## Backend layout (DDD, universal pattern)
256
+
257
+ The package/folder names below are **conceptual** — actual naming may vary by language (`com.company.project/domain/...` in Java, `app/domain/...` in Python, `internal/domain/...` in Go):
258
+
259
+ ```
260
+ <project>
261
+ ├── domain (entities, value objects, repository ports, domain services)
262
+ ├── application (use cases, DTOs, mappers, orchestration)
263
+ ├── infrastructure (DB adapters, external clients, security, config)
264
+ └── web (or api) (controllers/handlers, filters, error middleware)
265
+ ```
266
+
267
+ ## Frontend layout (universal pattern)
268
+
269
+ ```
270
+ src/
271
+ ├── core (or shared infra) (auth, HTTP client, interceptors, guards)
272
+ ├── shared (reusable components, pipes/utilities)
273
+ ├── features (lazy-loaded feature modules/routes)
274
+ └── routes/router config
275
+ ```
276
+
277
+ ---
278
+
279
+ ## Git Conventions
280
+
281
+ ### Git Flow (padrão obrigatório em todos os projetos)
282
+
283
+ ```
284
+ main ← produção (apenas merges via PR de release/* ou hotfix/*)
285
+ develop ← integração (merges de feature/* via PR)
286
+ feature/* ← novas funcionalidades (base: develop, PR → develop)
287
+ release/* ← preparação de release (base: develop, PR → main + develop)
288
+ hotfix/* ← correção urgente em prod (base: main, PR → main + develop)
289
+ bugfix/* ← correção em dev (base: develop, PR → develop)
290
+ ```
291
+
292
+ **Fluxo padrão de feature:**
293
+ 1. `git flow feature start <nome>` (cria `feature/<nome>` a partir de `develop`)
294
+ 2. Implementar + commits Conventional Commits
295
+ 3. `git flow feature finish <nome>` OU PR `feature/<nome>` → `develop`
296
+ 4. PR `develop` → `main` via `release/*` quando pronto para prod
297
+
298
+ **Fluxo de hotfix:**
299
+ 1. `git flow hotfix start <nome>` (base: `main`)
300
+ 2. Fix + commit
301
+ 3. `git flow hotfix finish <nome>` → merge em `main` E `develop`
302
+
303
+ - **Commits**: Conventional Commits. `feat(scope): ...` | `fix(scope): ...` | `refactor(scope): ...` | `test(scope): ...` | `docs(scope): ...` | `chore(scope): ...`.
304
+ - **PRs**: "What changed", "How to test", checklist.
305
+
306
+ ### Commit — Restrições obrigatórias (NON-NEGOTIABLE)
307
+
308
+ - **NUNCA** incluir referências a Anthropic, Claude, AI, LLM ou qualquer assistente no texto do commit (subject, body, trailers).
309
+ - **NUNCA** adicionar linha `Co-Authored-By: Claude ...` ou similar.
310
+ - Commits devem parecer escritos 100% pelo desenvolvedor humano da equipe.
311
+ - Violação bloqueia o commit — `tech-lead` recusa o merge.
312
+
313
+ ---
314
+
315
+ ## Universal Security (always apply)
316
+
317
+ Stack-specific implementation (SecurityFilterChain in Spring, Django middleware, etc.) lives in the pack `## Security` section (mandatory per ADR-027). Universal principles:
318
+
319
+ - **Authentication**: stateless tokens (JWT preferred) with short expiry + refresh. MFA hooks ready when domain warrants.
320
+ - **Authorization**: RBAC enforced at use case layer. IDOR validation on every "owned resource" access.
321
+ - **Password hashing**: BCrypt-class adaptive function (cost from pack — typically 12 for BCrypt).
322
+ - **CORS**: explicit origins list. NEVER `*` in production.
323
+ - **Headers**: CSP, HSTS, X-Frame-Options DENY, X-Content-Type-Options nosniff, Referrer-Policy strict-origin-when-cross-origin.
324
+ - **Rate limiting** on public endpoints (auth, signup, password reset).
325
+ - **Secrets**: env vars or vault. NEVER in committed files.
326
+ - **OWASP Top 10**: each pack maps to its stack's mitigation in `## Security § 7.6`.
327
+
328
+ ## Universal Observability (every system in production)
329
+
330
+ - **Logs**: structured JSON, correlation ID propagated via MDC (or equivalent).
331
+ - **Metrics**: Prometheus exposure with p50/p95/p99 + error rate + throughput.
332
+ - **Tracing**: OpenTelemetry with W3C Trace Context.
333
+ - **Health**: `/health` with readiness + liveness separated.
334
+
335
+ ---
336
+
337
+ ## Database (universal principles)
338
+
339
+ Stack-specific patterns (Postgres GIN indexes, MongoDB aggregation, Redis sorted sets) live in pack. Universal:
340
+
341
+ - **UUID = PK by default**. Document natural keys explicitly when used.
342
+ - **TIMESTAMPTZ** (or equivalent) for time fields.
343
+ - **NUMERIC / DECIMAL** for money. NEVER `FLOAT`.
344
+ - **Indexes**: every FK on N-side has an index. Created in the same migration as the table.
345
+ - **Migrations**: versioned, reversible when possible. NEVER `DROP TABLE` / `DROP COLUMN` without an ADR.
346
+ - **EXPLAIN before optimization**.
347
+
348
+ ---
349
+
350
+ ## Frontend — UI Components (universal)
351
+
352
+ Stack-specific UI lib (ng-bootstrap, Angular Material, Tailwind+shadcn, MUI, etc.) comes from pack. Universal:
353
+
354
+ - **A11y WCAG 2.1 AA minimum** on every interface (per ADR-007).
355
+ - **Mobile-first responsive**.
356
+ - **Design tokens** (CSS variables) for color, spacing, typography. Theme-aware.
357
+ - **Component states explicit**: default, hover, active, disabled, focus-visible, error, loading, empty.
358
+
359
+ ---
360
+
361
+ ## Infrastructure (universal)
362
+
363
+ Stack-specific build/run commands from pack `## Build & run commands`. Universal:
364
+
365
+ - **Docker**: multi-stage build, non-root user (UID >= 10000), healthcheck mandatory.
366
+ - **Compose**: complete dev environment (app + DB + cache).
367
+ - **CI/CD**: build → test → security scan → deploy. Steps from pack.
368
+ - **Secrets**: never in code — vault, env var, CI secret.
369
+
370
+ ---
371
+
372
+ ## Credentials — VPS / N8N / API Keys
373
+
374
+ When you need access to service VPS, N8N VPS, or API Keys, **always read from**:
375
+
376
+ ```
377
+ C:\development\tools\credentials\vps.txt
378
+ ```
379
+
380
+ Never ask the human for credentials if the file exists. Never commit the file's contents. Never log the value read.
381
+
382
+ ---
383
+
384
+ ## Bootstrap of New Project
385
+
386
+ ### Canonical directory
387
+
388
+ Every project lives in:
389
+
390
+ ```
391
+ C:\development\source\projects\<project-name>\
392
+ ```
393
+
394
+ ### Install harness via npx (recommended)
395
+
396
+ ```bash
397
+ # Install to default OS path:
398
+ # Windows : C:\development\tools\development-utility-kit
399
+ # Mac/Linux: ~/development/tools/development-utility-kit
400
+ npx @eltonssouza/development-utility-kit install
401
+
402
+ # With custom path:
403
+ npx @eltonssouza/development-utility-kit install --sub <dir>
404
+
405
+ # Preview without writing:
406
+ npx @eltonssouza/development-utility-kit install --dry-run
407
+
408
+ # Check local vs latest harness version:
409
+ npx @eltonssouza/development-utility-kit install --check-only
410
+ ```
411
+
412
+ Requires Node.js >= 18 and `git` in PATH. If target directory exists and is a valid git repo, the command runs `git pull` (idempotent). If directory exists but is not a git repo, installer aborts with exit 1.
413
+
414
+ ### New project from scratch — CLI scaffold + conversational discovery
415
+
416
+ ```bash
417
+ # 1. CLI scaffolding (mechanical, no questions):
418
+ duk new <project-name>
419
+ # → creates folder + git init + injects .claude/ + empty Project Identity
420
+
421
+ # 2. Open Cowork or Claude Code in the new folder
422
+
423
+ # 3. First message in chat: "sabatina pra projeto novo"
424
+ # → stack-discovery skill walks you through 8 questions
425
+ # → fills ## Project Identity
426
+ # → if pack missing for chosen stack: dispatches create-stack-pack
427
+
428
+ # 4. Then: "scaffolda o projeto"
429
+ # → scaffold skill reads Project Identity + pack, runs stack-appropriate setup
430
+ ```
431
+
432
+ ### Batch update across multiple projects
433
+
434
+ ```bash
435
+ # Preview which projects would be updated:
436
+ duk sync-all C:\development\source\projects
437
+
438
+ # Apply with filters:
439
+ duk sync-all C:\development\source\projects --filter stack:java --apply
440
+ duk sync-all C:\development\source\projects --filter age:30d --apply
441
+ duk sync-all C:\development\source\projects --filter harness-version:<0.2 --apply
442
+
443
+ # Exclude specific projects:
444
+ duk sync-all C:\development\source\projects --exclude prod-critical --apply
445
+ ```
446
+
447
+ ### Help
448
+
449
+ ```bash
450
+ duk help # general help
451
+ duk help <command> # command-specific
452
+ duk <command> --help # same
453
+ ```