Back to list
rubrical-studios

tdd-failure-recovery

by rubrical-studios

GitHub CLI extension for project management, sub-issue hierarchies, and batch operations

1🍴 0📅 Jan 25, 2026

SKILL.md


name: tdd-failure-recovery description: Guide experienced developers through TDD failure scenarios and recovery procedures when tests behave unexpectedly license: Complete terms in LICENSE.txt

TDD Failure Recovery

Version: {{VERSION}}

When to Use

  • RED phase test passes unexpectedly (should fail)
  • GREEN phase test still fails (should pass)
  • REFACTOR phase breaks tests (should stay green)
  • Tests behave unpredictably or inconsistently

Scenario 1: RED Phase Test Passes Unexpectedly

Possible causes:

  1. Feature already exists
  2. Test is too permissive
  3. Test setup incorrect

Recovery:

  1. Add intentional failure to verify test can fail
  2. Check for existing implementation
  3. Review test logic
  4. Revise test and verify it fails
  5. Resume TDD cycle

Scenario 2: GREEN Phase Test Still Fails

Possible causes:

  1. Implementation incomplete
  2. Implementation has bugs
  3. Test expectations misunderstood

Recovery:

  1. Read failure message carefully
  2. Verify implementation code
  3. Check test requirements
  4. Revise implementation
  5. Run full test suite
  6. Resume TDD cycle

Scenario 3: REFACTOR Phase Breaks Tests

Possible causes:

  1. Behavioral change introduced
  2. Breaking change in API
  3. Incomplete refactoring
  4. Test dependency on implementation

Recovery:

  1. IMMEDIATE ROLLBACK
  2. Analyze what broke
  3. Decide: Skip, smaller refactoring, or fix test

Critical principle:

TESTS MUST STAY GREEN
If refactoring breaks tests -> ROLLBACK
Do not proceed with broken tests

Scenario 4: Rollback Procedure

  1. Identify changes to undo
  2. Restore previous code version
  3. Verify file state matches pre-change
  4. Run full test suite
  5. Verify all tests GREEN

Scenario 5: Inconsistent Test Results

Possible causes:

  1. Test order dependency
  2. Timing issues
  3. External dependencies
  4. Random data in tests

Recovery:

  1. Run failing test alone
  2. Check test isolation
  3. Fix with proper setup/teardown
  4. Verify consistency

Diagnostic Flowchart

Test failed unexpectedly -> What phase?

RED: Should fail but passes -> Test invalid, revise test
GREEN: Should pass but fails -> Implementation incomplete, revise impl
REFACTOR: Should stay green but fails -> ROLLBACK immediately

Prevention Strategies

  1. Verify Each Phase - Never assume, always run tests
  2. Clear Communication - Report exact results
  3. Maintain Green State - Tests green except during RED phase

Common Recovery Patterns

PatternSituationAction
ResetConfused stateRollback to last green
Minimal FixSmall issueTargeted correction
SkipRisk > rewardDefer to later
Divide and ConquerLarge change brokeBreak into smaller changes

Resources

  • resources/failure-diagnostic-flowchart.md
  • resources/recovery-procedures.md
  • resources/test-isolation-guide.md

End of TDD Failure Recovery Skill

Score

Total Score

65/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon