kakaroto-config 1.0.0 → 1.0.1
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.
- package/README.md +122 -16
- package/bin/install.js +27 -5
- package/config/ARCHITECTURE.md +25 -17
- package/config/commands/debug/01-reproduce.md +118 -0
- package/config/commands/debug/02-investigate.md +87 -0
- package/config/commands/debug/{02-fix.md → 03-fix.md} +31 -16
- package/config/commands/debug/04-verify.md +81 -0
- package/config/commands/debug/05-commit.md +76 -0
- package/config/commands/debug.md +3 -3
- package/package.json +1 -1
- package/config/commands/debug/01-investigate.md +0 -119
- package/config/commands/debug/03-verify.md +0 -66
package/README.md
CHANGED
|
@@ -5,43 +5,149 @@ Claude Code configuration for autonomous development workflows.
|
|
|
5
5
|
## Quick Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
+
# Local installation (recommended - installs to ./.claude/)
|
|
8
9
|
npx kakaroto-config
|
|
10
|
+
|
|
11
|
+
# Global installation (installs to ~/.claude/)
|
|
12
|
+
npx kakaroto-config --global
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Local is recommended** because each project can have its own customizations while inheriting the global rules.
|
|
16
|
+
|
|
17
|
+
## Updating
|
|
18
|
+
|
|
19
|
+
To update to the latest version, run the same command again:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Update local installation
|
|
23
|
+
npx kakaroto-config@latest
|
|
24
|
+
|
|
25
|
+
# Update global installation
|
|
26
|
+
npx kakaroto-config@latest --global
|
|
9
27
|
```
|
|
10
28
|
|
|
11
|
-
|
|
29
|
+
The installer will detect the existing `.claude/` folder and ask if you want to overwrite.
|
|
12
30
|
|
|
13
|
-
|
|
31
|
+
> **Note:** If you previously installed globally (`~/.claude/`) and want to switch to local (`./.claude/`), just run `npx kakaroto-config@latest` in your project folder. Both can coexist - Claude Code will use local config when available.
|
|
14
32
|
|
|
15
|
-
|
|
33
|
+
## What Gets Installed
|
|
16
34
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
```
|
|
36
|
+
.claude/
|
|
37
|
+
├── CLAUDE.md # Global rules (autonomy, coding standards)
|
|
38
|
+
├── ARCHITECTURE.md # Full documentation of the system
|
|
39
|
+
├── commands/ # Skills (invoked via /skill)
|
|
40
|
+
│ ├── feature.md # /feature orchestrator
|
|
41
|
+
│ ├── feature/ # 5 phases: interview → spec → plan → implement → quality
|
|
42
|
+
│ ├── debug.md # /debug orchestrator
|
|
43
|
+
│ ├── debug/ # 5 phases: reproduce → investigate → fix → verify → commit
|
|
44
|
+
│ └── gate.md # /gate - quality gate before PR
|
|
45
|
+
└── agents/ # 7 specialized subagents
|
|
46
|
+
├── test-fixer.md
|
|
47
|
+
├── code-reviewer.md
|
|
48
|
+
├── code-simplifier.md
|
|
49
|
+
├── dry-enforcer.md
|
|
50
|
+
├── visual-validator.md
|
|
51
|
+
├── terraform-validator.md
|
|
52
|
+
└── memory-sync.md
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Skills (Commands)
|
|
56
|
+
|
|
57
|
+
| Skill | Trigger | Description |
|
|
58
|
+
|-------|---------|-------------|
|
|
59
|
+
| `/feature` | "adicionar", "implementar", "criar" | Full feature workflow with spec, planning, and quality gates |
|
|
60
|
+
| `/debug` | "bug", "erro", "problema" | Bug resolution with 5 Whys methodology |
|
|
61
|
+
| `/gate` | Manual | Run all 7 quality agents before PR |
|
|
22
62
|
|
|
23
|
-
|
|
63
|
+
## Agents (Subagents)
|
|
24
64
|
|
|
25
65
|
| Agent | Purpose |
|
|
26
66
|
|-------|---------|
|
|
27
67
|
| `test-fixer` | Runs tests, fixes failures, creates missing tests |
|
|
28
68
|
| `code-reviewer` | Reviews code quality, security, auto-fixes issues |
|
|
29
69
|
| `code-simplifier` | Reduces complexity, improves readability |
|
|
30
|
-
| `dry-enforcer` | Detects duplication, suggests reuse |
|
|
70
|
+
| `dry-enforcer` | Detects duplication, suggests code reuse |
|
|
31
71
|
| `visual-validator` | Validates UI with Playwright |
|
|
32
72
|
| `terraform-validator` | Validates env vars and Terraform consistency |
|
|
33
73
|
| `memory-sync` | Syncs knowledge to MCP Memory |
|
|
34
74
|
|
|
35
75
|
## Philosophy
|
|
36
76
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
77
|
+
The configuration enforces autonomous development:
|
|
78
|
+
|
|
79
|
+
| Principle | Meaning |
|
|
80
|
+
|-----------|---------|
|
|
81
|
+
| **FAZER, nao perguntar** | Agents fix issues automatically, don't ask for confirmation |
|
|
82
|
+
| **BUSCAR, nao pedir contexto** | Use MCP Memory and codebase exploration, don't ask user for context |
|
|
83
|
+
| **Codigo sem teste = PR rejeitado** | Tests are mandatory (blocking) |
|
|
84
|
+
| **Erros: corrigir e continuar** | Fix errors automatically, don't stop workflow |
|
|
85
|
+
|
|
86
|
+
## After Installation
|
|
87
|
+
|
|
88
|
+
### 1. Create Project CLAUDE.md (Optional but Recommended)
|
|
89
|
+
|
|
90
|
+
Create a `CLAUDE.md` in your project root with project-specific info:
|
|
91
|
+
|
|
92
|
+
```markdown
|
|
93
|
+
# Project Name
|
|
94
|
+
|
|
95
|
+
## Commands
|
|
96
|
+
- `npm run dev` - Start dev server
|
|
97
|
+
- `npm run build` - Build
|
|
98
|
+
- `npm run test` - Run tests
|
|
99
|
+
|
|
100
|
+
## Structure
|
|
101
|
+
- `src/` - Source code
|
|
102
|
+
- `tests/` - Tests
|
|
103
|
+
|
|
104
|
+
## MCP Memory Namespace
|
|
105
|
+
Prefix: `myproject:`
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 2. Add Custom Skills (Optional)
|
|
109
|
+
|
|
110
|
+
Create `.claude/commands/your-skill.md` for project-specific workflows.
|
|
111
|
+
|
|
112
|
+
## Workflow Examples
|
|
113
|
+
|
|
114
|
+
### Feature Development
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
User: "adiciona filtro de data na listagem"
|
|
118
|
+
↓
|
|
119
|
+
Claude automatically triggers /feature
|
|
120
|
+
↓
|
|
121
|
+
01-interview → Explores codebase, asks clarifying questions
|
|
122
|
+
02-spec → Generates technical specification
|
|
123
|
+
03-planner → Creates implementation plan (requires approval)
|
|
124
|
+
04-implement → Writes code following spec and plan
|
|
125
|
+
05-quality → Runs all 7 quality agents
|
|
126
|
+
↓
|
|
127
|
+
Ready for PR
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Bug Resolution
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
User: "erro ao salvar formulario"
|
|
134
|
+
↓
|
|
135
|
+
Claude automatically triggers /debug
|
|
136
|
+
↓
|
|
137
|
+
01-reproduce → Reproduces the bug
|
|
138
|
+
02-investigate → 5 Whys analysis with evidence
|
|
139
|
+
03-fix → Minimal fix + mandatory test
|
|
140
|
+
04-verify → Confirms fix works
|
|
141
|
+
05-commit → Creates commit
|
|
142
|
+
↓
|
|
143
|
+
Done
|
|
144
|
+
```
|
|
41
145
|
|
|
42
|
-
##
|
|
146
|
+
## Requirements
|
|
43
147
|
|
|
44
|
-
|
|
148
|
+
- Claude Code CLI
|
|
149
|
+
- MCP Memory server (optional, for knowledge persistence)
|
|
150
|
+
- Playwright MCP (optional, for visual validation)
|
|
45
151
|
|
|
46
152
|
## License
|
|
47
153
|
|
package/bin/install.js
CHANGED
|
@@ -5,7 +5,26 @@ const path = require('path');
|
|
|
5
5
|
const os = require('os');
|
|
6
6
|
const readline = require('readline');
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const args = process.argv.slice(2);
|
|
9
|
+
const isGlobal = args.includes('--global');
|
|
10
|
+
const showHelp = args.includes('--help') || args.includes('-h');
|
|
11
|
+
|
|
12
|
+
if (showHelp) {
|
|
13
|
+
console.log(`
|
|
14
|
+
Usage: npx kakaroto-config [options]
|
|
15
|
+
|
|
16
|
+
Options:
|
|
17
|
+
--global Install to ~/.claude/ (global, all projects)
|
|
18
|
+
--help, -h Show this help message
|
|
19
|
+
|
|
20
|
+
Default: Install to ./.claude/ (local, current project)
|
|
21
|
+
`);
|
|
22
|
+
process.exit(0);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const CLAUDE_DIR = isGlobal
|
|
26
|
+
? path.join(os.homedir(), '.claude')
|
|
27
|
+
: path.join(process.cwd(), '.claude');
|
|
9
28
|
const CONFIG_DIR = path.join(__dirname, '..', 'config');
|
|
10
29
|
|
|
11
30
|
const rl = readline.createInterface({
|
|
@@ -52,9 +71,12 @@ function countFiles(dir) {
|
|
|
52
71
|
}
|
|
53
72
|
|
|
54
73
|
async function main() {
|
|
74
|
+
const targetPath = isGlobal ? '~/.claude/' : './.claude/ (local)';
|
|
75
|
+
const targetDisplay = isGlobal ? '~/.claude/' : '.claude/';
|
|
76
|
+
|
|
55
77
|
console.log('\n🥋 kakaroto-config - Claude Code Configuration\n');
|
|
56
|
-
console.log(
|
|
57
|
-
console.log(' - CLAUDE.md (
|
|
78
|
+
console.log(`This will install the following to ${targetPath}:`);
|
|
79
|
+
console.log(' - CLAUDE.md (rules)');
|
|
58
80
|
console.log(' - ARCHITECTURE.md (documentation)');
|
|
59
81
|
console.log(' - commands/ (skills: /feature, /debug, /gate)');
|
|
60
82
|
console.log(' - agents/ (7 specialized subagents)\n');
|
|
@@ -63,7 +85,7 @@ async function main() {
|
|
|
63
85
|
console.log(`Total: ${fileCount} files\n`);
|
|
64
86
|
|
|
65
87
|
if (fs.existsSync(CLAUDE_DIR)) {
|
|
66
|
-
const answer = await question(
|
|
88
|
+
const answer = await question(`${targetDisplay} already exists. Overwrite? (y/N): `);
|
|
67
89
|
if (answer.toLowerCase() !== 'y') {
|
|
68
90
|
console.log('\nAborted. No changes made.');
|
|
69
91
|
rl.close();
|
|
@@ -89,7 +111,7 @@ async function main() {
|
|
|
89
111
|
console.log(' 2. Try /feature to create a new feature');
|
|
90
112
|
console.log(' 3. Try /debug to fix a bug');
|
|
91
113
|
console.log(' 4. Try /gate before creating a PR\n');
|
|
92
|
-
console.log(
|
|
114
|
+
console.log(`Read ${targetDisplay}ARCHITECTURE.md for full documentation.\n`);
|
|
93
115
|
} catch (err) {
|
|
94
116
|
console.error('Error during installation:', err.message);
|
|
95
117
|
process.exit(1);
|
package/config/ARCHITECTURE.md
CHANGED
|
@@ -97,9 +97,11 @@ Este documento descreve a arquitetura de configuracao do Claude Code, otimizada
|
|
|
97
97
|
│ │
|
|
98
98
|
│ ├── debug.md # /debug - orquestrador
|
|
99
99
|
│ ├── debug/
|
|
100
|
-
│ │ ├── 01-
|
|
101
|
-
│ │ ├── 02-
|
|
102
|
-
│ │
|
|
100
|
+
│ │ ├── 01-reproduce.md # Fase 1: reproduzir bug
|
|
101
|
+
│ │ ├── 02-investigate.md # Fase 2: 5 Whys
|
|
102
|
+
│ │ ├── 03-fix.md # Fase 3: correcao minima
|
|
103
|
+
│ │ ├── 04-verify.md # Fase 4: confirmar fix
|
|
104
|
+
│ │ └── 05-commit.md # Fase 5: commit
|
|
103
105
|
│ │
|
|
104
106
|
│ └── gate.md # /gate - quality gate completo
|
|
105
107
|
│
|
|
@@ -216,22 +218,28 @@ User: "erro ao publicar video"
|
|
|
216
218
|
│
|
|
217
219
|
▼
|
|
218
220
|
┌────────────────────────┐ ┌────────────────────────┐
|
|
219
|
-
│ 01-
|
|
220
|
-
│ -
|
|
221
|
-
│
|
|
222
|
-
│
|
|
223
|
-
└────────────────────────┘
|
|
224
|
-
│ - Testes obrigatorio │
|
|
225
|
-
└───────────┬────────────┘
|
|
221
|
+
│ 01-reproduce.md │────►│ 02-investigate.md │
|
|
222
|
+
│ - Criar teste que │ │ - 5 Whys com │
|
|
223
|
+
│ reproduz o bug │ │ EVIDENCIA │
|
|
224
|
+
│ - Confirmar falha │ │ - Root cause │
|
|
225
|
+
└────────────────────────┘ └───────────┬────────────┘
|
|
226
226
|
│
|
|
227
227
|
▼
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
228
|
+
┌────────────────────────┐ ┌────────────────────────┐
|
|
229
|
+
│ 04-verify.md │◄────│ 03-fix.md │
|
|
230
|
+
│ - Rodar teste │ │ - Fix MINIMO │
|
|
231
|
+
│ - Confirmar que │ │ - Apenas o necessario│
|
|
232
|
+
│ passou │ │ - Nao refatorar │
|
|
233
|
+
└───────────┬────────────┘ └────────────────────────┘
|
|
234
|
+
│
|
|
235
|
+
▼
|
|
236
|
+
┌────────────────────────┐
|
|
237
|
+
│ 05-commit.md │
|
|
238
|
+
│ - Commit do fix │
|
|
239
|
+
│ - Padrao de mensagem │
|
|
240
|
+
│ - Memory sync se │
|
|
241
|
+
│ bug raro │
|
|
242
|
+
└────────────────────────┘
|
|
235
243
|
```
|
|
236
244
|
|
|
237
245
|
### /gate (Quality Gate Antes de PR)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Fase 1: Reproduce
|
|
2
|
+
|
|
3
|
+
## Passo 1: Carregar Contexto
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
mcp__memory__search_nodes({ query: "config" })
|
|
7
|
+
mcp__memory__search_nodes({ query: "<termos-do-bug>" })
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Extrair termos relevantes de $ARGUMENTS e buscar bugs similares ja resolvidos.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Passo 2: Reproduzir Bug
|
|
15
|
+
|
|
16
|
+
### 2.1 Executar Passos
|
|
17
|
+
Tentar reproduzir com informacoes fornecidas.
|
|
18
|
+
|
|
19
|
+
### 2.2 Documentar
|
|
20
|
+
```
|
|
21
|
+
REPRODUCAO:
|
|
22
|
+
- Passos: [...]
|
|
23
|
+
- Input: [...]
|
|
24
|
+
- Output esperado: [...]
|
|
25
|
+
- Output real: [...]
|
|
26
|
+
- Reproduzido: SIM/NAO
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Passo 3: Verificar Estado Externo (SE web/scraping)
|
|
32
|
+
|
|
33
|
+
**APENAS SE** o bug envolve: web scraping, Playwright, Puppeteer, seletores, ou interacao com paginas web externas.
|
|
34
|
+
|
|
35
|
+
### 3.1 Verificar Antes de Assumir
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
1. mcp__playwright__browser_navigate({ url: "[URL do bug]" })
|
|
39
|
+
2. mcp__playwright__browser_wait_for({ time: 3 })
|
|
40
|
+
3. mcp__playwright__browser_snapshot({})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 3.2 Comparar Estado Atual vs Esperado
|
|
44
|
+
|
|
45
|
+
- O que o codigo espera encontrar?
|
|
46
|
+
- O que realmente existe na pagina?
|
|
47
|
+
- Quais seletores existem/mudaram?
|
|
48
|
+
|
|
49
|
+
**PROIBIDO:** Assumir que "a pagina mudou" sem verificar.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Passo 4: Gate de Reproducao
|
|
54
|
+
|
|
55
|
+
**SE** reproduziu com sucesso:
|
|
56
|
+
- Prosseguir para Passo 5
|
|
57
|
+
|
|
58
|
+
**SE NAO** reproduziu:
|
|
59
|
+
- Usar `AskUserQuestion` para obter mais detalhes
|
|
60
|
+
- Documentar o que foi tentado
|
|
61
|
+
- NAO prosseguir ate reproduzir
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Passo 5: Persistir Reproducao
|
|
66
|
+
|
|
67
|
+
Salvar documentacao em `.claude/debug/reproduction.md`:
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
# Reproducao: [descricao curta do bug]
|
|
71
|
+
|
|
72
|
+
**Data:** [timestamp]
|
|
73
|
+
**Bug:** [descricao original de $ARGUMENTS]
|
|
74
|
+
|
|
75
|
+
## Passos de Reproducao
|
|
76
|
+
1. [passo executado]
|
|
77
|
+
2. [passo executado]
|
|
78
|
+
|
|
79
|
+
## Input
|
|
80
|
+
[dados de entrada usados]
|
|
81
|
+
|
|
82
|
+
## Output Esperado
|
|
83
|
+
[o que deveria acontecer]
|
|
84
|
+
|
|
85
|
+
## Output Real
|
|
86
|
+
[o que aconteceu - evidencia do bug]
|
|
87
|
+
|
|
88
|
+
## Observacoes Iniciais
|
|
89
|
+
[hipoteses formadas durante reproducao]
|
|
90
|
+
|
|
91
|
+
## Estado Externo (se aplicavel)
|
|
92
|
+
[observacoes do Playwright/browser]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Passo 6: Checkpoint
|
|
98
|
+
|
|
99
|
+
```javascript
|
|
100
|
+
TodoWrite({
|
|
101
|
+
todos: [
|
|
102
|
+
{ content: "Reproduce: contexto carregado", status: "completed", activeForm: "Loading context" },
|
|
103
|
+
{ content: "Reproduce: bug reproduzido", status: "completed", activeForm: "Reproducing bug" },
|
|
104
|
+
{ content: "Reproduce: reproducao persistida", status: "completed", activeForm: "Persisting reproduction" },
|
|
105
|
+
{ content: "Investigate: analisar causa raiz", status: "pending", activeForm: "Analyzing root cause" }
|
|
106
|
+
]
|
|
107
|
+
})
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Output
|
|
113
|
+
|
|
114
|
+
Bug reproduzido e documentado em `.claude/debug/reproduction.md`.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
## PROXIMA FASE
|
|
118
|
+
ACAO OBRIGATORIA: Read ~/.claude/commands/debug/02-investigate.md
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Fase 2: Investigate
|
|
2
|
+
|
|
3
|
+
## Passo 0: Context
|
|
4
|
+
|
|
5
|
+
**SE** continuacao direta de 01-reproduce (mesma sessao):
|
|
6
|
+
Contexto ja disponivel, prosseguir.
|
|
7
|
+
|
|
8
|
+
**SE** retomando sessao interrompida:
|
|
9
|
+
```
|
|
10
|
+
Read .claude/debug/reproduction.md
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Passo 1: Explorar Codigo Relacionado
|
|
16
|
+
|
|
17
|
+
### 1.1 Buscar no Codebase
|
|
18
|
+
```
|
|
19
|
+
Grep: termos do bug
|
|
20
|
+
Glob: arquivos com nomes relacionados
|
|
21
|
+
git log --oneline --grep="fix" -- [arquivos suspeitos]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 1.2 Identificar
|
|
25
|
+
- Arquivos/funcoes envolvidos
|
|
26
|
+
- Como erros sao tratados nesta area
|
|
27
|
+
- Ha validacao que deveria existir?
|
|
28
|
+
- Ha helper existente que resolve?
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Passo 2: 5 Whys (Causa Raiz)
|
|
33
|
+
|
|
34
|
+
Para cada "Por que?", fornecer EVIDENCIA de codigo:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
ANALISE DE CAUSA RAIZ:
|
|
38
|
+
|
|
39
|
+
Sintoma: [o que esta acontecendo]
|
|
40
|
+
|
|
41
|
+
Por que #1: [resposta]
|
|
42
|
+
Evidencia: [arquivo:linha] - [codigo]
|
|
43
|
+
|
|
44
|
+
Por que #2: [resposta]
|
|
45
|
+
Evidencia: [arquivo:linha] - [codigo]
|
|
46
|
+
|
|
47
|
+
Por que #3: [resposta]
|
|
48
|
+
Evidencia: [arquivo:linha] - [codigo]
|
|
49
|
+
|
|
50
|
+
CAUSA RAIZ: [declaracao clara]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Passo 3: Validar Causa Raiz
|
|
56
|
+
|
|
57
|
+
A causa raiz deve ser:
|
|
58
|
+
- [ ] Algo que voce pode MUDAR
|
|
59
|
+
- [ ] Suportada por evidencia de codigo
|
|
60
|
+
- [ ] Explica TODOS os sintomas
|
|
61
|
+
|
|
62
|
+
**SE** nao validar: voltar ao Passo 2.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Passo 4: Checkpoint
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
TodoWrite({
|
|
70
|
+
todos: [
|
|
71
|
+
{ content: "Reproduce: bug reproduzido", status: "completed", activeForm: "Bug reproduced" },
|
|
72
|
+
{ content: "Investigate: codigo explorado", status: "completed", activeForm: "Code explored" },
|
|
73
|
+
{ content: "Investigate: causa raiz identificada", status: "completed", activeForm: "Root cause identified" },
|
|
74
|
+
{ content: "Fix: implementar correcao", status: "pending", activeForm: "Implementing fix" }
|
|
75
|
+
]
|
|
76
|
+
})
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Output
|
|
82
|
+
|
|
83
|
+
Causa raiz documentada com evidencia.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
## PROXIMA FASE
|
|
87
|
+
ACAO OBRIGATORIA: Read ~/.claude/commands/debug/03-fix.md
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Fase
|
|
1
|
+
# Fase 3: Fix
|
|
2
2
|
|
|
3
3
|
## Contexto
|
|
4
|
-
Causa raiz identificada. Implementar fix de forma
|
|
4
|
+
Causa raiz identificada. Implementar fix de forma AUTONOMA.
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -9,7 +9,7 @@ Causa raiz identificada. Implementar fix de forma AUTÔNOMA.
|
|
|
9
9
|
|
|
10
10
|
### 0.1 Identificar Paths Afetados
|
|
11
11
|
|
|
12
|
-
Extrair arquivos da causa raiz documentada na investigacao (fase
|
|
12
|
+
Extrair arquivos da causa raiz documentada na investigacao (fase 02-investigate).
|
|
13
13
|
|
|
14
14
|
### 0.2 Lista de Paths Criticos
|
|
15
15
|
|
|
@@ -53,7 +53,7 @@ Prosseguir direto para Passo 1 (autonomia total)
|
|
|
53
53
|
describe('[contexto do bug]', () => {
|
|
54
54
|
it('should [comportamento esperado]', () => {
|
|
55
55
|
// Arrange: setup que causa o bug
|
|
56
|
-
// Act:
|
|
56
|
+
// Act: acao que dispara o bug
|
|
57
57
|
// Assert: verificar comportamento correto
|
|
58
58
|
})
|
|
59
59
|
})
|
|
@@ -64,25 +64,25 @@ describe('[contexto do bug]', () => {
|
|
|
64
64
|
npm test -- --testPathPattern="[arquivo]"
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
O teste DEVE falhar antes do fix. Se passar, o teste
|
|
67
|
+
O teste DEVE falhar antes do fix. Se passar, o teste nao reproduz o bug.
|
|
68
68
|
|
|
69
69
|
---
|
|
70
70
|
|
|
71
71
|
## Passo 2: Implementar Fix
|
|
72
72
|
|
|
73
|
-
### 2.1 Fix
|
|
73
|
+
### 2.1 Fix Minimo
|
|
74
74
|
```
|
|
75
75
|
FIX:
|
|
76
76
|
Arquivo: [arquivo:linha]
|
|
77
|
-
Antes: [
|
|
78
|
-
Depois: [
|
|
77
|
+
Antes: [codigo atual]
|
|
78
|
+
Depois: [codigo novo]
|
|
79
79
|
Justificativa: [por que resolve a causa raiz]
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
### 2.2 Regras
|
|
83
|
-
- APENAS o
|
|
84
|
-
-
|
|
85
|
-
-
|
|
83
|
+
- APENAS o necessario para resolver a causa raiz
|
|
84
|
+
- NAO refatorar codigo nao relacionado
|
|
85
|
+
- NAO adicionar features
|
|
86
86
|
- Seguir patterns existentes do projeto
|
|
87
87
|
|
|
88
88
|
---
|
|
@@ -94,15 +94,30 @@ Justificativa: [por que resolve a causa raiz]
|
|
|
94
94
|
npm test -- --testPathPattern="[arquivo]"
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
### 3.2 Bug
|
|
98
|
-
Executar passos originais. Bug
|
|
97
|
+
### 3.2 Bug Nao Reproduz
|
|
98
|
+
Executar passos originais. Bug nao deve ocorrer.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Passo 4: Checkpoint
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
TodoWrite({
|
|
106
|
+
todos: [
|
|
107
|
+
{ content: "Investigate: causa raiz identificada", status: "completed", activeForm: "Root cause identified" },
|
|
108
|
+
{ content: "Fix: teste de regressao criado", status: "completed", activeForm: "Regression test created" },
|
|
109
|
+
{ content: "Fix: correcao implementada", status: "completed", activeForm: "Fix implemented" },
|
|
110
|
+
{ content: "Verify: validar quality gates", status: "pending", activeForm: "Validating quality gates" }
|
|
111
|
+
]
|
|
112
|
+
})
|
|
113
|
+
```
|
|
99
114
|
|
|
100
115
|
---
|
|
101
116
|
|
|
102
117
|
## Output
|
|
103
118
|
|
|
104
|
-
Fix implementado. Teste de
|
|
119
|
+
Fix implementado. Teste de regressao passando.
|
|
105
120
|
|
|
106
121
|
---
|
|
107
|
-
##
|
|
108
|
-
|
|
122
|
+
## PROXIMA FASE
|
|
123
|
+
ACAO OBRIGATORIA: Read ~/.claude/commands/debug/04-verify.md
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Fase 4: Verify
|
|
2
|
+
|
|
3
|
+
## Contexto
|
|
4
|
+
Fix implementado. Verificar e finalizar de forma AUTONOMA.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Passo 1: Quality Gates
|
|
9
|
+
|
|
10
|
+
Rodar em sequencia:
|
|
11
|
+
```bash
|
|
12
|
+
npm test
|
|
13
|
+
npx tsc --noEmit
|
|
14
|
+
npm run build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Se falhar:** Corrigir e rodar novamente. Nao prosseguir ate passar.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Passo 2: Verificacao Final
|
|
22
|
+
|
|
23
|
+
- [ ] Testes passam
|
|
24
|
+
- [ ] TypeScript sem erros
|
|
25
|
+
- [ ] Build bem-sucedido
|
|
26
|
+
- [ ] Bug nao reproduz mais
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Passo 3: Memory Sync (se bug nao-obvio)
|
|
31
|
+
|
|
32
|
+
Se o bug foi dificil de encontrar, salvar na memory:
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
mcp__memory__create_entities({
|
|
36
|
+
entities: [{
|
|
37
|
+
name: "{prefix}:bug:{nome-descritivo}",
|
|
38
|
+
entityType: "bug",
|
|
39
|
+
observations: [
|
|
40
|
+
"Sintoma: [...]",
|
|
41
|
+
"Causa raiz: [...]",
|
|
42
|
+
"Solucao: [...]",
|
|
43
|
+
"Arquivos: [...]"
|
|
44
|
+
]
|
|
45
|
+
}]
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Passo 4: Checkpoint
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
TodoWrite({
|
|
55
|
+
todos: [
|
|
56
|
+
{ content: "Reproduce: bug reproduzido", status: "completed", activeForm: "Bug reproduced" },
|
|
57
|
+
{ content: "Investigate: causa raiz identificada", status: "completed", activeForm: "Root cause identified" },
|
|
58
|
+
{ content: "Fix: correcao implementada", status: "completed", activeForm: "Fix implemented" },
|
|
59
|
+
{ content: "Verify: quality gates passando", status: "completed", activeForm: "Quality gates passed" },
|
|
60
|
+
{ content: "Commit: commitar e push", status: "pending", activeForm: "Committing changes" }
|
|
61
|
+
]
|
|
62
|
+
})
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Output
|
|
68
|
+
|
|
69
|
+
Quality gates passando. Pronto para commit.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Regras Inviolaveis
|
|
74
|
+
|
|
75
|
+
1. **PROIBIDO** prosseguir com testes falhando
|
|
76
|
+
2. **PROIBIDO** prosseguir com build falhando
|
|
77
|
+
3. **PROIBIDO** perguntar ao user (so reportar no final)
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
## PROXIMA FASE
|
|
81
|
+
ACAO OBRIGATORIA: Read ~/.claude/commands/debug/05-commit.md
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Fase 5: Commit & Push
|
|
2
|
+
|
|
3
|
+
## Contexto
|
|
4
|
+
Bug resolvido, verify passou. Commitar e fazer push de forma AUTONOMA.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Passo 1: Verificar Mudancas
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
git status
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Se nao houver mudancas:** Reportar "Nada a commitar" → FIM
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Passo 2: Commit
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
git add -A
|
|
22
|
+
git commit -m "$(cat <<'EOF'
|
|
23
|
+
fix: {descricao do bug resolvido em ingles}
|
|
24
|
+
|
|
25
|
+
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
|
26
|
+
EOF
|
|
27
|
+
)"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Sempre prefixo `fix:`** - workflow e de debug.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Passo 3: Push
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git push
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Se falhar:** Reportar erro ao user.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Passo 4: Checkpoint Final
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
TodoWrite({
|
|
48
|
+
todos: [
|
|
49
|
+
{ content: "Reproduce: bug reproduzido", status: "completed", activeForm: "Bug reproduced" },
|
|
50
|
+
{ content: "Investigate: causa raiz identificada", status: "completed", activeForm: "Root cause identified" },
|
|
51
|
+
{ content: "Fix: correcao implementada", status: "completed", activeForm: "Fix implemented" },
|
|
52
|
+
{ content: "Verify: quality gates passando", status: "completed", activeForm: "Quality gates passed" },
|
|
53
|
+
{ content: "Commit: commitado e pushed", status: "completed", activeForm: "Committed and pushed" }
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Passo 5: Confirmar
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
git log --oneline -1
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Reportar ao user: fix commitado e pushed.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Regras
|
|
71
|
+
|
|
72
|
+
1. **1 fix = 1 commit**
|
|
73
|
+
2. **Sempre `fix:` como prefixo**
|
|
74
|
+
3. **Mensagem em ingles**
|
|
75
|
+
4. **NUNCA** --force push
|
|
76
|
+
5. **NUNCA** commitar se verify falhou
|
package/config/commands/debug.md
CHANGED
|
@@ -6,11 +6,11 @@ model: opus
|
|
|
6
6
|
Investigar e resolver: $ARGUMENTS
|
|
7
7
|
|
|
8
8
|
## INICIAR
|
|
9
|
-
|
|
10
|
-
Seguir
|
|
9
|
+
ACAO OBRIGATORIA: Read ~/.claude/commands/debug/01-reproduce.md
|
|
10
|
+
Seguir instrucoes. Cada fase aponta para a proxima.
|
|
11
11
|
|
|
12
12
|
## Fluxo
|
|
13
|
-
Investigate → Fix → Verify → Fim (SEM PARADAS)
|
|
13
|
+
Reproduce → Investigate → Fix → Verify → Commit → Fim (SEM PARADAS)
|
|
14
14
|
|
|
15
15
|
## Regras
|
|
16
16
|
1. ZERO paradas até o final
|
package/package.json
CHANGED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
# Fase 1: Investigate
|
|
2
|
-
|
|
3
|
-
## Passo 1: Carregar Contexto
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
mcp__memory__search_nodes({ query: "config" })
|
|
7
|
-
mcp__memory__search_nodes({ query: "<termos-do-bug>" })
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
Extrair termos relevantes de $ARGUMENTS e buscar bugs similares já resolvidos.
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Passo 2: Reproduzir Bug
|
|
15
|
-
|
|
16
|
-
### 2.1 Executar Passos
|
|
17
|
-
Tentar reproduzir com informações fornecidas.
|
|
18
|
-
|
|
19
|
-
### 2.2 Documentar
|
|
20
|
-
```
|
|
21
|
-
REPRODUÇÃO:
|
|
22
|
-
- Passos: [...]
|
|
23
|
-
- Input: [...]
|
|
24
|
-
- Output esperado: [...]
|
|
25
|
-
- Output real: [...]
|
|
26
|
-
- Reproduzido: SIM/NAO
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### 2.3 Gate
|
|
30
|
-
Se NÃO reproduziu: usar AskUserQuestion para mais detalhes.
|
|
31
|
-
Se reproduziu: continuar.
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Passo 3: Verificar Estado Externo (OBRIGATÓRIO para scraping/browser)
|
|
36
|
-
|
|
37
|
-
**SE o bug envolve:** web scraping, Playwright, Puppeteer, seletores, ou qualquer interação com páginas web externas:
|
|
38
|
-
|
|
39
|
-
### 3.1 VERIFICAR ANTES DE ASSUMIR
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
1. mcp__playwright__browser_navigate({ url: "[URL do bug]" })
|
|
43
|
-
2. mcp__playwright__browser_wait_for({ time: 3 })
|
|
44
|
-
3. mcp__playwright__browser_snapshot({})
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### 3.2 Comparar Estado Atual vs Esperado
|
|
48
|
-
|
|
49
|
-
- O que o código espera encontrar?
|
|
50
|
-
- O que realmente existe na página?
|
|
51
|
-
- Quais seletores existem/mudaram?
|
|
52
|
-
|
|
53
|
-
### 3.3 Gate
|
|
54
|
-
|
|
55
|
-
- [ ] Estado atual da página VERIFICADO com Playwright?
|
|
56
|
-
- [ ] Diferenças entre esperado e real DOCUMENTADAS?
|
|
57
|
-
|
|
58
|
-
**PROIBIDO:** Assumir que "a página mudou" sem verificar. SEMPRE abrir a URL e constatar.
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Passo 4: Explorar Código Relacionado
|
|
63
|
-
|
|
64
|
-
### 4.1 Buscar no Codebase
|
|
65
|
-
```
|
|
66
|
-
Grep: termos do bug
|
|
67
|
-
Glob: arquivos com nomes relacionados
|
|
68
|
-
git log --oneline --grep="fix" -- [arquivos suspeitos]
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### 4.2 Identificar
|
|
72
|
-
- Arquivos/funções envolvidos
|
|
73
|
-
- Como erros são tratados nesta área
|
|
74
|
-
- Há validação que deveria existir?
|
|
75
|
-
- Há helper existente que resolve?
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
## Passo 5: 5 Whys (Causa Raiz)
|
|
80
|
-
|
|
81
|
-
Para cada "Por que?", fornecer EVIDÊNCIA de código:
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
ANÁLISE DE CAUSA RAIZ:
|
|
85
|
-
|
|
86
|
-
Sintoma: [o que está acontecendo]
|
|
87
|
-
|
|
88
|
-
Por que #1: [resposta]
|
|
89
|
-
Evidência: [arquivo:linha] - [código]
|
|
90
|
-
|
|
91
|
-
Por que #2: [resposta]
|
|
92
|
-
Evidência: [arquivo:linha] - [código]
|
|
93
|
-
|
|
94
|
-
Por que #3: [resposta]
|
|
95
|
-
Evidência: [arquivo:linha] - [código]
|
|
96
|
-
|
|
97
|
-
CAUSA RAIZ: [declaração clara]
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## Passo 6: Validar Causa Raiz
|
|
103
|
-
|
|
104
|
-
A causa raiz deve ser:
|
|
105
|
-
- [ ] Algo que você pode MUDAR
|
|
106
|
-
- [ ] Suportada por evidência de código
|
|
107
|
-
- [ ] Explica TODOS os sintomas
|
|
108
|
-
|
|
109
|
-
Se não validar: voltar ao Passo 5.
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## Output
|
|
114
|
-
|
|
115
|
-
Causa raiz documentada com evidência.
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
## PRÓXIMA FASE
|
|
119
|
-
AÇÃO OBRIGATÓRIA: Read ~/.claude/commands/debug/02-fix.md
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# Fase 3: Verify
|
|
2
|
-
|
|
3
|
-
## Contexto
|
|
4
|
-
Fix implementado. Verificar e finalizar de forma AUTÔNOMA.
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Passo 1: Quality Gates
|
|
9
|
-
|
|
10
|
-
Rodar em sequência:
|
|
11
|
-
```bash
|
|
12
|
-
npm test
|
|
13
|
-
npx tsc --noEmit
|
|
14
|
-
npm run build
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
**Se falhar:** Corrigir e rodar novamente. Não prosseguir até passar.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Passo 2: Verificação Final
|
|
22
|
-
|
|
23
|
-
- [ ] Testes passam
|
|
24
|
-
- [ ] TypeScript sem erros
|
|
25
|
-
- [ ] Build bem-sucedido
|
|
26
|
-
- [ ] Bug não reproduz mais
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Passo 3: Memory Sync (se bug não-óbvio)
|
|
31
|
-
|
|
32
|
-
Se o bug foi difícil de encontrar, salvar na memory:
|
|
33
|
-
|
|
34
|
-
```javascript
|
|
35
|
-
mcp__memory__create_entities({
|
|
36
|
-
entities: [{
|
|
37
|
-
name: "{prefix}:bug:{nome-descritivo}",
|
|
38
|
-
entityType: "bug",
|
|
39
|
-
observations: [
|
|
40
|
-
"Sintoma: [...]",
|
|
41
|
-
"Causa raiz: [...]",
|
|
42
|
-
"Solução: [...]",
|
|
43
|
-
"Arquivos: [...]"
|
|
44
|
-
]
|
|
45
|
-
}]
|
|
46
|
-
})
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## Passo 4: Relatório Final
|
|
52
|
-
|
|
53
|
-
Reportar ao user:
|
|
54
|
-
- Bug resolvido
|
|
55
|
-
- Causa raiz identificada
|
|
56
|
-
- Fix implementado
|
|
57
|
-
- Teste de regressão criado
|
|
58
|
-
- Quality gates passando
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Regras Invioláveis
|
|
63
|
-
|
|
64
|
-
1. **PROIBIDO** prosseguir com testes falhando
|
|
65
|
-
2. **PROIBIDO** prosseguir com build falhando
|
|
66
|
-
3. **PROIBIDO** perguntar ao user (só reportar no final)
|