| name | amia-tdd-enforcement |
| description | Use when enforcing TDD via RED-GREEN-REFACTOR. No production code without a failing test first. Trigger with /enforce-tdd. Loaded by ai-maestro-integrator-agent-main-agent. |
| license | MIT |
| compatibility | Requires understanding of TDD principles, RED-GREEN-REFACTOR cycle, test frameworks, and version control. Works with any programming language that supports automated testing. Requires AI Maestro installed. |
| metadata | {"author":"Emasoft","version":"2.0.0"} |
| agent | amia-test-engineer |
| context | fork |
| user-invocable | false |
TDD Enforcement Skill
Overview
Enforces Test-Driven Development discipline through the RED-GREEN-REFACTOR cycle. The Iron Law: no production code without a failing test first. The coordinator verifies compliance on remote agents — it delegates, not implements.
Prerequisites
- Test framework for the target language (pytest, Jest, cargo test, etc.)
- Version control (Git) for tracking TDD commits
- AI Maestro for delegating to Remote Developer Agents
Instructions
- Write a failing test (RED) — Create a test documenting intended behavior. Run it to confirm it fails.
- Make the test pass (GREEN) — Write minimum code to pass the test. Run all tests.
- Refactor (REFACTOR) — Improve code quality, keep all tests passing.
- Commit after each phase — Use
RED:/GREEN:/REFACTOR: prefixes.
- Return to RED — Start the next feature with a new failing test.
Critical Rule: Never write production code without a failing test first.
Checklist
Copy this checklist and track your progress:
Output
| Output Type | Description |
|---|
| TDD Status Report | Phase status (pending/RED/GREEN/refactor) per feature |
| Git Commits | Pattern: RED: test for [feature], GREEN: implement [feature], REFACTOR: improve [aspect] |
| Test Results | Pass/fail status after each phase transition |
| Enforcement Decisions | Allow/deny based on TDD compliance |
| Violation Reports | TDD violations with recovery procedures |
Output discipline: All scripts support --output-file <path>.
Error Handling
Script failures return non-zero exit codes. Check stderr for details. See the detailed guide in Resources for common error scenarios.
Examples
RED-GREEN-REFACTOR Cycle
python -m pytest tests/test_auth.py::test_login -x
python -m pytest tests/test_auth.py::test_login -x
python -m pytest tests/ -x
See the detailed guide in Resources for extended examples.
Resources
Full reference: detailed-guide:
- Coordinator Role
- TDD Cycle Details
- Core Principles Navigation
- Implementation Guidance Navigation
- Step-by-Step Implementation
- Common Patterns
- Rules and Enforcement Navigation
- Problem Solving Navigation
- Progressive Learning Path
- RULE 14 Requirement Compliance
- TDD and Requirement Compliance
- Test-Requirement Traceability
- When Tests Reveal Requirement Issues
- TDD Phase Requirement Checks
- Error Handling
- Issue: Test passes on first run (RED phase failed)
- Issue: Production code written without failing test
- Issue: Refactoring breaks tests
- Complete Reference Document Index