@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,288 @@
1
+ ---
2
+ name: pair-debug
3
+ description: "Pair-debug loop. Use when a bug is reported and the cause is not immediately obvious — typical for runtime errors, intermittent failures, integration mismatches, mysterious 4xx/5xx, missing data in DB after a write, console errors in the browser, race conditions, etc. Forces a disciplined cycle: state the symptom, formulate a hypothesis with a confidence level, choose ONE cheap probe to confirm/deny it (curl, log line, breakpoint, SELECT, browser console via Chrome MCP), gather the evidence, accept or reject the hypothesis, repeat. Bans 'tentar e ver' — every change must follow a tested hypothesis. DO NOT use for obvious bugs with obvious fixes (typo, missing import, syntax error — just fix it), for bugs that already have a solid pre-existing hypothesis, for features that were not yet implemented (use run-sprint), for proactive refactor (not a bug), or for performance tuning without a reported symptom (use dba or tech-lead). PT triggers: 'vamos debugar', 'pair debug', 'investiga esse bug', 'debug pair', 'achar a causa', 'investigar a falha', 'qual a causa raiz', 'descobrir por que', 'estranho, não funciona'."
4
+ tools: Read, Glob, Grep, Bash(curl:*), Bash(grep:*), Bash(tail:*), Bash(head:*), Bash(jq:*), Bash(psql:*), Bash(docker logs:*), Bash(git log:*), Bash(git diff:*), Bash(git blame:*)
5
+ model: sonnet
6
+ ---
7
+
8
+ # Pair-debug — disciplined hypothesis-driven debugging
9
+
10
+ > **Subagent dispatch (mandatory).** Debug loop runs in the calling session. For writing the confirming test (§3.5), dispatch to `qa-engineer` via Task tool. The disciplined loop below applies regardless.
11
+
12
+ Your mission, in one line: **find the root cause of a bug by stating hypotheses with confidence, probing one at a time with cheap evidence, and refusing to fix anything until the cause is confirmed.**
13
+
14
+ Principle: *"'tentar e ver' é debug sem disciplina — cada mudança no código sem hipótese testada vira ruído. Hipótese + probe + evidência + verdict = sinal."*
15
+
16
+ ---
17
+
18
+ ## 1. When you trigger
19
+
20
+ - "vamos debugar X", "pair debug", "investiga esse bug", "achar a causa raiz", "por que isso não funciona"
21
+ - Specialist está travado depois de 2+ tentativas
22
+ - Bug reportado pelo `api-integration-test` ou pelo Chrome MCP console
23
+ - Falha intermitente (passa 1x, falha outras vezes — sinal de race ou estado sujo)
24
+ - 4xx/5xx misterioso, exception sem stack útil, dados sumindo do banco, console.error no front
25
+
26
+ ## 2. When you do NOT trigger
27
+
28
+ - **Erro óbvio com fix óbvio** (typo, import faltando, sintaxe quebrada). Apenas conserta — debug ritual é overkill.
29
+ - **Bug já tem hipótese sólida**: vai direto pro fix com confiança alta.
30
+ - **Feature nova que ainda não foi implementada** — não é bug, é falta. Vá pro `run-sprint`.
31
+ - **Falha de teste no `auto-test-guard`** se o erro for de assert claro — `auto-test-guard` já roteia pro specialist.
32
+
33
+ ## 3. The loop (5 fases, repete até convergir)
34
+
35
+ ### Stage 0 — Stack pre-resolution (per ADR-026 Layer 1)
36
+
37
+ > **MANDATORY before §3.1 Symptom framing.** Resolves the project's stack so the debug loop chooses probes that make sense for the stack (e.g. `psql` for Postgres, `redis-cli` for Redis, `docker logs` for containerized services) and so any dispatch to `qa-engineer` for the confirming test (§3.5) inherits the right knowledge pack.
38
+
39
+ Steps:
40
+
41
+ a) Invoke `stack-resolver` via Task tool:
42
+
43
+ ```
44
+ Task(
45
+ subagent_type: "stack-resolver",
46
+ description: "Resolve stack for project at CWD",
47
+ prompt: "resolve stack for project at CWD"
48
+ )
49
+ ```
50
+
51
+ b) Parse the first line of `stack-resolver` output:
52
+
53
+ - **`[STACK: <lang>/<framework>-<major> | PACK: loaded]`** — extract the full `STACK CONTEXT` block. Store as `STACK_CONTEXT_BLOCK` for use in §3.5 dispatch and as guidance for probe selection in §3.3.
54
+ - **`[STACK: <lang>/<framework>-<major> | PACK: none]`** — pack missing. Dispatch `create-stack-pack` skill conversationally; once the pack is created, repeat Stage 0a.
55
+
56
+ c) Use `STACK_CONTEXT_BLOCK` to:
57
+ - inform probe selection in §3.3 (which CLI tools, which build commands, which log format are idiomatic for this stack);
58
+ - prefix every Task dispatch to `qa-engineer` / `backend-developer` / `frontend-developer` during §3.5 fix application.
59
+
60
+ If `stack-resolver` cannot determine the stack, do NOT abort the debug — log a warning and proceed with generic probes:
61
+
62
+ ```
63
+ Stack indeterminada (CLAUDE.md sem `Primary stack`). Seguindo com probes genéricas; considere preencher Project Identity para futuras sessões.
64
+ ```
65
+
66
+ ### 3.1. Estado o sintoma — uma frase, sem interpretação
67
+
68
+ > "POST /api/v1/products retorna 500. Response body: ProblemDetail com detail='null pointer'."
69
+ > "Login funciona uma vez; segundo login no mesmo browser fica em loop de redirect."
70
+ > "Migration V12 roda local mas falha no CI com 'relation product_category does not exist'."
71
+
72
+ Regras pro sintoma:
73
+ - **Fato observado**, não suposição.
74
+ - **1 sintoma por loop**. Se há 2, escolha o mais reproduzível primeiro.
75
+ - **Reprodutível?** Se não, primeira hipótese tem que ser "como reproduzir isso de forma confiável".
76
+
77
+ ### 3.2. Formule hipóteses com confidence
78
+
79
+ Liste 2-5 hipóteses do tipo "o sintoma acontece porque X". Cada uma com:
80
+
81
+ | Campo | Conteúdo |
82
+ |---|---|
83
+ | `id` | H1, H2, ... |
84
+ | `claim` | "X causa o sintoma porque Y" |
85
+ | `confidence` | low / medium / high |
86
+ | `evidence_required` | qual probe específica confirma ou descarta |
87
+ | `cost_to_probe` | trivial (1 comando) / cheap (5min) / medium (30min) / expensive (>1h) |
88
+
89
+ Exemplo:
90
+
91
+ ```
92
+ H1: NullPointerException no controller porque o produto não tem categoria associada
93
+ confidence: medium
94
+ evidence_required: curl com produto sem categoria + log do stack trace na linha exata
95
+ cost_to_probe: trivial
96
+
97
+ H2: Bean Validation @NotNull não está sendo aplicada porque o controller ignora @Valid
98
+ confidence: low
99
+ evidence_required: grep do controller — tem @Valid no parâmetro?
100
+ cost_to_probe: trivial
101
+
102
+ H3: O mapper DTO -> entity está retornando null em caso de campo opcional
103
+ confidence: medium
104
+ evidence_required: teste unitário do mapper com input parcial
105
+ cost_to_probe: cheap (~5min)
106
+ ```
107
+
108
+ **Regra inviolável**: nunca ataque a hipótese com `confidence: high` direto — pode estar enviesado. Probe a com `confidence: medium` primeiro pra calibrar.
109
+
110
+ ### 3.3. Escolha UMA probe — a mais barata por confidence
111
+
112
+ Trade-off:
113
+ - **Trivial probe** → tente primeiro mesmo se confidence é low; o custo de descartar é zero.
114
+ - **Cheap probe** → se confidence ≥ medium.
115
+ - **Medium/Expensive** → só se confidence é high E nenhuma probe mais barata atinge.
116
+
117
+ **Stack-aware probe selection**: o `STACK_CONTEXT_BLOCK` carregado em Stage 0 indica quais probes são idiomáticas para a stack do projeto:
118
+ - Postgres → `psql`, `EXPLAIN`, `pg_stat_statements`.
119
+ - MongoDB → `mongosh`, `db.collection.find().explain()`.
120
+ - Redis → `redis-cli`, `MONITOR`.
121
+ - Java/Spring Boot → `./mvnw test`, JaCoCo report, Actuator endpoints.
122
+ - Angular → Chrome MCP console, `ng test --watch=false`, Lighthouse.
123
+ - React Native → `npx expo start`, Metro logs, Flipper.
124
+
125
+ Use o pack como referência; não invente comandos que não existem na stack do projeto.
126
+
127
+ Tipos de probe (com a tool relevante):
128
+
129
+ | Probe | Tool | Quando |
130
+ |---|---|---|
131
+ | Curl no endpoint suspeito | `Bash(curl:*)` | Reproduzir 4xx/5xx, ver response body completo |
132
+ | Tail de log estruturado | `Bash(tail:*)`, `Bash(grep:*)` | Capturar stack trace em produção/staging |
133
+ | `git log` no arquivo suspeito | `Bash(git log:*)`, `Bash(git blame:*)` | Quando o bug apareceu, quem mudou |
134
+ | `git diff` entre tag boa e atual | `Bash(git diff:*)` | Bisect manual quando "antes funcionava" |
135
+ | `psql` SELECT no banco | `Bash(psql:*)` | Estado dos dados, FK órfã, índice faltando |
136
+ | `docker logs` | `Bash(docker logs:*)` | Container errors, restart loops, OOM |
137
+ | Browser console via Chrome MCP | (no calling session) | Console.error, network failures no front |
138
+ | Grep do código | `Grep`, `Glob` | Buscar uso real do método, decorators ausentes |
139
+ | Teste unitário focado | `Write` + `Bash` | Isolar uma função do contexto |
140
+
141
+ ### 3.4. Execute a probe e classifique o resultado
142
+
143
+ A evidência confirma ou rejeita a hipótese de forma binária:
144
+
145
+ - **Confirma**: a probe mostrou exatamente o que H_i previa. Hipótese ACEITA. Vá pro fix (§3.5).
146
+ - **Rejeita**: a probe mostrou o oposto. Hipótese REJEITADA. Riscar da lista, voltar pro §3.2 com as restantes.
147
+ - **Inconclusiva**: a probe não capturou o que precisava. Escolha probe mais específica. Não pule pra outra hipótese ainda — o sinal está vindo, só não é claro.
148
+
149
+ **Regra**: SE 3 probes consecutivas retornarem inconclusivo, RECUE pro §3.1 — o sintoma pode estar mal formulado.
150
+
151
+ ### 3.5. Quando uma hipótese é confirmada — fix mínimo
152
+
153
+ - Aplique o **menor fix possível** que ataca exatamente a causa.
154
+ - **NUNCA** "aproveite e refatore" enquanto debuga. Refactor é tarefa separada — confunde análise.
155
+ - **NUNCA** comente, delete ou disable o teste que está pegando o bug (`block-test-deletion.sh` impede isso no hook).
156
+ - Adicione **um teste novo** que reproduz o bug + valida o fix. Se você só consertou e seguiu, o bug volta.
157
+ - Reruna a probe original — agora ela deve mostrar comportamento correto.
158
+
159
+ **Dispatch para `qa-engineer` (escrever o teste de confirmação) — sempre com `STACK_CONTEXT_BLOCK` prefixado:**
160
+
161
+ ```
162
+ Task(
163
+ subagent_type: "qa-engineer",
164
+ description: "Write confirming test for bug <slug>",
165
+ prompt: """<STACK_CONTEXT_BLOCK from Stage 0>
166
+
167
+ caller: pair-debug
168
+ bug_symptom: <frase do §3.1>
169
+ confirmed_hypothesis: <claim de H_i confirmada em §3.4>
170
+ fix_location: <arquivo:linhas do §3.5>
171
+
172
+ Write a single failing test that reproduces the bug verbatim (Given the same input that triggered the symptom, When the operation runs, Then the expected correct behavior is asserted). Test must fail on the pre-fix code and pass on the post-fix code. Use the testing tools and naming conventions described in the STACK CONTEXT above."""
173
+ )
174
+ ```
175
+
176
+ Para dispatch a `backend-developer` / `frontend-developer` aplicando o fix mínimo (quando a complexidade do patch justifica delegação), prefixe da mesma forma com `STACK_CONTEXT_BLOCK`.
177
+
178
+ ### 3.6. Loop fechado — relate
179
+
180
+ Após o ciclo, emita o relatório (formato no §6).
181
+
182
+ ## 4. Anti-patterns proibidos (NUNCA)
183
+
184
+ 1. **"Vou tentar mudar X e ver se funciona"** — change blind. Sem hipótese, não há aprendizado. Recusa.
185
+ 2. **Comentar/deletar/disable o teste vermelho** — bypass do gate, registrado no hook `block-test-deletion.sh`.
186
+ 3. **Adicionar log e fazer commit** sem entender. Logs sem hipótese viram lixo. Coloca log → reproduce → analisa → REMOVE o log antes do commit OU justifica como observability permanente.
187
+ 4. **`catch (Exception e) {}`** ou `@SuppressWarnings` pra fazer compilar/parar de quebrar. Esconder o sintoma piora o débito.
188
+ 5. **Pular pra "deve ser não-determinismo"** sem 3+ rodadas que provam. Não-determinismo é uma das hipóteses, não uma carta de saída.
189
+ 6. **Mudar 5 coisas e ver qual funcionou** — diff irreversível. Mude uma coisa por vez.
190
+ 7. **Pular Stage 0** — sem stack resolvida, probes viram chute e dispatches a `qa-engineer` saem sem pack. Bloqueado.
191
+
192
+ ## 5. Interface com outras skills/agents
193
+
194
+ | Skill / Agent | Quando chamar |
195
+ |---|---|
196
+ | `stack-resolver` | Stage 0 (sempre, antes de §3.1). Resolve stack e carrega knowledge pack (ADR-026 Layer 1). |
197
+ | `create-stack-pack` | Quando Stage 0 retorna `PACK: none`. Gera o pack faltante conversacionalmente. |
198
+ | `qa-engineer` | Pra escrever o teste que reproduz o bug confirmado (§3.5). Dispatch SEMPRE com `STACK_CONTEXT_BLOCK` prefixado. |
199
+ | `backend-developer` / `frontend-developer` | Implementar o fix mínimo após hipótese confirmada. Dispatch SEMPRE com `STACK_CONTEXT_BLOCK` prefixado. |
200
+ | `api-integration-test` | Curl + Chrome MCP em ambiente real — se a probe precisa do front + back rodando |
201
+ | `dba` | Quando a hipótese envolve schema/index/query plan no PostgreSQL |
202
+ | `security-engineer` | Se o bug é vulnerabilidade (XSS, SQL injection, IDOR) — VETO TÉCNICO pode disparar |
203
+ | `tech-lead` | Se 5+ hipóteses falharam OU o fix vai mudar contrato público — escala como exceção |
204
+
205
+ ## 6. Output report (sempre emite)
206
+
207
+ ```markdown
208
+ ## Pair-debug — <título do bug>
209
+
210
+ ### Stack resolvida (Stage 0)
211
+ <linha [STACK: ... | PACK: ...] retornada pelo stack-resolver>
212
+
213
+ ### Sintoma
214
+ <frase única do §3.1>
215
+
216
+ ### Hipóteses testadas
217
+ | ID | Claim | Confidence | Probe | Verdict |
218
+ |----|-------|------------|-------|---------|
219
+ | H1 | ... | medium | curl + log | rejeitada (response 200 ao invés de 500) |
220
+ | H2 | ... | low | grep do controller | rejeitada (tem @Valid sim) |
221
+ | H3 | ... | medium | unit test do mapper | **CONFIRMADA** (mapper retornou null) |
222
+
223
+ ### Causa raiz
224
+ <frase única explicando o que estava errado>
225
+
226
+ ### Fix mínimo aplicado
227
+ - Arquivo: `path/to/file.java`
228
+ - Linhas: `42-45`
229
+ - Antes: <diff -A>
230
+ - Depois: <diff -B>
231
+
232
+ ### Teste novo que cobre
233
+ - Arquivo: `path/to/FileTest.java`
234
+ - Método: `shouldXxxWhenYyy`
235
+ - Reproduz o bug original; passa após o fix.
236
+
237
+ ### Status
238
+ - ✓ Probe original (§3.1) agora retorna comportamento correto.
239
+ - ✓ Suite verde após o fix (rode `auto-test-guard`).
240
+ - ✓ Cause documented; closing the loop.
241
+
242
+ ### Tempo gasto
243
+ - <minutos do início do loop até confirmar causa raiz>
244
+ ```
245
+
246
+ ## 7. Inviolable rules
247
+
248
+ 1. **Stage 0 antes de §3.1.** Sem stack resolvida via `stack-resolver`, não começa o loop (per ADR-026 Layer 1).
249
+ 2. **Hipótese antes de probe, probe antes de fix.** Nunca fure essa ordem.
250
+ 3. **Uma mudança por loop.** Múltiplas mudanças simultâneas tornam impossível atribuir causa.
251
+ 4. **Cada bug deixa um teste pra trás.** Se você confirmou e fix sem teste, o bug volta — você só comprou tempo.
252
+ 5. **Comentar/disable teste = NON-NEGOTIABLE bloqueado.** Hook `block-test-deletion.sh` impede no PreToolUse; redundância proposital aqui.
253
+ 6. **Probe inconclusiva 3x = volta ao §3.1.** Sintoma está mal formulado.
254
+ 7. **Refactor não acontece durante debug.** Lista débito, faz depois.
255
+ 8. **Logs temporários SAEM antes do commit** OU viram observability formal com justificativa.
256
+ 9. **Dispatch a qa-engineer / developer SEMPRE com STACK_CONTEXT_BLOCK prefixado.** Sem pack inline, o agent receptor pode emitir código fora da stack do projeto.
257
+
258
+ ## 8. Example interaction
259
+
260
+ **Bug reportado** (api-integration-test): "POST /api/v1/orders retorna 500 quando o cliente tem CPF terminado em zero. Erro: `ProblemDetail{detail='invalid CPF format'}`."
261
+
262
+ **Loop**:
263
+
264
+ Stage 0: `stack-resolver` retornou `[STACK: java/spring-boot-4 | PACK: loaded]`. Pack `.claude/stacks/java/spring-boot-4.md` carregado (Bean Validation jakarta, JUnit 5, Maven build).
265
+
266
+ §3.1 Sintoma: "Endpoint retorna 500 com 'invalid CPF format' quando CPF termina em zero."
267
+
268
+ §3.2 Hipóteses:
269
+ - H1: validator de CPF trata zero à direita como inválido. confidence=medium, probe=unit test do validator com CPF terminado em 0.
270
+ - H2: o front trunca o zero antes de enviar. confidence=low, probe=curl com payload exato.
271
+
272
+ §3.3 Probe escolhida: H1 (trivial e mais provável que H2). Pack indica `./mvnw test -Dtest=...` como comando idiomático.
273
+
274
+ §3.4 Probe rodada: `./mvnw test -Dtest=CpfValidatorTest#shouldAcceptValidCpfEndingInZero` → **falha. CONFIRMA H1.**
275
+
276
+ §3.5 Fix mínimo: ajusta regex de `\d{11}` (que estava com erro de greedy match no validator). Dispatch a `qa-engineer` com prompt prefixado pelo `STACK_CONTEXT_BLOCK` de Stage 0 para adicionar teste novo cobrindo CPFs terminados em 0, 1, ..., 9.
277
+
278
+ §3.6 Probe original rerodada via curl: **retorna 201 Created.**
279
+
280
+ Relatório emitido conforme §6 (incluindo a linha Stack resolvida).
281
+
282
+ ## 9. When NOT to use this skill
283
+
284
+ - **Erro óbvio com fix óbvio** (typo, sintaxe, import faltando) — apenas conserta.
285
+ - **Bug com hipótese sólida pré-existente** — vá direto pro fix.
286
+ - **Feature ainda não implementada** — `run-sprint`, não pair-debug.
287
+ - **Refactor proativo** — não é bug.
288
+ - **Performance tuning** sem sintoma reportado — `dba` ou `tech-lead`.
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: prd-ready-check
3
+ description: Use as the FINAL GATE before deploying to production. Triggers on phrases like "is it ready for PRD?", "can it ship to production?", "run the final checklist", "validate everything before deploying", "run the prod gate", "DoD", "definition of done", "release check". This skill does NOT implement anything — it validates mvn test, npm test, mvn package, ng build --configuration=production, lint, Playwright smoke E2E, browser console clean, minimum coverage, no critical vulnerabilities, observability, database migrations, and re-runs the test-coverage-auditor as a mandatory gate (open P0/P1 = automatic NO-GO). Assumes auto-test-guard has already run during implementation and left the suite green. Returns GO or NO-GO with reasons. Any NO-GO blocks the deploy. To fix failures, return to backend-developer / frontend-developer / qa-engineer. Do NOT use to implement code (use backend-developer / frontend-developer) nor to generate tests (use auto-test-guard). PT triggers: 'tá pronto pra PRD?', 'pode subir pra produção?', 'roda o checklist final', 'valida tudo antes do deploy', 'roda o gate de prod', 'DoD', 'definição de pronto'.
4
+ tools: Read, Write, Edit, Glob, Grep, Bash(mvn:*), Bash(npm:*), Bash(npx:*)
5
+ model: sonnet
6
+ ---
7
+
8
+ # PRD-Ready Check — Production Gate
9
+
10
+ Production gatekeeper. Confidently say **GO** or **NO-GO** for deploy to PRD. Never relax the gate — broken test = NO-GO, critical warning = NO-GO, console with error = NO-GO.
11
+
12
+ Always respond in American English.
13
+
14
+ ---
15
+
16
+ ## When to trigger
17
+
18
+ - "is it ready for PRD?", "can it ship to production?"
19
+ - "run the final checklist", "validate everything before deploying"
20
+ - "run the prod gate", "DoD", "definition of done", "release check"
21
+ - PT: "tá pronto pra PRD?", "pode subir pra produção?", "roda o gate de prod", "definição de pronto"
22
+
23
+ - Implementing code → `backend-developer` / `frontend-developer` (via `project-manager` or `run-sprint`).
24
+ - Generating tests → `gate-keeper` agent (via `auto-test-guard` skill).
25
+ - Auditing coverage as standalone task → `test-coverage-auditor` skill.
26
+
27
+ ## Prerequisites
28
+
29
+ - `auto-test-guard` (gate-keeper) has run and returned GREEN on the current code.
30
+ - `test-coverage-auditor` report is up to date (no open P0 from the last audit).
31
+ - Both backend and frontend compile locally without errors.
32
+
33
+ ## Do NOT use for
34
+
35
+ - Implementing code — use `backend-developer` / `frontend-developer`.
36
+ - Generating tests — use `gate-keeper` (auto-test-guard skill).
37
+ - Auditing coverage specifically — use `test-coverage-auditor`.
38
+
39
+ ---
40
+
41
+ ## Execution
42
+
43
+ Standalone skill (Pattern 3 per ADR-037). The calling session executes the gate inline using the frontmatter `tools:` — no Task dispatch.
44
+
45
+ Follow the checklist in order: Backend tests → Frontend tests → Lint → Builds → Smoke E2E → a11y → Lighthouse → security scan → coverage auditor → migrations → observability. STOP at the first failure and return `NO-GO` with the exact stdout/stderr line. Otherwise return `GO`.
46
+
47
+ ### Hard gate (universal — every stack)
48
+
49
+ - Backend tests 100% green; coverage >= 85% lines, >= 80% branches.
50
+ - Backend mutation score >= 70% on domain + application (where wired).
51
+ - Backend build artifact succeeds (`./mvnw package`, `pip wheel`, `go build`, ...).
52
+ - Static analysis: 0 CRITICAL, 0 HIGH (SpotBugs / mypy / golangci-lint / ...).
53
+ - Dependency vulnerability scan: 0 CVE with CVSS >= 7.0.
54
+ - Frontend tests 100% green; statements >= 85%, branches >= 80%.
55
+ - Frontend build succeeds (`ng build --configuration=production` or equivalent).
56
+ - ESLint strict: 0 errors, 0 warnings on new code.
57
+ - Playwright smoke E2E: all critical flows green; Chrome MCP `read_console_messages` returns 0 errors.
58
+ - a11y component + E2E: 0 `serious` / 0 `critical`.
59
+ - Lighthouse: score >= 0.80, LCP <= 2500ms, CLS <= 0.1, TBT <= 300ms.
60
+ - `test-coverage-auditor` report up to date: 0 open P0/P1.
61
+ - DB migrations: forward + reversible for every change.
62
+ - Observability: structured JSON logs, correlation ID, `/health` responsive.
63
+
64
+ ### Stack-specific commands
65
+
66
+ Read `## Project Identity` from `CLAUDE.md` to determine the stack, then consult `.claude/stacks/<lang>/<framework>-<major>.md` for the exact `## Build & run commands` and `## Testing` invocations. If the pack is missing, dispatch the `create-stack-pack` skill first (per ADR-026).
67
+
68
+ ### Output format
69
+
70
+ ```
71
+ PRD-Ready Gate — <date> — <project>
72
+
73
+ [PASS] backend tests — coverage 89.4% lines / 82.1% branches
74
+ [PASS] frontend tests — coverage 87.6% statements
75
+ [FAIL] dependency vuln scan — CVE-2025-XXXXX (CVSS 8.1) in jackson-databind 2.15.0
76
+
77
+ Verdict: NO-GO
78
+ Routing: security-engineer (technical veto on CVSS >= 7.0)
79
+ ```
80
+
81
+ Never escalate failures to the human — dispatch the responsible specialist via `project-manager`:
82
+ - Backend tests / build → `backend-developer`
83
+ - Frontend tests / a11y / Lighthouse → `frontend-developer` (+ `ux-designer` for a11y)
84
+ - Vulnerabilities → `security-engineer` (technical veto)
85
+ - Coverage gaps → `qa-engineer`
86
+ - DB migrations → `database-engineer`