TDD
Testing & QualitytddTDD is an Agent Skill for testing & quality published in the Yeachan-Heo/oh-my-codex repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
TDD deprecated shim
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/Yeachan-Heo/oh-my-codex/blob/HEAD/skills/tdd/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/tdd, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
TDD deprecated
Hard-deprecated. Do not invoke or route this skill. Keep test-first discipline inside the active implementation workflow and verify with the project test suite.
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
- Write test for the NEXT piece of functionality
- Run test - MUST FAIL
- If it passes, your test is wrong
2. GREEN: Minimal Implementation
- Write ONLY enough code to pass the test
- No extras. No "while I'm here."
- Run test - MUST PASS
3. REFACTOR: Clean Up
- Improve code quality
- Run tests after EVERY change
- Must stay green
4. REPEAT
- Next failing test
- Continue cycle
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
- Form your OWN test strategy FIRST - Design tests independently
- Consult for validation - Cross-check test coverage strategy
- Critically evaluate - Never blindly adopt external suggestions
- Graceful fallback - Never block if tools unavailable
When to Consult
- Complex domain logic requiring comprehensive test coverage
- Edge case identification for critical paths
- Test architecture for large features
- Unfamiliar testing patterns
When to Skip
- Simple unit tests
- Well-understood testing patterns
- Time-critical TDD cycles
- Small, isolated functionality
Tool Usage
Prefer native test-engineer consultation or CLI-backed ask surfaces when available. Optional MCP compatibility ask tools may be used only when already enabled. If consultation tools are unavailable, fall back to the test-engineer agent.
Remember: The discipline IS the value. Shortcuts destroy the benefit.