Odf tdd

From antoniodavid/odf-agent-team · View interactive version

Odf tdd is an AI agent skill from the GitHub repository antoniodavid/odf-agent-team. Use when strict TDD is active: resolve the kill switch, write a failing test first, and require matching tests in VERIFY.

How to use this skill

Skill file

Activation Contract

Use only when the effective TDD policy gate is ON. The gate is global

flags.strict_tdd AND absence of the local off marker; any off or unreadable

source disables enforcement.

When to Use

Active when the EFFECTIVE TDD mode is ON. Effective mode = two-source kill switch: global flags.strict_tdd (registry) AND the absence of local marker <worktree>/.odf/tdd.off. ANY source off → effective OFF; unreadable local source → fail-closed OFF (never ON). Enforces test-first development across all ODF phases. Each feature MUST have a failing test before implementation begins.

Hard Rules

| Rule | Requirement |

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

| Tool-resolved effective mode | La resolución efectiva la ejecuta la tool odf_policy_gate (global + local, fail-closed); este skill aplica el modo efectivo resuelto |

| Resolve effective mode first | Effective = global AND local. Any off wins; unreadable local → OFF. Never assume ON |

| Test before code | Write failing test FIRST, THEN implement to make it pass (red-green-refactor) |

| Every REQ-XX needs a test | No implementation task without a corresponding test task |

| Tests stay with code | Test file belongs in same commit as the behavior it verifies |

| VERIFY fails if untested | If code exists without test for a REQ-XX, status: failed |

| Opt-in only | Global via /odf-tdd on; repo-local OFF-only via /odf-tdd local off. A repo cannot force TDD on |

| Re-activation re-validates | Re-enabling TDD re-validates state from zero — does NOT inherit "was off, still no mandatory tests" |

Decision Gates

| Condition | Action |

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

| Effective ON AND no test for REQ-XX | Block IMPLEMENT, require test task first |

| Effective ON, test written but red evidence is missing or it passes before code | Block IMPLEMENT; demonstrate a genuine failing run (non-zero exit code and output) before writing implementation |

| Effective OFF (any source off, or local unreadable) | Standard behavior: tests can come after code |

| User runs /odf-tdd on | Set global flag in registry; effective mode still gated by local source |

| User runs /odf-tdd local off | Create <worktree>/.odf/tdd.off → effective OFF for that repo |

Execution Steps

  1. RESOLVE effective mode BEFORE each IMPLEMENT/VERIFY phase: read global flags.strict_tdd from the ODF registry (odf-registry.json) AND check for <worktree>/.odf/tdd.off (worktree root via git rev-parse --show-toplevel). Any off (or unreadable local) → effective OFF. This effective mode is what applies — the preflight tdd_mode is only the declared default.
  2. ASSESS: Include "testable" as requirement criterion. Each REQ-XX must have a testable scenario.
  3. DESIGN: Every implementation task must have a paired test task. Task IDs: T-N for test, I-N for implementation.
  4. IMPLEMENT: For each pair: write test (T-N) → run the focused test and persist non-zero red evidence for the intended behavior → implement (I-N) → confirm the same test passes. A claimed red state without command, exit code, and output is not evidence; block if red cannot be demonstrated.
  5. VERIFY: Check that every REQ-XX has a PASSING test. If code exists without test → FAIL.

Test Discipline

Output Contract

When enforcing: return status: blocked with reason: "Strict TDD: REQ-XX has no test. Write test before implementing." and tdd_effective: on.

When not enforcing (any source off): include tdd_effective: off.

When passing: include tdd: compliant in the result.

References

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.