TDD debug

From caidish/cAI-tools · View interactive version

TDD debug is an AI agent skill from the GitHub repository caidish/cAI-tools. Test-Driven Development debug workflow combined with multi-agent collab-fix. Use when the user asks to "TDD debug", "reproduce and fix with a test", or wants a bug fixed with a failing test written first and verified after the fix.

How to use this skill

Skill file

TDD Debug Protocol

Debug the user's bug using a Test-Driven Development approach combined with the collab-fix protocol.

Overview

  1. Write a failing test that reproduces the bug.
  2. Fix the bug using multi-agent collaboration.
  3. Verify the test passes after the fix.

Requirements

Constraints


Phase 1: Reproduce the Bug with a Failing Test

1.1 Analyze the Bug

Expand the bug description with context: expected behavior, actual (buggy) behavior, relevant code paths, the project's testing framework. Keep the user's wording verbatim alongside your notes.

1.2 Design the Test (parallel)

Ask codex, gemini-cli, and a test-automator subagent to each propose a reproducing test:

1.3 Select and Implement

  1. Compare the 3 proposals and summarize approaches.
  2. Use AskUserQuestion to let the user pick.
  3. Implement the chosen test in the appropriate test file.

1.4 Verify the Test Fails

  1. Run the test to confirm it FAILS (proving the bug exists).
  2. Use AskUserQuestion:
  1. If the user rejects the test, iterate (return to 1.2).
  2. Do not proceed to Phase 2 until the user confirms the test is valid.

Phase 2: Fix the Bug (collab-fix with test verification)

2.1 Propose Fix Plans (parallel)

2.2 Select Fix

Compare the 3 plans, summarize tradeoffs, and ask the user only the necessary questions via AskUserQuestion.

2.3 Implement

Ultrathink and implement the fix yourself. Do not git commit.

2.4 Verify Test Passes

Run the reproducing test. If it still fails, analyze and iterate.

2.5 Cross-Review (parallel)

2.6 Iterate

Resolve human-preference items via AskUserQuestion. Repeat 2.3–2.5 until all three reviewers are satisfied AND the test passes, or 5 rounds are reached.

If no consensus after 5 rounds, report:


Summary Output

After completion, report:

  1. Bug description (original)
  2. Test created — location and purpose
  3. Fix applied — summary of the changes
  4. Test status — confirmation it now passes
  5. Review consensus — final reviewer feedback
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.