agentleFS
ultimatileultimatile/development-skills/skills/codex-contract-test-review/SKILL.md

codex-contract-test-review

Skill0 starsChanged 32 days agoMITView on GitHub

Narrow Codex pass on a newly added contract test, verifying it is not tautological and would fail on the original buggy implementation. Lightweight alternative to the full codex-review / copilot-review loop.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the XML-block template below.

    line 26
  2. Very specific:

    Use -o to capture output

    line 133
  3. Distinctive:

    If that revised the test on this skill's first run for that test, re-run this skill once.

    line 147

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Codex Contract-Test Review

A focused Codex pass that asks one question: does this test express the contract its name/comment claims? Secondary: any critical bug in the test code itself.

This is not a full review — alternative test designs, additional test suggestions, and stylistic nits are explicitly out of scope.

Procedure

1. Gather inputs

InputWhat to collect
Original findingThe review comment / bug report that triggered the contract elevation. 1–2 sentences or quoted text.
Claimed contractOne sentence — the implicit specification the test is asserting (the output of bug-to-contract Step 2).
New test locationfile:line range of the added test.
Implementation under testfile:line of the code the contract applies to.
Specific questions (optional)0–3 narrow questions if there is genuine uncertainty.

2. Build the prompt

Use the XML-block template below. Drop blocks that do not fit; keep order stable.

<task>
Review the newly added contract test against the claimed contract and
the implementation it covers.

Primary check: does the test actually express the claimed contract —
i.e., would it fail on the buggy implementation that motivated the
contract, and does it visit a representative input space rather than
only degenerate / identity / size-1 cases?

Secondary check: any critical bug in the test code itself (P1 only —
ignore stylistic concerns).

Original finding:
<FINDING_TEXT>

Claimed contract (one sentence):
<CONTRACT_STATEMENT>

New test:
<TEST_FILE_LINES>

Implementation under test:
<IMPL_FILE_LINES>

Specific questions (optional):
<EVALUATION_QUESTIONS>
</task>

<grounding_rules>
Read the cited file:line ranges before evaluating.
Do not invent file names, function signatures, or behaviors.
Do not conflate the test's name or comment with the contract — verify
that the assertions actually check the contract, not just that the
docstring claims to.
If a point is an inference rather than a verified fact, label it as
such.
</grounding_rules>

<structured_output_contract>
Return:
1. verdict — one of: approve / approve with conditions / reject
2. primary findings (max 3) — contract-expression problems. Tag each
   [P1/P2] with file:line, and state explicitly: "would this test
   fail on the original buggy implementation? yes / no / unclear"
3. secondary findings (max 2) — P1 critical bugs in the test code
   only. Drop P2/P3 / stylistic.
4. open questions you could not resolve from the repository alone
Total: at most 5 findings across primary + secondary.
Keep the output compact. Do not restate the test or the contract.
</structured_output_contract>

<dig_deeper_nudge>
Beyond a surface read, check for:
- tautology: the assertion is trivially true regardless of the bug
  (e.g., comparing a value to itself, asserting a property the type
  system already enforces)
- degenerate-input-only coverage: identity matrix, size-1 / 1×1,
  all-zero, all-equal, diagonal-only, when the implementation
  handles general inputs
- wrong invariant: the test asserts a property different from the
  one the contract claims (e.g., contract is "layout-invariance" but
  the test only checks one layout)
- error / cleanup paths uncovered: the implementation has fallible
  or cleanup paths but the test only exercises the happy path
- contract narrower than the bug: the test covers one instance of
  the bug class but not the class itself
</dig_deeper_nudge>

<missing_context_gating>
Do not guess project constraints, YAGNI scope, or design intent.
If a finding depends on such context, list it under open questions
instead of findings.
Do not propose alternative test designs.
Do not suggest additional tests beyond what is needed to express
the stated contract.
</missing_context_gating>

<verification_loop>
Before finalizing, verify that each finding is material (would let
the original bug class slip through, or would cause incorrect test
behavior) and anchored in code you actually read.
Drop speculative or stylistic nits.
If the test correctly expresses the contract and no critical bug is
found, return verdict = approve and stop — do not synthesize
findings to fill the slots.
</verification_loop>

Block selection rationale:

  • grounding_rules: prevents the reviewer from trusting the test name / docstring instead of reading the assertions
  • structured_output_contract: hard caps (max 3 primary, max 2 secondary, max 5 total) keep the output narrow and triageable
  • dig_deeper_nudge: enumerates the failure modes that contract tests typically fall into — without this list the reviewer tends to stop at the first plausible concern
  • missing_context_gating: forbids "you should also test X" creep — depth control's main lever
  • verification_loop: explicit early-exit clause — without it the reviewer will manufacture findings to fill the structured slots

3. Run Codex

codex exec "<prompt>" < /dev/null -o /tmp/codex-contract-test-review.md
  • Always use < /dev/null
  • Set timeout to 600000ms (10 minutes); typical run is 30s–2min
  • Use -o to capture output

4. Triage the feedback

Classify each finding under the finding-triage SSOT dispositions. The cases that recur here:

  • actionable: a real contract-expression flaw or critical bug that would let the original bug class through
  • false-positive: a concern that doesn't apply given project context the reviewer can't see

Present the triage to the user, not the raw output.

5. Apply or hand back

  • Take each finding that is not closed, as finding-triage defines closed, as its disposition directs.
  • If that revised the test on this skill's first run for that test, re-run this skill once. If it revised the test on that re-run, escalate to the user instead of re-running again.
  • Otherwise: hand back to the caller.

What this skill is bad at

  • Project-specific scope decisions (will defer to open questions)
  • Trade-off judgments about test coverage breadth (the user makes these calls)
  • Anything outside the test-vs-contract relationship — for full diff review, use codex-review instead

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.