From oh-no-harness
Enforces RED/GREEN/REFACTOR discipline before behavior-changing production edits. Use inside ralph or systematic-debugging workflows, or when explicitly asked for TDD/test-first work.
How this skill is triggered — by the user, by Claude, or both
Slash command
/oh-no-harness:test-driven-development <explicit TDD/test-first change><explicit TDD/test-first change>The summary Claude sees in its skill listing — used to decide when to auto-load this skill
<!-- oh-no-harness-generated-skill-wrapper -->
This generated file is the Codex-facing runtime skill document. Codex should read this file directly; maintainers edit the source documents listed below instead.
Source order:
../../docs/skill-core/test-driven-development.md../../docs/platforms/codex-runtime.mdThe sections below are already composed for this platform. Do not ask the runtime model to load another platform's runtime document or invocation syntax.
Write the test first. Watch it fail. Write the smallest production change that makes it pass. Refactor only after green.
Test Driven Development is the internal mid-loop discipline for behavior-change work inside implementation and bug-fix execution.
Use it inside ralph, systematic-debugging, or an explicitly chosen tiny direct edit path before changing production behavior. It is not a requirements, planning, cleanup, or final-verification substitute.
Do not use this skill as the top-level route for ordinary implementation
requests such as "add this feature", "fix this bug", "refactor this module",
or "implement this behavior". This is not a top-level implementation skill.
Use ralph for those concrete implementation requests so execution mode,
worktree isolation, review, cleanup, verification, and final reporting stay
attached to the work.
Use this skill as a top-level entry only when:
ralph, systematic-debugging, or
ultrawork) reaches its internal TDD gateAfter the cycle completes, return control to ralph, systematic-debugging,
ultrawork, or the explicitly chosen tiny direct edit path. Do not continue as
a substitute for ralph.
Use before editing production code for:
Exceptions require explicit user approval or a documented reason:
If a test harness is missing, write a verification plan before changing behavior. A missing practical harness permits a documented TDD exception plus existing real-surface, bounded manual, or residual-risk evidence; it does not authorize new durable test infrastructure or production seams unless the user separately approves that scope.
No behavior-changing production code without a failing test first.
If production behavior was changed before a failing test existed, do not treat later tests as TDD evidence. Either restart the behavior change from a failing test or document explicit user approval to continue without TDD.
For each behavior:
For this cycle, one behavior means one observable contract change from the approved Direction Contract, not each internal branch, helper, or condition. Coupled internal conditions that serve one observable outcome may share one minimal RED; independent user-visible outcomes remain separate cycles.
Do not batch independent observable behaviors into one RED step. If the test name joins independent user-visible outcomes with "and", split the test; do not split solely because one outcome depends on coupled internal conditions.
One minimal RED/GREEN case per changed behavior is the default. Add negative, boundary, semantic-model, concurrency, resume, adversarial, or baseline cases only when an AC ID, named safety/risk trigger, adjacent regression surface, or safety invariant requires them. A reviewer may identify a verification hole; it may not demand an exhaustive matrix merely because stronger proof is imaginable.
If no approved admission source exists, record the proposed extra case as not relevant with the reason and do not implement it.
Tests remain evidence under the AC-bearing product story. Do not turn test infrastructure into a separate product story unless the user requested it as an outcome. Do not build a product-like state machine, scheduler, protocol simulator, Git oracle, duplicate parser, fixture factory, or full runtime model solely to verify the implementation. When the smallest credible test would need that machinery, prefer an existing real-surface lane or record a bounded manual or residual-risk check.
A valid RED test:
If the test passes immediately, it is not RED. Change the test or choose a behavior that is not already covered.
If the test errors before reaching the behavior, fix the test setup and rerun until it fails for the expected reason.
GREEN means:
If another check fails, fix it before moving on.
Refactor only after GREEN.
Allowed refactors:
Not allowed during refactor:
After refactoring, rerun the relevant GREEN check.
For a bug fix, first write a test that reproduces the bug.
The RED evidence must show the original symptom or a minimal equivalent. A fix without a reproduction test is not TDD unless the user explicitly approves the exception.
For behavior-preserving refactors, first add or identify characterization tests that lock the existing behavior.
Run those tests before refactoring, then rerun them after each meaningful refactor step.
When this skill is used from a session-scoped workflow (ralph, ultrawork, or
systematic-debugging operating in a session), record TDD evidence in:
.oh-no/sessions/{sessionId}/verification.md
On a direct edit path with no session, record the same RED/GREEN/REFACTOR evidence inline in the final report or completion claim instead.
Record:
| Rationalization | Response |
|---|---|
| "I will test after." | Tests after code do not prove the test would have caught the missing behavior. |
| "This is too small." | Small behavior still needs a guard if it can regress. |
| "Manual testing is faster." | Manual checks are not repeatable evidence. |
| "The existing code has no tests." | Add the smallest useful test around the changed surface. |
| "The test is hard to write." | Hard to test often means unclear interface or excess coupling. Simplify the design or ask for help. |
| "I already wrote the code." | Later tests are not RED evidence. Restart or document explicit user approval. |
Before claiming the behavior is complete:
None — this is an internal mid-loop discipline. Return control to the caller skill (ralph, systematic-debugging, or the tiny direct edit path) once the cycle is complete or an exception is recorded. Do not continue as a substitute for ralph.
This compact platform section is embedded in generated Codex-facing skill documents.
Codex-facing public skills live under skills/. Generated
skills/<skill>/SKILL.md files compose the matching skill core, this compact
runtime section, and any Codex skill-specific overlay such as
docs/platforms/codex-<skill>.md.
Ask approval, preference, scope, or next-step questions directly in the Codex conversation. Keep prompts outcome-first: state the desired outcome, acceptance criteria, non-goals or side effects, expected evidence, and output shape before detailed steps.
Use compact final answers unless the active skill requires a plan, review, or verification report. Preserve durable state in written artifacts before long work, compaction, or handoff.
Dispatch only after the active skill's trigger fires, then read
docs/platforms/codex.md ## Role Dispatch for the full host contract. Use
spawn_agent(agent_type="oh-no-<role>", ...) first, do not combine it with
fork_context=true, and use generic prompt embedding only after the custom
agent is actually rejected. The task packet carries scope, ownership, expected
output, and lifecycle.
Every dispatched result is a dependency: wait_agent must reach final status,
the caller captures and uses the output, and only then performs lifecycle
cleanup. Timeout, empty output, or "No agents completed yet" is not final; do
not close, redo inline, or use missing output as evidence.
After confirmed custom-agent unavailability, embed
docs/agent-core/<role>.md; see the full platform doc for the fallback shape.
This channel is trigger-loaded, not embedded in every workflow decision. When a
named THOROUGH paired-review or Fusion Rescue trigger fires, read and apply
docs/platforms/codex.md ## Cross-Host Consult Channel before dispatch. Until
then, do not preload opposite-host invocation details.
npx claudepluginhub jcwleo/oh-no-harness --plugin oh-no-harnessEnforces RED/GREEN/REFACTOR discipline before behavior-changing production edits. Use inside ralph-owned execution or when explicitly asked for TDD/test-first work.
Enforces test-driven development: write failing tests before production code for any behavior change. Triggers on TDD, implementation tasks, bug fixes needing regression tests.