Tdd

From sigridjineth/oh-my-codex · View interactive version

Tdd is an AI agent skill from the GitHub repository sigridjineth/oh-my-codex. Test-Driven Development enforcement skill - write tests first, always

How to use this skill

Skill file

TDD Mode

[TDD MODE ACTIVATED]

The Iron Law

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST

Write code before test? DELETE IT. Start over. No exceptions.

Red-Green-Refactor Cycle

1. RED: Write Failing Test

2. GREEN: Minimal Implementation

3. REFACTOR: Clean Up

4. REPEAT

Enforcement Rules

| If You See | Action |

|------------|--------|

| Code written before test | STOP. Delete code. Write test first. |

| Test passes on first run | Test is wrong. Fix it to fail first. |

| Multiple features in one cycle | STOP. One test, one feature. |

| Skipping refactor | Go back. Clean up before next feature. |

Commands

Before each implementation:

# Run the project's test command - should have ONE new failure

After implementation:

# Run the project's test command - new test should pass, all others still pass

Output Format

When guiding TDD:

## TDD Cycle: [Feature Name]

### RED Phase
Test: [test code]
Expected failure: [what error you expect]
Actual: [run result showing failure]

### GREEN Phase
Implementation: [minimal code]
Result: [run result showing pass]

### REFACTOR Phase
Changes: [what was cleaned up]
Result: [tests still pass]

External Model Consultation (Preferred)

The tdd-guide agent SHOULD consult Codex for test strategy validation.

Protocol

  1. Form your OWN test strategy FIRST - Design tests independently
  2. Consult for validation - Cross-check test coverage strategy
  3. Critically evaluate - Never blindly adopt external suggestions
  4. Graceful fallback - Never block if tools unavailable

When to Consult

When to Skip

Tool Usage

Before first MCP tool use, call ToolSearch("mcp") to discover deferred MCP tools.

Use mcp__x__ask_codex with agent_role: "tdd-guide".

If ToolSearch finds no MCP tools, fall back to the test-engineer Claude agent.

Remember: The discipline IS the value. Shortcuts destroy the benefit.

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.