मुख्य सामग्री पर जाएँ
Skillpedia
टेस्टिंग81k · #1700

tdd-repair

यह क्या करती है

यह स्किल एक विफल टेस्ट लेती है और सीमित, बजट-सीमा वाला प्रयास करती है कि टेस्ट में आया कोड तब तक ठीक हो जाए जब तक टेस्ट पास न हो। यह उन डेवलपर्स के लिए है जिनके पास साफ़ विफल टेस्ट है और वे एक त्वरित सुधार चाहते हैं।

कब इस्तेमाल करें

  • ✓जब कोई continuous integration टेस्ट हाल के commit के बाद विफल हो जाए।
  • ✓जब आपने एक विफल टेस्ट लिखा है और चाहते हैं कि कोड उसके अनुरूप ठीक हो।
  • ✓जब पहले पास होने वाला टेस्ट टूट गया हो और आप देखना चाहते हैं कि सुधार सरल है या नहीं।

Skill का लिंक

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-testgen/skills/tdd-repair/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-testgen/skills/tdd-repair/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरे आख़िरी commit के बाद यह login टेस्ट विफल हो रहा है। टेस्ट बदले बिना कोड ठीक करने की कोशिश कीजिए, ताकि टेस्ट पास हो।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

स्किल सीमित टूल और खर्च-सीमा के साथ एक सीमित headless Claude session शुरू करती है। जाँच के रूप में वह टेस्ट चलाती है, इसलिए परिणाम इस बात से तय होता है कि टेस्ट पास हुआ या नहीं, किसी राय से नहीं।

तकनीकी सामग्री (मूल 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-workflow skill), then run tdd-repair to 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 -p runs 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't git checkout . after, and run it on a clean git tree.

Algorithm

Implementation: scripts/tdd-repair/tdd-repair.mjs.

  1. 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-command typo.
  2. Spawn claude -p with 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
  3. --allowedTools Read,Edit,Bash restricts capability. --max-budget-usd caps cost per attempt. --permission-mode acceptEdits auto-accepts file edits within the allowed set.
  4. Re-run the test to verify. The test's exit code IS the fitness function — no separate sandbox / LLM-as-judge.
  5. If green: emit success: true + per-attempt usage. If red after --max-attempts: emit success: false + receipts. Either way, the workspace is left as claude -p modified it (caller can git diff to 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 tree पर, क्योंकि अनुमति वाला shell टूल अब भी फ़ाइलें बदल सकता है।

अगर कोई विफल टेस्ट न हो तो?

स्रोत कहता है कि पहले एक विफल टेस्ट लिखें, क्योंकि बिना टेस्ट वाला मोड अभी समर्थित नहीं है।

जानकारी

लेखक का मूल विवरण

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
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

agent-adaptive-coordinator

81k

आपके एजेंट को काम बदलने पर AI एजेंटों के समूह को बाँटने और फिर से संतुलित करने में मदद करती है, और काम के हिसाब से लेआउट चुनती है।

AI और एजेंटएजेंट

agent-agent

81k

आपके एजेंट को बड़े लक्ष्य को क्रमबद्ध कार्यों की योजना में बदलना सिखाती है, और स्थिति बदलने पर योजना फिर से बनाना भी।

AI और एजेंटएजेंट

agent-agentic-payments

81k

AI खरीदारी के लिए खर्च के आदेश मैनेज करने में मदद करती है, जिसमें खर्च की सीमा, समय अवधि, व्यापारी नियम और signed मंज़ूरियाँ शामिल हैं।

AI और एजेंटएजेंट

agent-analyze-code-quality

81k

आपके एजेंट को कोड की गुणवत्ता जाँचने में मदद करती है, बिना फ़ाइलें बदले code smells, technical debt और refactoring के सुझाव खोजकर।

कोडिंगसामान्य कोडिंग

मिलती-जुलती skills