agentleFS
mkritter3mkritter3/codex-paired-superpowers/skills/test-driven-development/SKILL.md

test-driven-development

Skill0 starsChanged 58 days agoMITView on GitHub

Use before writing any non-trivial test suite. Claude drafts the test list; Codex reviews coverage, edge cases, and mock/integration trade-offs in a 7-round loop. Then standard red-green-refactor proceeds.

190 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use chinese-code-review, chinese-commit-conventions and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Leodorareluctant259Skill

    chinese-code-review

    中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈

    Also in 8 projects that use this

  • Leodorareluctant259Skill

    chinese-commit-conventions

    中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化

    Also in 8 projects that use this

  • obraSkill

    diagnosing-superpowers

    Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

    Also in 19 projects that use this

  • LLl0k0laDSkill

    using-agent-skills

    Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.

    Also in 39 projects that use this

  • LLl0k0laDSkill

    git-workflow-and-versioning

    Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams.

    Also in 47 projects that use this

  • MrCipherSmithSkill

    constraint-driven-development

    Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.

    Also in 15 projects that use this

  • +3 more from Leodorareluctant259
  • +3 more from LLl0k0laD

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 179 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before red-green-refactor, the test list itself is reviewed by Codex.

    line 9
  2. Distinctive:

    Before Phase 0, write the honest-reporting marker:

    line 15
  3. Distinctive:

    Write a numbered list of test cases.

    line 24
  4. Very specific:

    Only one CLI is available and panel-quorum-unavailable would block progress.

    line 115
  5. Very specific:

    After double-SHIP, write the failing tests in the agreed order.

    line 138
  6. Very specific:

    If you see errors mentioning Cannot find module, proper-lockfile, codex: command not found, codex not authenticated, ENOENT, or any …

    line 148

“Common” is measured: kept by at least 6 in 10 of the 179 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Test-Driven Development (Codex-paired)

What this changes vs. upstream

Before red-green-refactor, the test list itself is reviewed by Codex. Catches: missing edge cases, redundant tests, wrong test boundaries, mock-vs-integration mistakes — before any test code is written.

When to invoke

Any slice with non-trivial test design. Skip for one-test-one-function slices where the design is obvious.

Honest-reporting activation (v0.8.1, do this first)

Before Phase 0, write the honest-reporting marker:

node "${CLAUDE_PLUGIN_ROOT}/lib/codex-bridge/cli.js" honest-reporting-mark-active --skill test-driven-development

The marker has an 8-hour TTL and auto-expires; no cleanup needed.

Phase 0 — Draft the test list (Claude)

Write a numbered list of test cases. Each entry:

  1. What invariant or behavior it pins.
  2. Inputs / preconditions.
  3. Expected outcome.
  4. Mocks/integration choice + justification.

Phase 1 — Codex test-list review (counted, max 7 rounds)

Resume the session for this feature. Send:

Phase: tdd-review
Round: N

## Slice context
{{SLICE_NAME}} — {{SLICE_GOAL}}

## Test list under review
{{TEST_LIST}}

## Your job
- Missing edge cases? (zero, negative, null, off-by-one, concurrent, large input, …)
- Redundant tests testing the same path?
- Wrong boundary? (testing implementation when behavior is what matters, or vice versa)
- Mock/integration: are mocks hiding real failure modes?
- Pinning the right invariants?
- End with the required verdict block.

Sidecar phase is tdd:<slice-id>.

tdd-review (panel mode) (v0.9.0)

By default, the tdd-review phase routes reviewer-test through panel mode for cross-model consensus on test design. Test design is foundational; single-model bias here can hide structurally wrong test boundaries. Per spec § 4 table, reviewer-test in tdd-review is always panel mode.

Default: panel mode

Preference ladder is [codex, claude]. Defaults: panel_min_size: 2, panel_max_size: 3. Build dispatchFns and dispatch via dispatchPanel:

const { detectAvailableCLIs, availableCLISet } =
  await import('${CLAUDE_PLUGIN_ROOT}/lib/codex-bridge/availability/detector.js');
const { resolveAdapter } =
  await import('${CLAUDE_PLUGIN_ROOT}/lib/codex-bridge/role-routing/resolver.js');
const { runTurnWithDeps } =
  await import('${CLAUDE_PLUGIN_ROOT}/lib/codex-bridge/reviewer-turn.js');
const { dispatchPanel } =
  await import('${CLAUDE_PLUGIN_ROOT}/lib/codex-bridge/panel/dispatcher.js');

const detectorResult = await detectAvailableCLIs(repoRoot);
const availableCLIs  = availableCLISet(detectorResult);

const dispatchFns = new Map();
for (const cli of ['codex', 'claude']) {     // reviewer-test ladder (cli names, not adapters)
  if (!availableCLIs.has(cli)) continue;
  // Sidecar 'adapter' audit field MUST match the actual transport. Inject it
  // into the request before calling runTurnWithDeps — otherwise slice-5b's
  // default ('claude-task') silently mislabels codex panelists.
  const adapter = cli === 'claude' ? 'claude-task' : `cli-harness:${cli}`;
  dispatchFns.set(`reviewer-test@${cli}`, {
    fn: async (req) => {
      // v0.16.0 — non-claude panelists go through dispatchReviewerViaHarness, which picks the
      // model role by phase ('tdd-review' → planning) and assembles the real prompt.
      let responseText, requestForTurn = { ...req, adapter };
      if (cli === 'claude') {
        responseText = await /* dispatch via the Agent tool (Task) */;
      } else {
        const { dispatchReviewerViaHarness } =
          await import('${CLAUDE_PLUGIN_ROOT}/lib/codex-bridge/reviewer-dispatch.js');
        const out = await dispatchReviewerViaHarness(req, { cli, repoRoot });
        responseText = out.responseText;
        requestForTurn = out.requestForTurn;
      }
      return runTurnWithDeps(requestForTurn, { agentDispatch: async () => responseText });
    },
    runtime_kind: cli === 'claude' ? 'claude-task' : 'cli-harness',
  });
}

const outcome = await dispatchPanel('reviewer-test', request, dispatchFns, {
  panel_min_size: 2,
  panel_max_size: 3,
});

Apply the panel outcome the same way writing-plans does (panel-SHIP → proceed; panel-REVISE → revise test list and re-dispatch; panel-disagreement → user arbitrates; panel-quorum-lost / panel-quorum-unavailable → halt).

Override: --single for non-panel dispatch

Skill arg --single skips panel mode and runs single dispatch via runTurnWithDeps. Use only when:

  • The slice is trivially small and panel cost is unwarranted.
  • Only one CLI is available and panel-quorum-unavailable would block progress.
// Single dispatch (override path). Resolve cli, then derive adapter and
// inject it before calling runTurnWithDeps so the sidecar audit field
// matches the actual transport.
const resolved = resolveAdapter('reviewer-test', availableCLIs, /* userRouting */ null);
const adapter = resolved.cli === 'claude' ? 'claude-task' : `cli-harness:${resolved.cli}`;
const request = { identity: expertTest, repoRoot, specPath, specSnippet,
                  phase: 'tdd-review', sliceId, adapter, task: '...' };
const result = await runTurnWithDeps(request, {
  agentDispatch: async () => responseText,
});
// result: { ok: true, result: parsed } | { ok: false, reason }

Single mode loses the cross-model consensus guarantee. Document the override decision in the sidecar so a future replay can see why panel was bypassed.

Composer augmentation

For security-critical surfaces, the composer (composeReviewers) MAY add reviewer-security to the tdd-review phase. The added expert runs in single mode by default (panel-mode escalation is opt-in via the plan's high_stakes frontmatter, not auto-applied here).

Phase 2 — Implement red-green-refactor

After double-SHIP, write the failing tests in the agreed order. Standard TDD discipline applies — see upstream superpowers:test-driven-development for the red/green/refactor cadence; this fork adds only the up-front review.

Phase 3 — Slice-review the test suite + implementation

At slice review time, the test suite is part of the diff. Codex's slice review will catch any divergence from the agreed test list (and may push for more, which is in-scope critique).

Required upstream sub-skill

  • superpowers:test-driven-development for the red-green-refactor mechanics. This forked skill ADDS the up-front test-list review.

Troubleshooting setup errors

If you see errors mentioning Cannot find module, proper-lockfile, codex: command not found, codex not authenticated, ENOENT, or any module-load / binary-not-found pattern, invoke /codex-paired-superpowers:doctor first. Resume after green.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.