@luanpdd/kit-mcp 1.10.0 → 1.12.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 (63) hide show
  1. package/gates/ai-prompt-stability.md +120 -0
  2. package/gates/legacy-refactor-safety.md +178 -0
  3. package/gates/observability-coverage.md +151 -0
  4. package/gates/release-pipeline-policy.md +132 -0
  5. package/kit/COMANDOS.md +15 -0
  6. package/kit/agents/ai-mutation-tester.md +298 -0
  7. package/kit/agents/cascading-failures-auditor.md +306 -0
  8. package/kit/agents/executor.md +13 -0
  9. package/kit/agents/legacy-characterizer.md +378 -0
  10. package/kit/agents/load-shedding-instrumenter.md +297 -0
  11. package/kit/agents/observability-coverage-auditor.md +325 -0
  12. package/kit/agents/omm-auditor.md +47 -0
  13. package/kit/agents/payload-capture-instrumenter.md +283 -0
  14. package/kit/agents/planner.md +29 -0
  15. package/kit/agents/prr-conductor.md +8 -0
  16. package/kit/agents/refactor-safety-auditor.md +414 -0
  17. package/kit/agents/release-pipeline-auditor.md +360 -0
  18. package/kit/agents/seam-finder.md +367 -0
  19. package/kit/agents/shotgun-surgery-detector.md +359 -0
  20. package/kit/agents/storytelling-analyst.md +309 -0
  21. package/kit/agents/supabase-edge-fn-writer.md +12 -0
  22. package/kit/agents/verifier.md +30 -0
  23. package/kit/commands/auditar-cascading.md +111 -0
  24. package/kit/commands/auditar-marco.md +44 -1
  25. package/kit/commands/auditar-observabilidade-cobertura.md +183 -0
  26. package/kit/commands/auditar-refactor.md +219 -0
  27. package/kit/commands/auditar-release.md +109 -0
  28. package/kit/commands/capturar-payloads.md +193 -0
  29. package/kit/commands/caracterizar-prompt.md +195 -0
  30. package/kit/commands/caracterizar.md +212 -0
  31. package/kit/commands/concluir-marco.md +41 -1
  32. package/kit/commands/detectar-duplicacao.md +197 -0
  33. package/kit/commands/discutir-fase.md +41 -0
  34. package/kit/commands/encontrar-seams.md +136 -0
  35. package/kit/commands/forense.md +40 -1
  36. package/kit/commands/legacy.md +263 -0
  37. package/kit/commands/load-shedding.md +117 -0
  38. package/kit/commands/observabilidade.md +2 -0
  39. package/kit/commands/refactor-seguro.md +321 -0
  40. package/kit/commands/sre.md +3 -0
  41. package/kit/commands/storytelling.md +179 -0
  42. package/kit/skills/_shared-legacy/glossary.md +389 -0
  43. package/kit/skills/_shared-sre/glossary.md +139 -0
  44. package/kit/skills/ai-prompt-characterization/SKILL.md +335 -0
  45. package/kit/skills/cascading-failures/SKILL.md +307 -0
  46. package/kit/skills/four-golden-signals/SKILL.md +17 -0
  47. package/kit/skills/hermetic-builds/SKILL.md +323 -0
  48. package/kit/skills/legacy-api-only-applications/SKILL.md +358 -0
  49. package/kit/skills/legacy-characterization-tests/SKILL.md +330 -0
  50. package/kit/skills/legacy-effect-analysis/SKILL.md +331 -0
  51. package/kit/skills/legacy-extract-class/SKILL.md +203 -0
  52. package/kit/skills/legacy-monster-methods/SKILL.md +444 -0
  53. package/kit/skills/legacy-programming-by-difference/SKILL.md +252 -0
  54. package/kit/skills/legacy-seams-and-test-harness/SKILL.md +460 -0
  55. package/kit/skills/legacy-shotgun-surgery/SKILL.md +286 -0
  56. package/kit/skills/legacy-sprout-wrap-techniques/SKILL.md +434 -0
  57. package/kit/skills/legacy-storytelling-naked-crc/SKILL.md +270 -0
  58. package/kit/skills/llm-as-dependency/SKILL.md +436 -0
  59. package/kit/skills/load-shedding-graceful-degradation/SKILL.md +396 -0
  60. package/kit/skills/pre-refactor-characterization/SKILL.md +421 -0
  61. package/kit/skills/release-engineering/SKILL.md +367 -0
  62. package/kit/skills/retry-strategies/SKILL.md +372 -0
  63. package/package.json +2 -2
@@ -0,0 +1,367 @@
1
+ ---
2
+ name: release-engineering
3
+ description: Use ao desenhar/auditar pipeline de release — deployment philosophy, self-service, policy enforcement, canary, rollback, branching strategy, release invariants. Cap 8 livro Google SRE.
4
+ ---
5
+
6
+ # SRE — Release Engineering
7
+
8
+ ## Quando usar
9
+
10
+ LLM carrega esta skill ao desenhar pipeline de deploy ou ao investigar release fragility. Trigger phrases:
11
+
12
+ - "release pipeline", "deploy pipeline"
13
+ - "canary release", "rollback"
14
+ - "branching strategy", "trunk-based development"
15
+ - "deployment philosophy"
16
+ - "policy enforcement"
17
+ - "release engineering"
18
+ - "cap 8 Google SRE"
19
+
20
+ ## Regras absolutas
21
+
22
+ - **Release engineering é DISCIPLINA SEPARADA.** Cuida de "código no merge → bits em prod". Não é dev (que produz código), não é SRE clássico (que opera prod). É a ponte.
23
+ - **4 invariantes canônicos (cap 8):**
24
+ 1. **Self-service:** engineers deployam sozinhos via CLI/UI (sem aprovação manual SRE)
25
+ 2. **High velocity:** deploy ≥ 1×/dia (ideal: cada merge)
26
+ 3. **Hermetic builds:** input idêntico → output idêntico
27
+ 4. **Policy enforcement:** policies em ferramenta, não em humano
28
+ - **Trunk-based development > GitFlow.** Main sempre deployable. Feature flags para work in progress. Branches longos = harder rollback + merge hell.
29
+ - **Canary release OBRIGATÓRIO em prod.** 1% → 10% → 50% → 100% com SLO check em cada estágio. Bug detectado em 1% afeta < 1% dos users.
30
+ - **Rollback < 5 min, exercitado.** Schema migrations sempre forward-compatible OR reversible. Artefato N-1 preservado.
31
+ - **Config separada de código (12-factor).** Config versionada, audit-able, GitOps. ConfigMaps, env vars, feature flags. NUNCA hardcoded em image.
32
+ - **Continuous build + test + deploy.** Cada commit dispara pipeline. Deploy contínuo (push tag → prod) preferred a continuous delivery (deploy disponível mas manual).
33
+ - **Release pipeline tem audit trail.** Quem deployou, quando, qual commit, qual artefato. Auto-gerado via CI logs + tags + GitHub Releases.
34
+
35
+ ## Patterns canônicos
36
+
37
+ ### Pattern 1: 4 invariantes canônicos
38
+
39
+ ```text
40
+ 1. SELF-SERVICE
41
+ ============
42
+ ANTI: engineer abre ticket → SRE aprova → SRE deploya
43
+ CERTO: engineer roda `gh workflow run deploy.yml` → workflow valida policies →
44
+ deploy automático
45
+ Implementação: GitHub Actions / GitLab CI / Argo CD com approval rules.
46
+
47
+ 2. HIGH VELOCITY
48
+ ==============
49
+ Métrica DORA: deployment frequency
50
+ Elite: multiple per day
51
+ High: weekly
52
+ Medium: monthly
53
+ Low: < monthly (problem)
54
+ Implementação: trunk-based + feature flags + small commits + CI fast.
55
+
56
+ 3. HERMETIC BUILDS (skill separada)
57
+ =================================
58
+ Mesmo commit + lockfile → mesmo artefato. SLSA Level 3+.
59
+
60
+ 4. POLICY ENFORCEMENT
61
+ ===================
62
+ Policies em ferramenta, não em humanos:
63
+ - branch protection (no direct push to main)
64
+ - required reviewers (≥ 1 ou ≥ 2 dependendo de criticality)
65
+ - required CI checks (build + test + lint + security scan)
66
+ - signed commits (GPG keys)
67
+ - production deploy só de tagged releases
68
+ Implementação: GitHub branch protection + CODEOWNERS + custom Actions.
69
+ ```
70
+
71
+ ### Pattern 2: Trunk-based development workflow
72
+
73
+ ```text
74
+ Trunk-based (Google + Facebook + Netflix):
75
+
76
+ main (deployable)
77
+ ├── feat/A (24-48h) → merge → DELETE branch
78
+ ├── feat/B (24-48h) → merge → DELETE branch
79
+ └── ...
80
+
81
+ Pré-requisitos:
82
+ ✓ Feature flags para work in progress (incomplete features hidden)
83
+ ✓ CI rápido (≤ 10min) — feedback fast
84
+ ✓ Tests forte (> 80% coverage; flaky < 1%)
85
+ ✓ Pair programming OU async PR review
86
+
87
+ vs GitFlow:
88
+ - develop branch (3-7 dias)
89
+ - release branch (1-3 dias)
90
+ - hotfix branch (em incident)
91
+ - main reflete prod
92
+ PROBLEMS: merge hell, slow integration, branch divergence
93
+
94
+ Quando preferir GitFlow (raramente):
95
+ - Long release cycles obrigatórios (regulamentação healthcare/finance)
96
+ - Customers need múltiplas versões em paralelo (LTS branches)
97
+ ```
98
+
99
+ ### Pattern 3: Canary release pipeline canônico
100
+
101
+ ```yaml
102
+ # GitHub Actions deploy.yml — canary release
103
+ name: Deploy
104
+
105
+ on:
106
+ push:
107
+ tags: ['v*']
108
+
109
+ jobs:
110
+ build:
111
+ runs-on: ubuntu-latest
112
+ steps:
113
+ - uses: actions/checkout@v6
114
+ - run: pnpm install --frozen-lockfile
115
+ - run: pnpm build
116
+ - uses: actions/upload-artifact@v4
117
+ with: { name: dist, path: dist/ }
118
+
119
+ canary-1pct:
120
+ needs: build
121
+ runs-on: ubuntu-latest
122
+ steps:
123
+ - uses: actions/download-artifact@v4
124
+ - run: ./scripts/deploy-canary.sh --percent 1
125
+ - run: sleep 600 # observe por 10 min
126
+ - run: ./scripts/check-slo.sh --window 10m --threshold 99.9
127
+ # Se SLO falhar → workflow falha → human intervention
128
+
129
+ canary-10pct:
130
+ needs: canary-1pct
131
+ runs-on: ubuntu-latest
132
+ steps:
133
+ - run: ./scripts/deploy-canary.sh --percent 10
134
+ - run: sleep 600
135
+ - run: ./scripts/check-slo.sh --window 10m --threshold 99.9
136
+
137
+ canary-50pct:
138
+ needs: canary-10pct
139
+ runs-on: ubuntu-latest
140
+ steps:
141
+ - run: ./scripts/deploy-canary.sh --percent 50
142
+ - run: sleep 600
143
+ - run: ./scripts/check-slo.sh --window 10m --threshold 99.9
144
+
145
+ full-rollout:
146
+ needs: canary-50pct
147
+ runs-on: ubuntu-latest
148
+ steps:
149
+ - run: ./scripts/deploy-full.sh
150
+ - run: sleep 1800 # observe por 30 min
151
+ - run: ./scripts/check-slo.sh --window 30m --threshold 99.9
152
+ ```
153
+
154
+ **SLO check em cada stage:** burn rate ≤ baseline × 2 = OK; > 2 = abort + rollback.
155
+
156
+ ### Pattern 4: Rollback canônico
157
+
158
+ ```bash
159
+ # PT-BR: rollback workflow
160
+ # Pré-requisito: artefato N-1 preservado (image registry, S3, etc.)
161
+
162
+ # 1. Detectar problema (manual OR auto via SLO burn alert v1.9)
163
+ # 2. Identificar versão atual + anterior
164
+ CURRENT=$(kubectl get deployment app -o jsonpath='{.spec.template.spec.containers[0].image}')
165
+ PREVIOUS=$(./scripts/get-previous-deploy.sh app)
166
+
167
+ # 3. Rollback (1 comando)
168
+ kubectl set image deployment/app app="$PREVIOUS"
169
+
170
+ # 4. Verificar — SLO burn estabilizou?
171
+ ./scripts/check-slo.sh --window 5m --threshold 99.9
172
+
173
+ # 5. Audit trail — registrar em incident
174
+ echo "Rollback de $CURRENT para $PREVIOUS at $(date)" >> .planning/incidents/<id>.md
175
+
176
+ # Target: rollback < 5 min, da decisão à observabilidade estabilizada
177
+ ```
178
+
179
+ **Schema migration considerations:**
180
+ - ADD column nullable + default → forward-compatible (rollback OK)
181
+ - DROP column → NOT-rollback-able (forward-fix required)
182
+ - ALTER column NOT NULL com default → reversible se default preservado
183
+ - Sempre escrever migration UP + DOWN (mesmo que UP forward-only)
184
+
185
+ ### Pattern 5: Configuration management (12-factor)
186
+
187
+ ```text
188
+ 12-factor app princípios canônicos:
189
+
190
+ I. Codebase — single repo per app
191
+ II. Dependencies — explicit (lockfile)
192
+ III. Config — env vars OR ConfigMap (NÃO hardcoded)
193
+ IV. Backing services — attached resources via env
194
+ V. Build/Release/Run — strict separation
195
+ VI. Processes — stateless
196
+ VII. Port binding — self-contained
197
+ VIII. Concurrency — scale via process model
198
+ IX. Disposability — fast startup + graceful shutdown
199
+ X. Dev/prod parity — same code, same DB type, same OS
200
+ XI. Logs — stdout/stderr (não files)
201
+ XII. Admin processes — one-off scripts em mesmo env
202
+
203
+ Implementação Supabase:
204
+ - Edge Function env vars: Deno.env.get('SUPABASE_URL') etc.
205
+ - Secrets via supabase secrets set
206
+ - Config NÃO commitado (tem .env.example, sem .env)
207
+ - Migrations via supabase/migrations (versionado)
208
+ - Feature flags via env OR Supabase row em config table
209
+ ```
210
+
211
+ ### Pattern 6: Branch protection + CODEOWNERS
212
+
213
+ ```yaml
214
+ # .github/CODEOWNERS
215
+ # PT-BR: define quem revisa cada path
216
+
217
+ # Default — qualquer maintainer
218
+ * @luanpdd
219
+
220
+ # Critical paths — exigir aprovação SRE
221
+ /supabase/migrations/ @luanpdd @sre-team
222
+ /src/auth/ @luanpdd @security-team
223
+ /.github/workflows/ @luanpdd @sre-team
224
+ /gates/ @luanpdd
225
+
226
+ # UI changes — designer review
227
+ /src/components/ @luanpdd @design-team
228
+ ```
229
+
230
+ ```text
231
+ GitHub branch protection rules para `main`:
232
+ ✓ Require pull request before merging
233
+ ✓ Require approvals: 1 (or 2 for critical)
234
+ ✓ Dismiss stale reviews on push
235
+ ✓ Require review from CODEOWNERS
236
+ ✓ Require status checks: build, test, lint
237
+ ✓ Require branches up to date
238
+ ✓ Require signed commits
239
+ ✓ Restrict who can push: empty (force PR)
240
+ ✗ Allow force push: NEVER
241
+ ✗ Allow deletions: NEVER
242
+ ```
243
+
244
+ ### Pattern 7: Audit trail canônico
245
+
246
+ ```text
247
+ Cada release tem audit trail completo:
248
+
249
+ 1. Commit message (what + why)
250
+ 2. PR description (context + breaking changes + migrations)
251
+ 3. PR reviewers (who approved)
252
+ 4. CI logs (build provenance + test results)
253
+ 5. Deploy logs (who triggered, when, which artifact)
254
+ 6. GitHub Release (changelog + tagged commit)
255
+ 7. Monitoring (SLO/golden signals during/after deploy)
256
+
257
+ Tools:
258
+ - GitHub Releases — auto-generated changelog
259
+ - Sentry/Datadog — track release_id em events
260
+ - Slack/PagerDuty — notification em deploy
261
+ - SLSA attestation — provenance signed
262
+ ```
263
+
264
+ ## Anti-patterns
265
+
266
+ ### ANTI: aprovação humana manual em release
267
+
268
+ ```text
269
+ ANTI: cada deploy → SRE checa, aprova, deploya manualmente.
270
+
271
+ PROBLEMA: SRE bottleneck. Deploys raros (1×/semana). Velocity colapsa.
272
+ Toil para SRE.
273
+
274
+ CERTO: policies em ferramenta. Engineer self-deploys. SRE escreve
275
+ guard rails (canary, SLO check), não aprovações ad-hoc.
276
+ ```
277
+
278
+ ### ANTI: deploy de branch local
279
+
280
+ ```text
281
+ ANTI: dev faz `kubectl apply` da máquina dele.
282
+
283
+ PROBLEMA: drift entre git e prod. Sem audit trail. Sem CI check.
284
+ Quando precisa rollback, "qual era a versão?".
285
+
286
+ CERTO: deploy SOMENTE de CI. Local push to prod proibido em
287
+ branch protection. Pipeline valida + deploya + audit.
288
+ ```
289
+
290
+ ### ANTI: rollback "vai dar conta no forward-fix"
291
+
292
+ ```text
293
+ ANTI: cultura "nunca rollback". Sempre forward-fix.
294
+
295
+ PROBLEMA: forward-fix sob pressão = mais bugs. Rollback nunca
296
+ exercitado, quando precisa não funciona.
297
+
298
+ CERTO: rollback < 5min em qualquer release, exercitado mensalmente.
299
+ Forward-fix é exception, não default.
300
+ ```
301
+
302
+ ### ANTI: schema migration NOT NULL sem default
303
+
304
+ ```text
305
+ ANTI: ALTER TABLE orders ADD COLUMN priority INTEGER NOT NULL;
306
+
307
+ PROBLEMA: migration falha em rows existentes. Rollback custoso.
308
+ Code novo + DB velho = error.
309
+
310
+ CERTO: ADD COLUMN priority INTEGER DEFAULT 0 NOT NULL;
311
+ Forward-compatible (old code ignora; new code usa).
312
+ Rollback de code OK porque DB tem default.
313
+ ```
314
+
315
+ ### ANTI: feature flag sem expiration
316
+
317
+ ```text
318
+ ANTI: flags acumulam, nunca removidas. 50 flags em prod, 30 ativas.
319
+
320
+ PROBLEMA: cognitive load. Combinations untested. Flag Y desligado
321
+ há 6 meses ainda no código (dead code).
322
+
323
+ CERTO: flags têm DATA DE EXPIRAÇÃO. Após launch + 30d safe → REMOVE
324
+ flag (e código do branch perdedor). Cleanup é parte da
325
+ feature, não opcional.
326
+ ```
327
+
328
+ ### ANTI: hotfix direct push em main
329
+
330
+ ```text
331
+ ANTI: incident → dev pushar direto em main "pra ser rápido".
332
+
333
+ PROBLEMA: bypass branch protection. Sem review. Sem CI.
334
+ Pode introduzir novo bug.
335
+
336
+ CERTO: hotfix ainda via PR (mesmo se rápido — 5min review). CI
337
+ roda. Branch protection ativa. Audit trail preserved.
338
+ "Rápido" não é desculpa pra atalhar safety.
339
+ ```
340
+
341
+ ## Verificação
342
+
343
+ 1. Self-service deploy ativo (engineers deployam sozinhos)
344
+ 2. Trunk-based OR justified GitFlow exception
345
+ 3. Canary release pipeline (1% → 10% → 50% → 100% com SLO check)
346
+ 4. Rollback testado mensalmente; < 5 min
347
+ 5. Branch protection em main (no direct push, required PR + CI + reviewers)
348
+ 6. CODEOWNERS para paths críticos
349
+ 7. Lockfile commitado + frozen-install em CI
350
+ 8. Build provenance via SLSA
351
+ 9. Config 12-factor (env vars, GitOps)
352
+ 10. Feature flags com expiration policy
353
+ 11. Audit trail completo (commit + PR + CI + deploy + monitoring)
354
+
355
+ ---
356
+
357
+ ## Ver também
358
+
359
+ - [`_shared-sre/glossary.md`](../_shared-sre/glossary.md) — vocabulário (release pipeline, canary, rollback, etc.)
360
+ - [`hermetic-builds`](../hermetic-builds/SKILL.md) (v1.11) — fundação técnica
361
+ - [`production-readiness-review`](../production-readiness-review/SKILL.md) (v1.10) — PRR Axe 5 (Change Management)
362
+ - [`eliminating-toil`](../eliminating-toil/SKILL.md) (v1.10) — manual deployment é toil clássico
363
+ - [`release-pipeline-auditor`](../../agents/release-pipeline-auditor.md) (v1.11) — agent que audita
364
+ - [`/auditar-release`](../../commands/auditar-release.md) (v1.11) — comando
365
+ - [`/concluir-marco`](../../commands/concluir-marco.md) (framework + patch v1.11) — gate `release-pipeline-policy` opt-in
366
+
367
+ *Material-fonte: Site Reliability Engineering — Beyer/Jones/Petoff/Murphy (Google/O'Reilly, 2016) — Cap 8: "Release Engineering". Plus 12-factor app (12factor.net), DORA metrics.*