Agent skill
root-cause-tracing
Rastrear origem de bugs
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/root-cause-tracing-brunoccteixeira-ta-na-mao
SKILL.md
Metodologia para encontrar a causa raiz de bugs em sistemas async.
Processo de 5 Passos
1. OBSERVAR: Coletar Sintomas
# O que acontece?
# - Qual o erro exato?
# - Quando acontece?
# - E consistente ou intermitente?
# Coletar logs
docker compose logs backend 2>&1 | tail -100
2. FORMULAR: Hipoteses Ordenadas
Listar possiveis causas por probabilidade:
1. [Mais provavel] Timeout de conexao com API externa
2. [Provavel] Dados invalidos na entrada
3. [Menos provavel] Race condition no async
3. ISOLAR: Testar Hipoteses
# Criar script de teste isolado
# backend/scripts/debug_issue.py
import asyncio
from app.services.suspeito import funcao_suspeita
async def main():
# Testar com dados conhecidos
resultado = await funcao_suspeita("entrada_teste")
print(f"Resultado: {resultado}")
asyncio.run(main())
4. RASTREAR: Seguir o Fluxo
Fluxo tipico no Ta na Mao:
Request HTTP
|
Router (app/routers/)
|
Agent (app/agent/agent.py)
|
Tool (app/agent/tools/)
|
Service (app/services/)
|
Database/API Externa
5. CONFIRMAR: Validar Causa Raiz
# Reproduzir com fix aplicado
pytest backend/tests/test_bug_fix.py -v
# Verificar que nao quebrou outras coisas
pytest backend/tests/ -v
Ferramentas de Debug
Logs Estruturados
import logging
logger = logging.getLogger(__name__)
async def funcao_suspeita(entrada):
logger.debug(f"Entrada: {entrada}")
# ... processamento
logger.debug(f"Saida: {resultado}")
return resultado
Breakpoints com pdb
import pdb; pdb.set_trace()
# ou em async:
import asyncio
# breakpoint() funciona em Python 3.7+
Trace de Chamadas
import traceback
try:
resultado = await funcao_suspeita()
except Exception as e:
traceback.print_exc()
raise
Padroes Comuns de Bugs Async
| Sintoma | Causa Provavel | Solucao |
|---|---|---|
| Timeout | await faltando | Adicionar await |
| Dados inconsistentes | Race condition | Usar lock/semaphore |
| Conexao recusada | Pool esgotado | Verificar pool size |
| Resultado None | Excecao silenciosa | Adicionar try/except |
| Memoria alta | Coroutines nao finalizadas | Verificar gather/wait |
Checklist de Investigacao
- Erro aparece nos logs?
- Consigo reproduzir localmente?
- Acontece com todos os inputs?
- Qual commit introduziu o bug?
- Testes existentes cobrem esse caso?
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?