@luanpdd/kit-mcp 1.7.0 → 1.9.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 (70) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +39 -1
  3. package/gates/agent-no-recursive-dispatch.md +48 -0
  4. package/gates/budget-description.md +68 -0
  5. package/gates/no-personal-uuid.md +72 -0
  6. package/gates/obs-agents-mcp-supabase.md +86 -0
  7. package/gates/obs-skills-frontmatter.md +76 -0
  8. package/gates/omm-no-regression.md +83 -0
  9. package/gates/skill-must-include.md +71 -0
  10. package/gates/sync-idempotent.md +62 -0
  11. package/kit/agents/burn-rate-forecaster.md +160 -0
  12. package/kit/agents/codebase-mapper.md +1 -1
  13. package/kit/agents/executor.md +17 -0
  14. package/kit/agents/incident-investigator.md +245 -0
  15. package/kit/agents/observability-instrumenter.md +200 -0
  16. package/kit/agents/omm-auditor.md +199 -0
  17. package/kit/agents/planner.md +35 -0
  18. package/kit/agents/project-researcher.md +1 -1
  19. package/kit/agents/schema-checker.md +4 -4
  20. package/kit/agents/slo-engineer.md +224 -0
  21. package/kit/agents/supabase-architect.md +166 -0
  22. package/kit/agents/supabase-auth-bootstrapper.md +315 -0
  23. package/kit/agents/supabase-edge-fn-writer.md +207 -0
  24. package/kit/agents/supabase-migration-writer.md +174 -0
  25. package/kit/agents/supabase-realtime-implementer.md +275 -0
  26. package/kit/agents/supabase-rls-writer.md +235 -0
  27. package/kit/agents/supabase-storage-implementer.md +258 -0
  28. package/kit/agents/user-profiler.md +1 -1
  29. package/kit/agents/verifier.md +1 -1
  30. package/kit/commands/auditar-marco.md +22 -1
  31. package/kit/commands/auditar-observabilidade.md +103 -0
  32. package/kit/commands/burn-rate-status.md +140 -0
  33. package/kit/commands/concluir-marco.md +19 -1
  34. package/kit/commands/definir-slo.md +108 -0
  35. package/kit/commands/depurar.md +17 -0
  36. package/kit/commands/discutir-fase.md +26 -0
  37. package/kit/commands/fazer.md +15 -0
  38. package/kit/commands/forense.md +20 -1
  39. package/kit/commands/instrumentar-fase.md +200 -0
  40. package/kit/commands/investigar-producao.md +162 -0
  41. package/kit/commands/observabilidade.md +116 -0
  42. package/kit/commands/planejar-fase.md +20 -0
  43. package/kit/commands/supabase.md +148 -0
  44. package/kit/commands/verificar-trabalho.md +26 -0
  45. package/kit/framework/workflows/discuss-phase.md +19 -0
  46. package/kit/framework/workflows/plan-phase.md +25 -0
  47. package/kit/skills/_shared-observability/glossary.md +396 -0
  48. package/kit/skills/_shared-supabase/glossary.md +180 -0
  49. package/kit/skills/burn-rate-alerting/SKILL.md +258 -0
  50. package/kit/skills/core-analysis-loop/SKILL.md +352 -0
  51. package/kit/skills/distributed-tracing/SKILL.md +362 -0
  52. package/kit/skills/event-based-slos/SKILL.md +274 -0
  53. package/kit/skills/observability-driven-development/SKILL.md +315 -0
  54. package/kit/skills/observability-maturity-model/SKILL.md +222 -0
  55. package/kit/skills/opentelemetry-standard/SKILL.md +351 -0
  56. package/kit/skills/structured-events/SKILL.md +265 -0
  57. package/kit/skills/supabase-auth-ssr/SKILL.md +260 -0
  58. package/kit/skills/supabase-cron-queues/SKILL.md +266 -0
  59. package/kit/skills/supabase-database-functions/SKILL.md +247 -0
  60. package/kit/skills/supabase-declarative-schema/SKILL.md +183 -0
  61. package/kit/skills/supabase-edge-functions/SKILL.md +242 -0
  62. package/kit/skills/supabase-migrations/SKILL.md +175 -0
  63. package/kit/skills/supabase-pgvector-rag/SKILL.md +253 -0
  64. package/kit/skills/supabase-postgres-style/SKILL.md +138 -0
  65. package/kit/skills/supabase-realtime/SKILL.md +236 -0
  66. package/kit/skills/supabase-rls-policies/SKILL.md +185 -0
  67. package/kit/skills/supabase-storage/SKILL.md +234 -0
  68. package/kit/skills/telemetry-pipelines/SKILL.md +259 -0
  69. package/kit/skills/telemetry-sampling/SKILL.md +256 -0
  70. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,107 @@ Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) · Versioning:
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.8.1] - 2026-05-06
10
+
11
+ Patch de integração da Suíte Supabase v1.8.0 — fecha 7 lacunas onde o conteúdo novo não estava "wired" nos pontos de entrada existentes do framework.
12
+
13
+ ### Mudado — integração entre Suíte Supabase e fluxo padrão
14
+
15
+ - **`/fazer`** (`kit/commands/fazer.md`) — adicionada linha "Tarefa Supabase → `/supabase`" na decision tree + parágrafo "Detecção de intenção Supabase" listando 7 categorias de termos (DB / Auth / Realtime / Edge / Storage / RAG / Background) que devem rotear para `/supabase` em vez de `/discutir-fase` ou `/expresso`.
16
+ - **`planner` agent** (`kit/agents/planner.md`) — nova seção `<specialized_agents>` instrui o planner a delegar para `supabase-*` agents (architect, migration-writer, rls-writer, edge-fn-writer, realtime-implementer, auth-bootstrapper, storage-implementer) em fases Supabase em vez de gerar tasks genéricas para o `executor` resolver inline.
17
+ - **`executor` agent** (`kit/agents/executor.md`) — nova tabela "Delegação para agents especializados" lista 8 patterns de task (migrations, schemas declarative, RLS, Edge Functions, Realtime, Auth bootstrap, Storage, schema-checker) com `Task(subagent_type=...)` correto. Princípio: agent especializado é mais barato + mais correto que o executor genérico em domínios cobertos.
18
+ - **`/depurar`** (`kit/commands/depurar.md`) — `<available_agent_types>` agora inclui `schema-checker`. Nova seção `<supabase_pre_check>` faz triagem de bugs SQL/Supabase e pré-valida via `schema-checker` antes do `debugger` genérico (5 sintomas mapeados: migration falhou, RLS quebrou query, Edge Function quebrou, user_metadata em policy, service_role exposto).
19
+ - **`discuss-phase` workflow** (`kit/framework/workflows/discuss-phase.md`) — nova seção `<supabase_detection>` antes da identificação de áreas cinzentas. Se a fase é Supabase, delega o questionamento para `supabase-architect` (que já tem template de perguntas Supabase-específicas) em vez de gerar gray areas genéricas.
20
+ - **`plan-phase` workflow** (`kit/framework/workflows/plan-phase.md`) — `<available_agent_types>` agora inclui agents Supabase. Nova seção `<supabase_phase_detection>` no Step 1 — se fase é Supabase, usa `supabase-architect` em vez de `phase-researcher` genérico, e instrui o `planner` a marcar tasks com `subagent_type` apontando para o agent especializado correto (tabela com 7 patterns).
21
+ - **CI** (`.github/workflows/ci.yml`) — novo step "Audit — v1.8 Supabase suite gates" que executa os 4 gates blocking (`budget-description`, `no-personal-uuid`, `agent-no-recursive-dispatch`, `skill-must-include`) extraindo o bash check de cada `gates/<name>.md` e rodando. Falha o CI se algum violar. Gate non-blocking `sync-idempotent` defer (exige CLI completo).
22
+
23
+ ### Adicionado — agentes existentes ganham awareness Supabase
24
+
25
+ Sem novos arquivos. As 6 edições em arquivos de agent/workflow/command existentes integram o conteúdo da v1.8.0 nos pontos de entrada que LLMs usam, fechando o gap "conteúdo entregue mas não chamado".
26
+
27
+ ### Sem mudanças de API runtime
28
+
29
+ Patch v1.8.1 continua content-only. Zero alterações em `src/core/`, `registry.js`, `sync.js`. Stable API v1.0+ preservada.
30
+
31
+ ### Tests
32
+
33
+ Todos os 4 gates blocking continuam passing após o patch. CI agora os roda explicitamente — Phase 28 deixou os specs prontos mas sem step de execução.
34
+
35
+ ## [1.8.0] - 2026-05-06
36
+
37
+ Milestone v1.8 — Suíte Supabase: primeira coleção especializada de skills+agents+command focada em um stack concreto. 31 REQs em 4 fases (Phases 25-28).
38
+
39
+ ### Adicionado — 11 skills Supabase canônicas (Phase 25)
40
+
41
+ Cada skill é auto-contida (sem `references/` folder), com frontmatter `description ≤ 200 chars`, template fixo de 5 seções (Quando usar / Regras absolutas / Patterns canônicos / Anti-patterns / Ver também), code blocks EN com comentários PT-BR pedagógicos, e cross-refs via Markdown link relativo.
42
+
43
+ - `supabase-realtime` — broadcast vs postgres_changes, `private: true` obrigatório, naming `scope:entity:id`, `realtime.broadcast_changes` triggers, `removeChannel` cleanup
44
+ - `supabase-auth-ssr` — Next.js v16 + `@supabase/ssr` (NUNCA `auth-helpers-nextjs`), padrão `getAll`/`setAll` exclusivo, middleware com `getUser()` + redirects, single serverClient factory
45
+ - `supabase-edge-functions` — Deno runtime, imports `npm:`/`jsr:` versionados, env vars pre-populadas, `Deno.serve`, `EdgeRuntime.waitUntil`, file writes apenas em `/tmp`, basePath `/<function-name>`
46
+ - `supabase-declarative-schema` — workflow `supabase/schemas/` → `supabase stop` → `db diff -f` → revisar → apply, com caveats sobre views, RLS, partitions
47
+ - `supabase-rls-policies` — REGRA #1 absoluta `(select auth.uid())` wrapper, WARNING `user_metadata` em autorização (privilege escalation), policies granulares por operação, `to authenticated`/`to anon` explícito, indexes obrigatórios, MFA via `aal2`
48
+ - `supabase-database-functions` — `SECURITY INVOKER` por default, `set search_path = ''` SEMPRE (lint advisor 0011), schema-qualified names, `IMMUTABLE`/`STABLE` quando aplicável
49
+ - `supabase-migrations` — naming `YYYYMMDDHHmmss_<name>.sql` UTC, header de metadados, RLS obrigatório em toda nova tabela, granular policies, comentários extensivos em comandos destrutivos
50
+ - `supabase-postgres-style` — lowercase reserved, `snake_case`, plurais para tabelas/singular para colunas, `ISO 8601`, CTEs lineares para queries complexas
51
+ - `supabase-storage` — buckets públicos vs privados, `signed URL` com expiration, RLS sobre `storage.objects` com multi-tenant path isolation, image transforms (Pro+), TUS para uploads > 6 MB, awareness de egress billing
52
+ - `supabase-pgvector-rag` — `create extension vector`, dim consistente por modelo, `HNSW` (default 2026) vs `IVFFlat`, operadores `<=>`/`<#>`/`<->`, RAG with permissions via RLS, chunking 200-500 tokens
53
+ - `supabase-cron-queues` — `pg_cron` + `pgmq` (Postgres 15.6.1.143+) + `pg_net` v0.10.0+, pattern canônico `cron → pgmq → Edge Function`, idempotência obrigatória em consumers
54
+
55
+ Plus glossário compartilhado em `kit/skills/_shared-supabase/glossary.md` — termos PT-BR↔EN, comandos CLI canônicos, patterns canônicos consolidados (não-skill, arquivo de referência).
56
+
57
+ ### Adicionado — 7 agents Supabase + convenção universal (Phase 26)
58
+
59
+ Cada agent inclui tabela `## Compatibilidade` por IDE (Full / Partial / Offline-only), preflight detection MCP no Step 0 (declara MODO OFFLINE explícito se MCP indisponível — NUNCA finge sucesso), output em layout canônico do CLI Supabase (`supabase/migrations/`, `supabase/schemas/`, `supabase/functions/<name>/`), e frontmatter `tools:` com nomes canônicos `mcp__supabase__*` (zero UUIDs).
60
+
61
+ - `supabase-architect` (blue) — projeta schema + RLS + topologia realtime ANTES da implementação. Pergunta tier (Free/Pro/Team/Enterprise) upfront via `AskUserQuestion`. Alerta sobre Free pause + branch billing. NÃO escreve código.
62
+ - `supabase-migration-writer` (yellow) — escreve migrations seguindo declarative schema + RLS obrigatório + style guide. Detecta layout `schemas/` vs `migrations/` no boot. Aplica via `mcp__supabase__apply_migration` se MCP disponível; modo offline gera SQL.
63
+ - `supabase-rls-writer` (red) — gera 4 policies granulares por operação com `(select auth.uid())` wrapper + indexes recomendados. **ABORTA explicitamente** se input menciona `user_metadata` em policy de autorização.
64
+ - `supabase-edge-fn-writer` (cyan) — escreve Edge Functions Deno com `npm:`/`jsr:` versionados, `Deno.serve`, env vars pre-populadas, file writes em `/tmp`, basePath em multi-rota. Alerta cold start em bundles grandes.
65
+ - `supabase-realtime-implementer` (magenta) — configura 3 layers (RLS sobre `realtime.messages` + trigger DB via `realtime.broadcast_changes` + client subscribe com cleanup obrigatório). Migra `postgres_changes` para `broadcast`.
66
+ - `supabase-auth-bootstrapper` (green) — bootstrap Next.js v16 com `@supabase/ssr` (browser client + server client + middleware completo). **Audita `.env*` files** e ABORTA se detectar `NEXT_PUBLIC_*SERVICE*` (service_role leak).
67
+ - `supabase-storage-implementer` (orange) — configura bucket + RLS sobre `storage.objects` com multi-tenant path (`<auth.uid()>/<file>`) + client code (upload + signedURL). Suporta TUS para uploads grandes.
68
+
69
+ ### Adicionado — Command `/supabase` orquestrador único (Phase 27)
70
+
71
+ `kit/commands/supabase.md` aceita 10 subcomandos com sinônimos PT-BR/EN: `arquiteto|architect`, `migration|migrar`, `rls`, `edge|edge-function|funcao`, `realtime|tempo-real`, `auth|autenticacao`, `storage|armazenamento`, `rag|pgvector|embeddings`, `cron|queues|pgmq|background`, `check|validar` (invoca `schema-checker` existente), `help|ajuda|?`.
72
+
73
+ Detecta `supabase/config.toml` para extrair `project_id`. Dispatch via `Task(subagent_type=supabase-...)`. **É o único ponto de chain de agents Supabase** — agents permanecem função pura (anti-pitfall A10).
74
+
75
+ ### Adicionado — 5 audit gates novos (Phase 28)
76
+
77
+ Markdown specs em `gates/` com `## Check` em bash:
78
+
79
+ - `gates/budget-description.md` — valida `description ≤ 200 chars` em todo agent/command/skill (anti-pitfall A2 — CLAUDE.md inflation)
80
+ - `gates/no-personal-uuid.md` — detecta UUIDs `[0-9a-f]{8}-...` em frontmatter ou body de `kit/{agents,commands,skills}/` (anti-pitfall A12)
81
+ - `gates/agent-no-recursive-dispatch.md` — valida zero `Task(...subagent_type=...supabase-...)` em `kit/agents/supabase-*.md` (anti-pitfall A10)
82
+ - `gates/skill-must-include.md` — valida strings obrigatórias por skill verbatim — `(select auth.uid())`, `set search_path = ''`, `getAll`/`setAll`, `private: true`, `Deno.serve`, etc. (anti-pitfall A7)
83
+ - `gates/sync-idempotent.md` — valida que `kit sync claude-code` rodado 2× produz `.claude/` byte-idêntico (anti-pitfall A1, non-blocking warn)
84
+
85
+ ### Mudado — schema-checker.md UUID migration
86
+
87
+ `kit/agents/schema-checker.md` migrado de `mcp__0a712001-6cbb-44ef-a5f4-a24ea40894fa__execute_sql` (UUID do projeto pessoal do mantenedor) para `mcp__supabase__execute_sql`/`__list_tables`/`__apply_migration` (canônico). **Breaking interno:** instaladores de versões anteriores tinham um UUID que não funcionava para eles; com v1.8 funciona com qualquer Supabase MCP server configurado. Mesma funcionalidade — apenas referência canônica.
88
+
89
+ ### Sem mudanças de API runtime
90
+
91
+ v1.8 é **content-only por design** — zero alterações em `src/core/`, `registry.js`, `sync.js`. Stable API v1.0+ totalmente preservada. CI passa sem mudança em `.github/workflows/`. Deps budget mantido em 6/6 (zero deps novas — todo o conteúdo é markdown).
92
+
93
+ ### Tests
94
+
95
+ Tests existentes (115 unit + 67 integration de v1.7) continuam verde. Novos gates não têm tests dedicados (são bash em markdown, executados via `runGate` no framework de gates já testado em `test/unit/gates.test.js`).
96
+
97
+ ### Decisões arquiteturais
98
+
99
+ Validadas em `.planning/research/`:
100
+ - **Naming flat** `kit/skills/supabase-*/SKILL.md` (não subárvore — quebraria `readSkillsDir`)
101
+ - **MCP-first com fallback offline gracioso** — 5 dos 8 IDE targets não têm Supabase MCP; agents funcionam offline gerando SQL/código
102
+ - **Cross-references via Markdown link relativo** (não `@-include` — quebraria lazy-load das skills)
103
+ - **Outputs em layouts canônicos do CLI Supabase** — `supabase/migrations/`, `supabase/schemas/`, `supabase/functions/<name>/`
104
+ - **Glossário compartilhado** em `_shared-supabase/` — não é skill (sem trigger), apenas referência cross-skill
105
+
106
+ ### Detalhes
107
+
108
+ `.planning/milestones/v1.8.0/` (após `/concluir-marco`).
109
+
9
110
  ## [1.7.0] - 2026-05-06
10
111
 
11
112
  Milestone v1.7 — perf+lean part 2 + UX naming canonical: 10 REQs em 3 fases.
package/README.md CHANGED
@@ -59,10 +59,48 @@ kit-mcp/
59
59
 
60
60
  ### About the bundled workflow
61
61
 
62
- The bundled `kit/` is an opinionated **brownfield planning workflow** in Portuguese — milestones, phases, requirements, planning, execution with atomic commits and checkpoints, retrospective auditing. Installing `@luanpdd/kit-mcp` and syncing into your IDE gives you all 60 slash-commands, 19 agents, plus the framework templates that they delegate into.
62
+ The bundled `kit/` is an opinionated **brownfield planning workflow** in Portuguese — milestones, phases, requirements, planning, execution with atomic commits and checkpoints, retrospective auditing. Installing `@luanpdd/kit-mcp` and syncing into your IDE gives you all 60+ slash-commands, 24+ agents, plus the framework templates that they delegate into.
63
63
 
64
64
  If that's not what you want, point `--kit-root` at your own folder and ignore everything under `kit/` — the infrastructure (registry, sync, gates, forensics, MCP server) works the same regardless of what kit you load.
65
65
 
66
+ ### Observability suite (v1.9)
67
+
68
+ A complete observability layer derived from *Observability Engineering* (Charity Majors, Liz Fong-Jones, George Miranda — O'Reilly, 2022) ships in the kit. It integrates deeply with the Supabase suite (v1.8) — every Supabase agent now consults observability skills, and the new `incident-investigator` agent uses `mcp__supabase__get_logs` / `execute_sql` / `get_advisors` to apply the **Core Analysis Loop** on real incidents.
69
+
70
+ **11 skills** in `kit/skills/`:
71
+ - `_shared-observability/glossary.md` — canonical bilingual vocabulary (PT-BR↔EN)
72
+ - `structured-events`, `distributed-tracing`, `opentelemetry-standard`, `core-analysis-loop` — foundationals
73
+ - `observability-driven-development` — the 4 pre-PR questions ("Does it do what I expected? Compare to previous version? Are users using? Anomalies emerge?")
74
+ - `event-based-slos`, `burn-rate-alerting` — SLO definition + predictive burn alerts
75
+ - `telemetry-sampling`, `telemetry-pipelines`, `observability-maturity-model` — scale + culture
76
+
77
+ **5 agents** in `kit/agents/`:
78
+ - `observability-instrumenter` — generates OTel + canonical attribute patches
79
+ - `incident-investigator` — Core Analysis Loop with persistent state in `.planning/investigations/`
80
+ - `slo-engineer` — generates `SLO.md` + SQL migrations to materialize SLI events
81
+ - `burn-rate-forecaster` — calculates burn rate, ETA exhaustion, alert config
82
+ - `omm-auditor` — scores 5 OMM capabilities (resilience, code quality, complexity, release cadence, user behavior)
83
+
84
+ **6 commands**:
85
+ - `/observabilidade <subcommand>` — single orchestrator (analog to `/supabase`) — dispatches to the 5 agents above with PT/EN synonyms
86
+ - `/instrumentar-fase` — generates `INSTRUMENTATION.md` per plan after `/planejar-fase`
87
+ - `/investigar-producao` — guided Core Analysis Loop with persistent state
88
+ - `/definir-slo` — creates SLO definition + SQL materialized view
89
+ - `/burn-rate-status` — table `[SLO | budget burned | ETA | action]`, also runnable in `/loop`
90
+ - `/auditar-observabilidade` — generates OMM-REPORT.md scored
91
+
92
+ **Quick start example:**
93
+ ```bash
94
+ # Define an SLO for a critical journey
95
+ /observabilidade slo "checkout"
96
+
97
+ # Investigate a production incident with Core Analysis Loop
98
+ /observabilidade investigar "checkout SLO burn rate = 8 às 14:32"
99
+
100
+ # Score project against Observability Maturity Model
101
+ /observabilidade omm
102
+ ```
103
+
66
104
  ---
67
105
 
68
106
  ## Prerequisites
@@ -0,0 +1,48 @@
1
+ ---
2
+ id: agent-no-recursive-dispatch
3
+ stage: pre-verify
4
+ blocking: true
5
+ description: Valida que agents Supabase NÃO contêm Task(subagent_type=supabase-...). Orquestração só via /supabase command (anti-pitfall A10 — recursive dispatch).
6
+ ---
7
+
8
+ # Agent no recursive dispatch gate
9
+
10
+ **When to run:** pre-verify.
11
+
12
+ ## Check
13
+
14
+ ```bash
15
+ #!/usr/bin/env bash
16
+ # PT-BR: agents Supabase não devem invocar outros agents Supabase via Task()
17
+ # Orquestração centralizada no command /supabase (anti-pitfall A10)
18
+ set -e
19
+
20
+ VIOLATIONS=0
21
+
22
+ for f in kit/agents/supabase-*.md; do
23
+ [ -f "$f" ] || continue
24
+ # PT-BR: busca por Task(...subagent_type=...supabase-... ou Task(... 'supabase-...
25
+ if grep -nE 'Task\([^)]*subagent_type[^)]*supabase-' "$f"; then
26
+ echo "FAIL: $f — agent Supabase invocando outro agent Supabase via Task()"
27
+ VIOLATIONS=$((VIOLATIONS + 1))
28
+ fi
29
+ done
30
+
31
+ if [ "$VIOLATIONS" -gt 0 ]; then
32
+ echo "Total violations: $VIOLATIONS"
33
+ echo "Agents Supabase devem ser função pura. Orquestração apenas via /supabase command."
34
+ exit 1
35
+ fi
36
+
37
+ echo "✓ Zero recursive dispatch entre agents Supabase"
38
+ exit 0
39
+ ```
40
+
41
+ ## Verdict
42
+
43
+ - **passed** — zero `Task(subagent_type=supabase-...)` em `kit/agents/supabase-*.md`
44
+ - **block** — recursive dispatch detectado
45
+
46
+ ## Notes
47
+
48
+ Anti-pitfall A10 da v1.8: tentação de `supabase-architect` invocar `supabase-migration-writer` que re-invoca architect → stack overflow lógico + custo LLM multiplicado. Solução: agents permanecem função pura; chain via `/supabase` command (Phase 27 — único orquestrador autorizado).
@@ -0,0 +1,68 @@
1
+ ---
2
+ id: budget-description
3
+ stage: pre-verify
4
+ blocking: true
5
+ description: Valida que cada agent/command/skill tem `description:` ≤ 200 chars no frontmatter (anti-pitfall A2 — CLAUDE.md inflation).
6
+ ---
7
+
8
+ # Budget description gate
9
+
10
+ **When to run:** pre-verify, antes de commit final do milestone.
11
+
12
+ ## Check
13
+
14
+ ```bash
15
+ #!/usr/bin/env bash
16
+ # PT-BR: itera por todos os agent/command/skill, valida frontmatter description ≤ 200 chars
17
+ set -e
18
+
19
+ VIOLATIONS=0
20
+
21
+ # function que extrai description do YAML frontmatter
22
+ check_description() {
23
+ local file="$1"
24
+ local desc
25
+ desc=$(awk '/^description:/{sub(/^description: ?/, ""); print; exit}' "$file" 2>/dev/null || true)
26
+ if [ -z "$desc" ]; then
27
+ echo "WARN: $file — sem description: no frontmatter"
28
+ return 0
29
+ fi
30
+ local len=${#desc}
31
+ if [ "$len" -gt 200 ]; then
32
+ echo "FAIL: $file — description tem $len chars (max 200)"
33
+ VIOLATIONS=$((VIOLATIONS + 1))
34
+ fi
35
+ }
36
+
37
+ # itera agents
38
+ for f in kit/agents/*.md; do
39
+ [ -f "$f" ] && check_description "$f"
40
+ done
41
+
42
+ # itera commands
43
+ for f in kit/commands/*.md; do
44
+ [ -f "$f" ] && check_description "$f"
45
+ done
46
+
47
+ # itera skills (SKILL.md em subdirs)
48
+ for f in kit/skills/*/SKILL.md; do
49
+ [ -f "$f" ] && check_description "$f"
50
+ done
51
+
52
+ if [ "$VIOLATIONS" -gt 0 ]; then
53
+ echo "Total violations: $VIOLATIONS (max description length 200 chars)"
54
+ exit 1
55
+ fi
56
+
57
+ echo "✓ Todos os agents/commands/skills têm description ≤ 200 chars"
58
+ exit 0
59
+ ```
60
+
61
+ ## Verdict
62
+
63
+ - **passed** — todas as descriptions ≤ 200 chars
64
+ - **block** — pelo menos uma description > 200 chars (CLAUDE.md inflation)
65
+
66
+ ## Notes
67
+
68
+ Anti-pitfall A2 da v1.8: cluster `supabase-*` adiciona 19+ entradas em CLAUDE.md. Sem este budget, descriptions verbosas inflam CLAUDE.md em ~3-4 KB+ — desfaz otimização de v1.6/v1.7.
@@ -0,0 +1,72 @@
1
+ ---
2
+ id: no-personal-uuid
3
+ stage: pre-verify
4
+ blocking: true
5
+ description: Detecta UUIDs no formato [0-9a-f]{8}-[0-9a-f]{4}-... em frontmatter `tools:` ou body de skills/agents/commands. UUID pessoal quebra para outros instaladores (anti-pitfall A12).
6
+ ---
7
+
8
+ # No personal UUID gate
9
+
10
+ **When to run:** pre-verify.
11
+
12
+ ## Check
13
+
14
+ ```bash
15
+ #!/usr/bin/env bash
16
+ # PT-BR: detecta UUID em formato [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
17
+ # em frontmatter tools: ou body de kit/{agents,commands,skills}/
18
+ set -e
19
+
20
+ # allowlist: glossário menciona patterns mas não usa UUID em tools
21
+ ALLOWLIST_FILES=(
22
+ "kit/skills/_shared-supabase/glossary.md"
23
+ )
24
+
25
+ VIOLATIONS=0
26
+
27
+ is_allowlisted() {
28
+ local file="$1"
29
+ for af in "${ALLOWLIST_FILES[@]}"; do
30
+ [ "$file" = "$af" ] && return 0
31
+ done
32
+ return 1
33
+ }
34
+
35
+ check_uuid() {
36
+ local file="$1"
37
+ is_allowlisted "$file" && return 0
38
+
39
+ # PT-BR: extrair frontmatter (entre --- ... ---)
40
+ local frontmatter
41
+ frontmatter=$(awk '/^---$/{i++; next} i==1' "$file" 2>/dev/null || true)
42
+
43
+ # PT-BR: buscar UUID em frontmatter (linhas com tools: ou abaixo)
44
+ if echo "$frontmatter" | grep -qE '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'; then
45
+ echo "FAIL (frontmatter): $file"
46
+ grep -nE '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' "$file" | head -3
47
+ VIOLATIONS=$((VIOLATIONS + 1))
48
+ fi
49
+ }
50
+
51
+ for f in kit/agents/*.md; do [ -f "$f" ] && check_uuid "$f"; done
52
+ for f in kit/commands/*.md; do [ -f "$f" ] && check_uuid "$f"; done
53
+ for f in kit/skills/*/SKILL.md; do [ -f "$f" ] && check_uuid "$f"; done
54
+
55
+ if [ "$VIOLATIONS" -gt 0 ]; then
56
+ echo "Total violations: $VIOLATIONS"
57
+ echo "UUIDs pessoais quebram para outros instaladores. Use mcp__supabase__* canônico."
58
+ exit 1
59
+ fi
60
+
61
+ echo "✓ Zero UUIDs pessoais em kit/{agents,commands,skills}/"
62
+ exit 0
63
+ ```
64
+
65
+ ## Verdict
66
+
67
+ - **passed** — zero UUIDs em frontmatter ou body
68
+ - **block** — pelo menos um UUID pessoal detectado (quebra para outros users)
69
+
70
+ ## Notes
71
+
72
+ Anti-pitfall A12 da v1.8: `schema-checker.md` originalmente usava `mcp__0a712001-6cbb-44ef-a5f4-a24ea40894fa__execute_sql` (UUID do projeto pessoal do user). Distribuído via `@luanpdd/kit-mcp`, isso quebra para qualquer outro instalador. Phase 28 migra para `mcp__supabase__*` canônico. Este gate previne regressão.
@@ -0,0 +1,86 @@
1
+ ---
2
+ id: obs-agents-mcp-supabase
3
+ stage: pre-verify
4
+ blocking: true
5
+ description: Valida que agents observability que precisam de MCP Supabase declaram tools mcp__supabase__* no frontmatter (incident-investigator, slo-engineer, burn-rate-forecaster, omm-auditor).
6
+ ---
7
+
8
+ # Observability agents MCP Supabase declaration gate
9
+
10
+ **When to run:** pre-verify.
11
+
12
+ ## Check
13
+
14
+ ```bash
15
+ #!/usr/bin/env bash
16
+ # PT-BR: agents que usam MCP Supabase devem declarar tools mcp__supabase__* no frontmatter.
17
+ # Anti-pitfall: declaração ausente faz Claude Code não autorizar tool, agent falha em runtime.
18
+ set -e
19
+
20
+ VIOLATIONS=0
21
+
22
+ # PT-BR: agents que DEVEM declarar mcp__supabase__*
23
+ declare_required() {
24
+ local agent="$1"
25
+ local required_tools="$2" # tools separados por |
26
+ local file="kit/agents/$agent.md"
27
+
28
+ if [ ! -f "$file" ]; then
29
+ echo "FAIL: $file — agent ausente"
30
+ VIOLATIONS=$((VIOLATIONS + 1))
31
+ return
32
+ fi
33
+
34
+ # PT-BR: extrair frontmatter tools field (multi-line possível)
35
+ local in_frontmatter=0
36
+ local in_tools=0
37
+ local tools_block=""
38
+ while IFS= read -r line; do
39
+ if [ "$line" = "---" ]; then
40
+ if [ "$in_frontmatter" -eq 0 ]; then
41
+ in_frontmatter=1
42
+ else
43
+ break
44
+ fi
45
+ elif [ "$in_frontmatter" -eq 1 ]; then
46
+ tools_block="$tools_block $line"
47
+ fi
48
+ done < "$file"
49
+
50
+ local IFS='|'
51
+ for tool in $required_tools; do
52
+ if ! echo "$tools_block" | grep -qF "$tool"; then
53
+ echo "FAIL: $file — não declara '$tool' em frontmatter tools"
54
+ VIOLATIONS=$((VIOLATIONS + 1))
55
+ fi
56
+ done
57
+ }
58
+
59
+ # PT-BR: incident-investigator usa get_logs/execute_sql/get_advisors
60
+ declare_required "incident-investigator" "mcp__supabase__get_logs|mcp__supabase__execute_sql|mcp__supabase__get_advisors"
61
+
62
+ # PT-BR: slo-engineer usa execute_sql + apply_migration
63
+ declare_required "slo-engineer" "mcp__supabase__execute_sql|mcp__supabase__apply_migration"
64
+
65
+ # PT-BR: burn-rate-forecaster usa execute_sql
66
+ declare_required "burn-rate-forecaster" "mcp__supabase__execute_sql"
67
+
68
+ # PT-BR: omm-auditor usa execute_sql (queries SLI)
69
+ declare_required "omm-auditor" "mcp__supabase__execute_sql"
70
+
71
+ if [ "$VIOLATIONS" -eq 0 ]; then
72
+ echo "PASS: 4 agents observability declaram mcp__supabase__* corretamente"
73
+ exit 0
74
+ else
75
+ echo "FAIL: $VIOLATIONS violação(ões)"
76
+ exit 1
77
+ fi
78
+ ```
79
+
80
+ ## Why
81
+
82
+ Agents observability que aplicam Core Analysis Loop ou queries SLI dependem de `mcp__supabase__*`. Sem declaração no frontmatter `tools`, Claude Code não autoriza o tool em runtime e o agent falha (precedente: anti-pitfall identificado em v1.8 com supabase-* agents).
83
+
84
+ ## REQ
85
+
86
+ QA-02.
@@ -0,0 +1,76 @@
1
+ ---
2
+ id: obs-skills-frontmatter
3
+ stage: pre-verify
4
+ blocking: true
5
+ description: Valida que skills observability têm frontmatter completo (name + description ≤ 200 chars) e seções obrigatórias do template.
6
+ ---
7
+
8
+ # Observability skills frontmatter gate
9
+
10
+ **When to run:** pre-verify.
11
+
12
+ ## Check
13
+
14
+ ```bash
15
+ #!/usr/bin/env bash
16
+ # PT-BR: validar que cada skill em kit/skills/{structured-events,distributed-tracing,opentelemetry-standard,core-analysis-loop,observability-driven-development,event-based-slos,burn-rate-alerting,telemetry-sampling,telemetry-pipelines,observability-maturity-model}/SKILL.md
17
+ # tem frontmatter completo + seções obrigatórias.
18
+ # Portable bash 3.2+ (macOS default).
19
+ set -e
20
+
21
+ VIOLATIONS=0
22
+ SKILLS="structured-events distributed-tracing opentelemetry-standard core-analysis-loop observability-driven-development event-based-slos burn-rate-alerting telemetry-sampling telemetry-pipelines observability-maturity-model"
23
+
24
+ for skill in $SKILLS; do
25
+ file="kit/skills/$skill/SKILL.md"
26
+ if [ ! -f "$file" ]; then
27
+ echo "FAIL: $file — skill ausente"
28
+ VIOLATIONS=$((VIOLATIONS + 1))
29
+ continue
30
+ fi
31
+
32
+ # PT-BR: frontmatter name presente
33
+ if ! grep -qE '^name:' "$file"; then
34
+ echo "FAIL: $file — frontmatter 'name:' ausente"
35
+ VIOLATIONS=$((VIOLATIONS + 1))
36
+ fi
37
+
38
+ # PT-BR: frontmatter description presente
39
+ if ! grep -qE '^description:' "$file"; then
40
+ echo "FAIL: $file — frontmatter 'description:' ausente"
41
+ VIOLATIONS=$((VIOLATIONS + 1))
42
+ else
43
+ desc=$(grep -E '^description:' "$file" | head -1 | sed 's/description: //')
44
+ len=${#desc}
45
+ if [ "$len" -gt 200 ]; then
46
+ echo "FAIL: $file — description=$len chars (limite 200, anti-pitfall A2)"
47
+ VIOLATIONS=$((VIOLATIONS + 1))
48
+ fi
49
+ fi
50
+
51
+ # PT-BR: 4+ seções H2 (Quando usar, Regras absolutas, Patterns canônicos, Anti-patterns OU Verificação)
52
+ h2_count=$(grep -cE '^## ' "$file")
53
+ if [ "$h2_count" -lt 4 ]; then
54
+ echo "FAIL: $file — só $h2_count seções H2 (mínimo 4 — Quando usar, Regras absolutas, Patterns canônicos, Anti-patterns/Verificação)"
55
+ VIOLATIONS=$((VIOLATIONS + 1))
56
+ fi
57
+ done
58
+
59
+ if [ "$VIOLATIONS" -eq 0 ]; then
60
+ echo "PASS: 10 skills observability com frontmatter completo + 4+ seções H2"
61
+ exit 0
62
+ else
63
+ echo "FAIL: $VIOLATIONS violação(ões)"
64
+ exit 1
65
+ fi
66
+ ```
67
+
68
+ ## Why
69
+
70
+ - Skills sem `description` não aparecem em `listKit` (LLM não acha o trigger)
71
+ - `description > 200 chars` infla CLAUDE.md desnecessariamente (anti-pitfall A2)
72
+ - Skills sem template fixo geram outputs inconsistentes — gate força padrão.
73
+
74
+ ## REQ
75
+
76
+ QA-01.
@@ -0,0 +1,83 @@
1
+ ---
2
+ id: omm-no-regression
3
+ stage: pre-conclude
4
+ blocking: false
5
+ description: Valida que nenhuma das 5 capacidades OMM regrediu vs marco anterior. Rodável em /concluir-marco. Não-bloqueante (warn) por default; configurável via workflow.omm_no_regression.
6
+ ---
7
+
8
+ # OMM no-regression gate
9
+
10
+ **When to run:** pre-conclude (antes de `/concluir-marco` arquivar marco).
11
+
12
+ ## Check
13
+
14
+ ```bash
15
+ #!/usr/bin/env bash
16
+ # PT-BR: validar que OMM-REPORT.md atual não tem capacidade regredida vs marco anterior.
17
+ # Estratégia: comparar scores no OMM-REPORT.md atual vs último arquivado.
18
+ set -e
19
+
20
+ CURRENT=".planning/OMM-REPORT.md"
21
+
22
+ if [ ! -f "$CURRENT" ]; then
23
+ echo "WARN: $CURRENT ausente — rodar /auditar-observabilidade primeiro. Pulando gate."
24
+ exit 0
25
+ fi
26
+
27
+ # PT-BR: encontrar OMM-REPORT.md anterior em milestones arquivados
28
+ PREVIOUS=$(find .planning/milestones -name "OMM-REPORT.md" -type f 2>/dev/null | sort -r | head -1)
29
+
30
+ if [ -z "$PREVIOUS" ] || [ ! -f "$PREVIOUS" ]; then
31
+ echo "INFO: sem OMM-REPORT anterior arquivado (primeiro marco com OMM). Pulando regression check."
32
+ exit 0
33
+ fi
34
+
35
+ # PT-BR: extrair scores do OMM-REPORT.md atual e anterior
36
+ # Formato esperado: "| 1 | Resiliência | 3 | ... |"
37
+
38
+ REGRESSIONS=0
39
+ for cap in 1 2 3 4 5; do
40
+ current_score=$(grep -E "^\| $cap \| " "$CURRENT" 2>/dev/null | awk -F'|' '{print $4}' | tr -d ' ' | head -1)
41
+ previous_score=$(grep -E "^\| $cap \| " "$PREVIOUS" 2>/dev/null | awk -F'|' '{print $4}' | tr -d ' ' | head -1)
42
+
43
+ if [ -z "$current_score" ] || [ -z "$previous_score" ]; then
44
+ continue
45
+ fi
46
+
47
+ if [ "$current_score" -lt "$previous_score" ]; then
48
+ cap_name=$(grep -E "^\| $cap \| " "$CURRENT" | awk -F'|' '{print $3}' | xargs)
49
+ echo "REGRESSION: Capacidade $cap ($cap_name) regrediu de $previous_score → $current_score"
50
+ REGRESSIONS=$((REGRESSIONS + 1))
51
+ fi
52
+ done
53
+
54
+ if [ "$REGRESSIONS" -eq 0 ]; then
55
+ echo "PASS: nenhuma das 5 capacidades OMM regrediu vs $PREVIOUS"
56
+ exit 0
57
+ else
58
+ echo "WARN: $REGRESSIONS capacidade(s) regredida(s)"
59
+ # PT-BR: blocking=false por default. Para tornar bloqueante:
60
+ # workflow.omm_no_regression=true
61
+ if [ "$(node ./.claude/framework/bin/tools.cjs config-get workflow.omm_no_regression 2>/dev/null || echo false)" = "true" ]; then
62
+ exit 1
63
+ fi
64
+ exit 0
65
+ fi
66
+ ```
67
+
68
+ ## Why
69
+
70
+ OMM regression alerta o time que algo deteriorou apesar do esforço do marco. Sem este gate, regressions silenciam e accumulate como tech debt invisível.
71
+
72
+ Default não-bloqueante para evitar ruído inicial; flag `workflow.omm_no_regression=true` opt-in quando time confiante.
73
+
74
+ ## REQ
75
+
76
+ QA-03 + INT-FW-04 + INT-FW-05.
77
+
78
+ ## Configuração
79
+
80
+ ```bash
81
+ # PT-BR: tornar bloqueante (recomendado depois de 2-3 marcos consecutivos sem regression)
82
+ node ./.claude/framework/bin/tools.cjs config-set workflow.omm_no_regression true
83
+ ```
@@ -0,0 +1,71 @@
1
+ ---
2
+ id: skill-must-include
3
+ stage: pre-verify
4
+ blocking: true
5
+ description: Valida que skills supabase-* contêm strings obrigatórias verbatim — anti-pattern prevention (RLS (select), search_path, getAll/setAll, etc.).
6
+ ---
7
+
8
+ # Skill must-include gate
9
+
10
+ **When to run:** pre-verify.
11
+
12
+ ## Check
13
+
14
+ ```bash
15
+ #!/usr/bin/env bash
16
+ # PT-BR: cada skill deve incluir strings obrigatórias verbatim para prevenir anti-patterns
17
+ # Portable: bash 3.2+ (macOS default), sem associative arrays
18
+ set -e
19
+
20
+ VIOLATIONS=0
21
+
22
+ check_skill() {
23
+ local skill="$1"
24
+ local required="$2" # strings separadas por |
25
+ local file="kit/skills/$skill/SKILL.md"
26
+
27
+ if [ ! -f "$file" ]; then
28
+ echo "FAIL: $file — skill ausente"
29
+ VIOLATIONS=$((VIOLATIONS + 1))
30
+ return
31
+ fi
32
+
33
+ # PT-BR: testa cada string (separada por |)
34
+ local IFS='|'
35
+ for str in $required; do
36
+ if ! grep -qF "$str" "$file"; then
37
+ echo "FAIL: $file — must-include ausente: '$str'"
38
+ VIOLATIONS=$((VIOLATIONS + 1))
39
+ fi
40
+ done
41
+ }
42
+
43
+ check_skill "supabase-rls-policies" "(select auth.uid())|user_metadata|TO authenticated"
44
+ check_skill "supabase-database-functions" "set search_path = ''|SECURITY INVOKER"
45
+ check_skill "supabase-auth-ssr" "getAll|setAll|auth-helpers-nextjs|@supabase/ssr"
46
+ check_skill "supabase-realtime" "broadcast|private: true|realtime.broadcast_changes|removeChannel"
47
+ check_skill "supabase-edge-functions" "npm:|jsr:|Deno.serve|EdgeRuntime.waitUntil|/tmp"
48
+ check_skill "supabase-declarative-schema" "supabase/schemas/|supabase stop|supabase db diff -f"
49
+ check_skill "supabase-migrations" "YYYYMMDDHHmmss|RLS|granular"
50
+ check_skill "supabase-postgres-style" "snake_case|ISO 8601|lowercase"
51
+ check_skill "supabase-storage" "signed URL|storage.objects|multi-tenant"
52
+ check_skill "supabase-pgvector-rag" "HNSW|IVFFlat|<=>|RAG with permissions"
53
+ check_skill "supabase-cron-queues" "pg_cron|pgmq|pg_net"
54
+
55
+ if [ "$VIOLATIONS" -gt 0 ]; then
56
+ echo "Total violations: $VIOLATIONS"
57
+ exit 1
58
+ fi
59
+
60
+ echo "✓ Todas as skills supabase-* contêm must-include strings"
61
+ exit 0
62
+ ```
63
+
64
+ ## Verdict
65
+
66
+ - **passed** — todas as 11 skills têm strings obrigatórias
67
+ - **block** — pelo menos uma skill faltando string crítica (anti-pattern prevention quebrada)
68
+
69
+ ## Notes
70
+
71
+ Anti-pitfall A7 da v1.8: skills devem prevenir ativamente os anti-patterns Supabase mais críticos. Sem este gate, refator de skill pode acidentalmente remover a regra principal (ex: `(select auth.uid())` wrapper que previne 1000× degradação). Strings como `WARNING user_metadata`, `set search_path = ''`, `NEVER use auth-helpers-nextjs` são as primeiras coisas que LLM lê — devem estar lá.