agentleFS
arumaekawaarumaekawa/codex-skills/skills/test-driven-debug/SKILL.md

test-driven-debug

Skill4 starsChanged 4 months agoMITView on GitHub

Debug and fix bugs with a regression-test Red-Green cycle and a living Debug Note. Use for unintended code behavior, including bugs found during code review or testing.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill to fix:

    line 12
  2. Distinctive:

    Do not use it for new features or intentional behavior changes.

    line 18
  3. Very specific:

    Create .agent-work/debug/{YYYY-MM-DD}-{short-task-name}.md from the template below.

    line 20
  4. Distinctive:

    Establish Green: Run the regression test and any preservation tests selected in step 3.

    line 28

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Test Driven Debug

Trace a bug to its cause, prove it with a failing regression test, fix the cause, and verify the test turns green.

When to Use

Use this skill to fix:

  • bugs found during code review
  • regressions or failing tests caused by unintended behavior
  • behavior that violates an existing expectation or contract

Do not use it for new features or intentional behavior changes.

Create .agent-work/debug/{YYYY-MM-DD}-{short-task-name}.md from the template below. If creating .agent-work/, create .agent-work/.gitignore containing only *; do not modify the repository root .gitignore. Update the matching section and progress after each step; keep evidence and decisions, not raw logs.

Workflow

  1. Define the issue. Record the observed and expected behavior, reproduction conditions, scope, and constraints. Separate facts from assumptions.
  2. Identify the cause. Reproduce the issue through the smallest reliable path when practical, trace the real code path, and validate where behavior diverges. Do not fix without evidence for both the failure and its cause.
  3. Establish Red. Add or identify a regression test for the expected behavior, using a public behavior path when practical. Add focused preservation tests only for uncovered behavior the fix could break. Before the fix, confirm the regression test fails for the intended reason and any preservation tests pass.
  4. Fix the cause. Apply the smallest clear correction without weakening the tests or adding unrequested fallback behavior. Return to the earliest affected step if new evidence invalidates the cause or test.
  5. Establish Green. Run the regression test and any preservation tests selected in step 3. Set the Debug Note status to Complete only when the cause is supported, the regression test changed from Red to Green for the intended reason, and any preservation tests pass.

Debug Note

# Debug: {Task}

- Status: In progress
- Started: {YYYY-MM-DD}

## Issue

- Observed: {Incorrect behavior}
- Expected: {Correct behavior}
- Reproduction: {Conditions or command}
- Scope and constraints: {Boundaries and known constraints}

## Progress

- [ ] 1. Define the Issue
- [ ] 2. Identify the Cause
- [ ] 3. Establish Red
- [ ] 4. Fix the Cause
- [ ] 5. Establish Green

## Investigation

- Evidence: {Confirmed facts and relevant code path}
- Cause: {Supported causal explanation}

## Tests

- Regression: {Test name or location}
- Red: {Command, observed failure, and why it proves the bug}
- Preservation: {At-risk behavior, focused tests, and pre-fix results, or `None`}

## Fix

- Change: {Correction to the identified cause}

## Verification

- Green: {Regression test command and passing result}
- Preservation: {Post-fix results, or `None`}

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.