tdd-repair
하는 일
이 스킬은 실패하는 테스트를 가져와, 시도 횟수와 비용이 제한된 범위에서 테스트가 통과할 때까지 테스트 대상 코드를 고칩니다. 명확한 실패 테스트가 있고 간단한 수정을 원하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓최근 커밋 후 지속 통합 테스트가 실패할 때.
- ✓실패하는 테스트를 작성했고 그에 맞게 코드를 고치고 싶을 때.
- ✓이전에 통과하던 테스트가 깨졌고 수정이 간단한지 보고 싶을 때.
스킬 링크
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-testgen/skills/tdd-repair/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“마지막 커밋 후 이 로그인 테스트가 실패합니다. 테스트를 바꾸지 말고, 테스트가 통과하도록 코드를 고쳐 보세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 스킬은 제한된 도구와 지출 상한이 있는 헤드리스 Claude 세션을 시작합니다. 테스트를 검사 기준으로 실행하므로, 결과는 의견이 아니라 테스트가 통과했는지로 판단됩니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
자주 묻는 질문
테스트를 수정할 수 있나요?
이 스킬은 테스트를 고치지 않고 통과하게 하도록 설정되어 있으며, 테스트 결과가 검사 기준입니다.
아무 코드에서나 안전하게 실행할 수 있나요?
아니요. 셸 도구가 여전히 파일을 바꿀 수 있으므로, 복구할 수 있는 코드에서 깨끗한 git 상태일 때만 실행하라고 원본은 말합니다.
실패하는 테스트가 없으면 어떻게 하나요?
원본은 테스트 없는 모드는 아직 지원되지 않으므로, 먼저 실패하는 테스트를 작성하라고 말합니다.
상세 정보
작성자의 원본 설명
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
인기도
- GitHub 스타
- 81k
- 순위
- #1700
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
agent-adaptive-coordinator
81k작업량이 바뀔 때 에이전트 무리를 나누고 재배치해, 작업에 맞는 배치를 고르도록 에이전트를 돕습니다.
agent-agent
81k큰 목표를 순서가 있는 행동 계획으로 나누고, 조건이 바뀌면 다시 계획하도록 에이전트를 가르칩니다.
agent-agentic-payments
81kAI 쇼핑을 위한 지출 위임장을 관리합니다. 지출 상한, 시간 창, 판매자 규칙, 서명된 승인을 포함합니다.
agent-analyze-code-quality
81k에이전트가 파일을 바꾸지 않고, 코드 품질 문제와 코드 냄새, 기술 부채, 리팩터링 아이디어를 찾아 검토하도록 돕습니다.
비슷한 스킬
test-driven-development
311k에이전트가 기능이나 수정을 만들기 전에 실패하는 테스트를 먼저 쓰고, 그것을 통과시키는 가장 작은 코드를 작성하도록 가르칩니다.
verification-before-completion
311k에이전트가 작업, 수정, 빌드가 완료되었거나 통과했다고 말하기 전에 실제 점검을 실행하고 결과를 읽도록 가르칩니다.
migrate-to-shoehorn
310k테스트 파일의 위험한 타입 캐스팅을 shoehorn 라이브러리로 바꿔, 테스트가 일부 데이터만 써도 타입 검사를 통과하도록 돕습니다.