tdd-repair
O que ela faz
Esta skill pega um teste que falha e faz uma tentativa limitada, com teto de custo, de corrigir o código testado até o teste passar. É para desenvolvedores que têm um teste falhando bem definido e querem uma correção pontual.
Quando usar
- ✓Quando um teste de integração contínua falha depois de um commit recente.
- ✓Quando você escreveu um teste que falha e quer que o código seja corrigido para atendê-lo.
- ✓Quando um teste que passava antes quebrou e você quer ver se a correção é simples.
Link da skill
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-testgen/skills/tdd-repair/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Este teste de login está falhando depois do meu último commit. Tente corrigir o código para o teste passar, sem alterar o teste.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
A skill inicia uma sessão headless limitada do Claude, com ferramentas restritas e um teto de gasto. Ela usa o teste como verificação, então o resultado é julgado pelo fato de o teste passar, e não por uma opinião.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
Surfaces the Test-Driven Repair loop as a ruflo skill. Use when you have a failing test and want the source-under-test fixed automatically, with the test's pass/fail as the verification gate (no LLM-as-judge).
When to use
- Failing CI test from a recent commit — point this at the test file, get a verified fix (or a clear "couldn't repair within budget" receipt).
- Local TDD workflow — write the failing test first (
tdd-workflowskill), then runtdd-repairto drive the green. - Regression triage — a previously-green test went red; before opening an issue, spend ~$1 to see if the fix is trivial.
When NOT to use
- No failing test exists. Conformant mode (
--no-test-oracle) is scoped for a follow-up ADR — needs MCTS over repro generation. For now, write a failing test first. - Architectural changes. This skill is for tactical "make red green" fixes. Cross-module refactors that incidentally break tests should be done by a human or a swarm.
- Untrusted code. The headless
claude -pruns with--allowedTools Read,Edit,Bash— no MCP, no network, no arbitrary file writes — but Bash can still read and write the filesystem and reach the network, so allowing it is not a sandbox. Don't point this at code you wouldn'tgit checkout .after, and run it on a clean git tree.
Algorithm
Implementation: scripts/tdd-repair/tdd-repair.mjs.
- Pre-flight verify — run the test command. If it already passes, exit 2 (
test-already-passes). Repairing a green test is either a no-op or a--test-commandtypo. - Spawn
claude -pwith a focused prompt:- Failing test file path (read-only intent)
- Test command (run only)
- Hard constraint: do NOT modify the test
- Hard constraint: do NOT add new dependencies
--allowedTools Read,Edit,Bashrestricts capability.--max-budget-usdcaps cost per attempt.--permission-mode acceptEditsauto-accepts file edits within the allowed set.- Re-run the test to verify. The test's exit code IS the fitness function — no separate sandbox / LLM-as-judge.
- If green: emit
success: true+ per-attempt usage. If red after--max-attempts: emitsuccess: false+ receipts. Either way, the workspace is left asclaude -pmodified it (caller cangit diffto review).
Output shape
{
"success": true,
"data": {
"repaired": true,
"attemptsTaken": 1,
"mode": "test-driven",
"before": { "passed": false, "exitCode": 1 },
"after": { "passed": true, "exitCode": 0, "durationMs": 4321 },
"attempts": [
{ "attempt": 1, "claude": { "ok": true, "durationMs": 38421, "usage": { "cost_usd": 0.0234 } }, "verify": { "passed": true } }
],
"totalCostUsd": 0.0234,
"budgetUsd": 5.0,
"budgetExhausted": false,
"shape": { "repo": "...", "test": "...", "testCommand": "...", "maxAttempts": 1, "model": "haiku" }
}
}
Exit codes
| Code | Meaning |
|---|---|
| 0 | Test green after repair (success) |
| 1 | Test still red after --max-attempts |
| 2 | Config error (test file missing, test already passes, --no-test-oracle unsupported, etc.) |
| 3 | Claude CLI exited non-zero (infrastructure failure) |
| 99 | Reserved for safety tripwire (per ADR-153) |
Safety posture
| Layer | Mechanism |
|---|---|
| Cost cap | --max-budget-usd default $5, divided across --max-attempts. Hard ceiling — claude exits when reached. |
| Capability cap | --allowedTools Read,Edit,Bash — no MCP tools. Bash can still write files and use the network, so this narrows the tool set, it is not a sandbox. |
| Scope cap | The prompt forbids adding dependencies. The test file is enforced, not just requested: if an attempt changes it, the original bytes are restored and the attempt is scored failed (reason: test-file-modified). |
| Confirmation gate | --confirm REQUIRED — without it, returns dry-run plan (mirrors harness-evolve / harness-mint convention). |
| Hard timeout | 15 min total wall-clock; per-attempt budget of timeoutMs / maxAttempts. |
| Pre-flight | Refuses to run if the test already passes (catches --test-command typos). |
Inspiration
Modeled on the Test-Driven Repair mode from agent-harness-generator/packages/darwin-mode ADR-175. Key design difference: instead of wrapping metaharness-darwin evolve (population-based search), we drive a
Perguntas frequentes
Ela pode editar o teste?
A skill foi configurada para fazer o teste passar sem modificá-lo, e o resultado do teste é a verificação.
É seguro rodar em qualquer código?
Não. A fonte diz para rodar apenas em código que você consiga restaurar, em uma árvore git limpa, porque a ferramenta de shell permitida ainda pode alterar arquivos.
E se não houver teste falhando?
A fonte diz para escrever antes um teste que falha, pois o modo sem teste ainda não é suportado.
Detalhes
Descrição original do autor
Test-Driven Repair: given a failing test, spawn a bounded headless `claude -p` (Read/Edit/Bash only, --max-budget-usd capped) that makes the test pass without modifying it. Use when a failing test should drive the fix to the code under test.
repo: ruvnet/ruflo
Popularidade
- Estrelas no GitHub
- 81 mil
- Posição no ranking
- #1700
- Licença
- MIT
- Atualizada em
- 02/11/2026
Comentários
- …
Mais skills deste repositório
agent-adaptive-coordinator
81 milAjuda seu agente a dividir e rebalancear um grupo de agentes de IA conforme a carga de trabalho muda, escolhendo um layout adequado à tarefa.
agent-agent
81 milEnsina seu agente a transformar um grande objetivo em um plano ordenado de ações e a replanejar quando as condições mudarem.
agent-agentic-payments
81 milAjuda seu agente a gerenciar mandatos de gasto para compras com IA, com tetos de valor, janelas de tempo, regras de lojistas e aprovações assinadas.
agent-analyze-code-quality
81 milAjuda seu agente a revisar código quanto à qualidade, encontrando code smells, dívida técnica e ideias de refatoração sem alterar os arquivos.
Skills parecidas
test-driven-development
311 milEnsina seu agente a escrever primeiro um teste que falha, ver a falha e depois escrever o menor código que passa, antes de criar qualquer funcionalidade ou correção.
verification-before-completion
311 milEnsina seu agente a rodar verificações reais e ler a saída antes de afirmar que uma tarefa, correção ou build está concluído ou passando.
migrate-to-shoehorn
310 milSubstitui conversões de tipo arriscadas nos seus arquivos de teste pela biblioteca shoehorn, para que os testes usem dados parciais e ainda passem na checagem de tipos.