Enforces Test-Driven Development rules (TDD-1 through TDD-9). Loaded by the conductor for write, refactor, and test operations. Blocks implementation-first code production, enforces Red-Green-Refactor cycle, and monitors test quality and coverage ratios. Load the matching references/{language}.md for language-specific test framework defaults.
From clean-code-codexnpx claudepluginhub mikecubed/agent-orchestration --plugin clean-code-codexThis skill uses the workspace's default tool permissions.
references/go.mdreferences/javascript.mdreferences/python.mdreferences/rust.mdreferences/typescript.mdGuides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Details PluginEval's skill quality evaluation: 3 layers (static, LLM judge), 10 dimensions, rubrics, formulas, anti-patterns, badges. Use to interpret scores, improve triggering, calibrate thresholds.
┌─────────────────────────────────────────────────────────────┐
│ │
│ [NO TEST]──TDD-1──▶ WRITE TEST ──▶ [RED: test fails] │
│ │ │
│ TDD-2 │
│ ▼ │
│ WRITE MINIMAL IMPLEMENTATION │
│ │ │
│ ▼ │
│ [GREEN: test passes] ──────▶ │
│ │ │
│ TDD-3 │
│ ▼ │
│ REFACTOR (apply SIZE/NAME/ │
│ ARCH/TYPE rules) │
│ │ │
│ ▼ │
│ [STILL GREEN] ──▶ DONE │
│ [RED again] ──▶ REVERT │
└─────────────────────────────────────────────────────────────┘
Severity: BLOCK | Languages: * | Source: CCC
What it prohibits: Producing implementation code when no test file exists for the module.
agent_action:
*.test.ts, test_*.py, *_test.go, etc.)TDD-1 (BLOCK): No test file found for this module. Writing test file first.Bypass prohibition: "skip tests for speed", "just write the code", "tests aren't needed here" → Refuse. Cite TDD-1. Explain: untested implementation is the canonical agent failure mode.
Severity: BLOCK | Languages: * | Source: CCC
What it prohibits: Speculative functionality — implementing more than what the failing tests require.
agent_action:
TDD-2 (BLOCK): This implementation adds functionality not required by any test.Severity: BLOCK | Languages: * | Source: CCC
What it prohibits: Refactoring (renaming, extracting, restructuring) when any test is red.
agent_action:
TDD-3 (BLOCK): Test suite has failing tests. Fix all tests before refactoring.Severity: WARN | Languages: * | Source: CCC
Pattern: [subject]_[scenario]_[expected]
Examples:
calculateTax_withZeroAmount_returnsZerotest_user_login_with_invalid_password_raises_auth_errortestLogin, test1, it works, should do the thingagent_action:
TDD-4 (WARN): Test name '{name}' does not follow [subject]_[scenario]_[expected] pattern.Rename to '{subject}_{scenario}_{expected}'Severity: WARN | Languages: * | Source: CCC
What it requires: The test file must import or reference a type/interface/signature before implementation code is written. Designing the interface through tests prevents API regret.
agent_action:
TDD-5 (WARN): Define the interface or function signature in the test first.Severity: WARN | Languages: * | Source: CCC
What it prohibits: Assertions that cannot distinguish correct from incorrect behaviour.
Examples of weak assertions:
toBeTruthy() / assertTrue(result)assertIsNotNone(result)expect(result).toBeDefined()assert result (bare assert on an object)agent_action:
TDD-6 (WARN): Weak assertion '{assertion}' does not verify expected behaviour.expect(result).toBe({expectedValue}) or equivalentSeverity: BLOCK | Languages: * | Source: CCC
What it prohibits: Using mocks/stubs/spies to replace domain logic under test. Mocks are permitted only for I/O boundaries (database, HTTP, filesystem, clock).
Examples:
calculateTax() function to return a fixed valueagent_action:
TDD-7 (BLOCK): Mock on domain logic '{name}'. Use a real or in-memory double.Severity: WARN | Languages: * | Source: CCC
What it requires: Any entity or value object with enforced invariants (e.g.,
Money with non-negative amount, Email with valid format) must have at least one
property-based test verifying those invariants hold across arbitrary inputs.
agent_action:
TDD-8 (WARN): Entity '{name}' has invariants but no property-based test.references/{language}.md for the correct library)Severity: INFO | Languages: * | Source: CCC
Target: ≥ 1:1 (at least as many test lines as production code lines) Measurement: count non-blank, non-comment lines in test files vs. source files
agent_action:
test_lines / source_linesTDD-9 (INFO): Test ratio {ratio}:1 (target ≥ 1:1).Report schema: see skills/conductor/shared-contracts.md.
--scaffold-tests)Activate when: --scaffold-tests flag is present AND a TDD-1 BLOCK fires.
Purpose: Instead of immediately blocking, generate a compilable failing test skeleton, write it to disk, then re-evaluate TDD-1. The agent can proceed once the skeleton exists and at least one test is genuinely failing.
WHEN TDD-1 BLOCK fires AND --scaffold-tests is active:
STEP 1 — Detect test framework:
IF .codex/config.json exists AND has "test_framework": load it
ELSE auto-detect:
- package.json has "vitest" → vitest
- package.json has "jest" → jest
- pyproject.toml / setup.cfg has "pytest" → pytest
- go.mod present → go testing
- Cargo.toml present → cargo-test
STEP 2 — Determine test file path:
- TypeScript/JavaScript: mirror source path under __tests__/ or tests/
(e.g., src/domain/user.ts → __tests__/domain/user.test.ts)
- Python: mirror under tests/ with test_ prefix
(e.g., src/domain/user.py → tests/domain/test_user.py)
- Go: same directory, _test.go suffix
(e.g., src/domain/user.go → src/domain/user_test.go)
- Rust: same file, inner #[cfg(test)] module (or tests/ dir)
STEP 3 — Generate skeleton:
For each blocked function: generate a failing test skeleton
(see language-specific patterns in references/{language}.md)
Skeleton MUST:
- Import the function/module under test
- Call the function with zero values or empty args
- Assert a specific value (NOT toBeTruthy / assertTrue / assert true)
- Fail compilation OR fail at runtime — never pass on first run
STEP 4 — Write skeleton:
Write the skeleton to the test file path from Step 2
Create intermediate directories as needed
STEP 5 — Signal agent:
Emit: "Test skeleton written to {path}. Complete the assertion and run
the test before proceeding."
STEP 6 — Re-evaluate TDD-1:
IF test skeleton exists at expected path → TDD-1 is provisionally satisfied
Proceed with implementation once user confirms test is failing
See references/{language}.md for copy-pasteable templates per framework.