agentleFS
jajupmochijajupmochi/agent-harness/skills/general/code-verifier/SKILL.md

code-verifier

Skill1 starsChanged 5 months agoMITView on GitHub

Use BEFORE claiming any code/test/script runs successfully. Detects FAKE-RUN patterns (hardcoded results, assert True, mocks-only tests, swallowed exceptions, fabricated numbers, dead-code short-circuits). Apply automatically whenever about to claim "test passes", "code works", "results show X", "training converges", or commit/push. Complements superpowers:verification-before-completion (which enforces real-run discipline) by auditing whether the run itself is genuine.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before any completion claim involving code / tests / results, run all three layers in order:

    line 32

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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

/code-verifier

Audit the GENUINENESS of evidence — not just that a command ran.

Master TOC

  • Core principle
  • The Three-Layer Gate
  • Fake-Run Patterns
    • A. Tests that pass without testing
    • B. Scripts that fabricate results
    • C. Pipelines that short-circuit
    • D. ML-research specific
  • When to invoke
  • Output format when fake pattern found
  • Anti-rationalisation
  • Companion

Core principle

"Ran a command" ≠ "verified the work." A test that always passes (because it asserts True) proves nothing. A script that prints mAP = 0.85 from a hardcoded literal proves nothing. A pipeline that swallows exceptions silently and returns a default proves nothing.

This skill audits the GENUINENESS of evidence — not just that a command ran.

The Three-Layer Gate

Before any completion claim involving code / tests / results, run all three layers in order:

  1. Layer 1 — Did it really run? Defer to superpowers:verification-before-completion. Run the exact command in this turn; read full output; check exit code. Skip if already cleared in this turn.
  2. Layer 2 — Is the run genuine? Audit the artifact for the FAKE-RUN patterns below. If any match, the run is NOT genuine and the claim is unsupported until you fix and re-run.
  3. Layer 3 — Does the run exercise the claim? Even a real run can fail to exercise the claim — e.g. test imports the wrong module, runs with pytest -k other. Check that the artifact's scope matches the claim.

Fake-Run Patterns

A. Tests that pass without testing

PatternWhat it looks likeWhy fake
assert True / assert 1 == 1TautologicalPasses regardless of code
Tests with no assert/expect at allJust function bodyPasses if no exception, not if behavior correct
try: ... except: pass then assert succeedsHides real failuresReal exceptions go silent
Mocking the function under testmock.patch('module.fn_under_test')Tests the mock, not the function
Skipped tests counted as passingpytest.skip() everywhere0 failures but 0 verifications
Hardcoded fixture matching hardcoded outputFixture pre-stores expected, fn returns sameNo real computation

Detection commands:

# Tautological asserts
grep -rE "assert\s+(True|1\s*==\s*1)" tests/ src/ 2>/dev/null

# Tests with zero assertions
grep -rL "assert\|expect\|self\.assert" tests/ 2>/dev/null

# Bare-except in tests
grep -rE "except\s*:\s*pass|except\s+Exception:\s*pass" tests/ 2>/dev/null

# Skipped tests
grep -rE "@pytest\.mark\.skip|pytest\.skip\(\)" tests/ 2>/dev/null

# Mocking the SUT
grep -rE "mock\.patch.*$(basename module_under_test)" tests/ 2>/dev/null

B. Scripts that fabricate results

PatternWhy fake
Hardcoded numeric output (print(f"mAP = {0.85:.2f}"))Literal, not computed
Default fallback (result = compute() or 0.85)Falls back to plausible number
Random numbers as results (result = np.random.uniform(0.7, 0.9))No deterministic computation
Old cached values read without re-runCould be stale
if DEBUG: result = 0.85 enabledDebug path active in prod

Detection commands:

# Suspicious literal numbers near metric prints
grep -rE "(mAP|acc|score|loss|recall|precision)\s*[=:]\s*[0-9.]" outputs/ scripts/ 2>/dev/null | grep -vE "for|while|range|len|shape|return"

# Or-fallback to numeric literals
grep -rE "= [^#]*\(\)\s*or\s+[0-9.]+" src/ scripts/ 2>/dev/null

# np.random in eval scripts (excluding seeded)
grep -rE "np\.random|torch\.rand|random\." scripts/ 2>/dev/null | grep -viE "seed|generator"

C. Pipelines that short-circuit

PatternWhy fake
Early return with stub (return {"ok": True} # TODO)No real work
Swallowed exceptions (except: return default)Failures invisible
# noqa / # pragma: no cover over real logicHides skipped paths
time.sleep + returnLooks like work
if False: / if 0: blocks around real codeReal path never runs

Detection commands:

# TODO/stub patterns near returns
grep -rEB1 "return.*#.*TODO|return.*#.*FIXME|return.*#.*placeholder" src/ scripts/ 2>/dev/null

# Swallowed exceptions
grep -rE "except.*:\s*(pass|return\s+(None|default|\{\}|0))" src/ scripts/ 2>/dev/null

# Disabled blocks
grep -rE "if\s+(False|0):" src/ scripts/ 2>/dev/null

# time.sleep outside tests
grep -rE "time\.sleep" src/ scripts/ --exclude-dir=tests 2>/dev/null

D. ML-research specific

PatternWhy fake
Training loss not actually backpropping (opt.zero_grad(); opt.step() without .backward())Weights unchanged
Eval on training set claimed as test (eval(train_loader) while paper says test set)Inflated numbers
Cherry-picked seed (best of N undisclosed)Selection bias
Selected metric only (skip lower-scoring metrics)Cherry-picking
Validation == test pool overlapLeakage
Forward-only run on "test" (doesn't include all batches)Partial eval
Plot data manually drawn (data = [12, 14, 16, 18] hardcoded)Not from real run

Detection commands:

# Training loop without backward
grep -rEB3 "opt(imizer)?\.step\(\)" src/ scripts/ --include='*.py' | grep -A3 "\.step" | grep -L "\.backward" 2>/dev/null

# Eval on train loader
grep -rE "eval\(.*train_loader|test_metric.*train_data" src/ scripts/ --include='*.py' 2>/dev/null

# Cherry-picked seeds — max() over seed reports
grep -rE "best_(of|seed)|max\(.*seeds" src/ scripts/ --include='*.py' 2>/dev/null

# Hardcoded plot data near plt calls
grep -rB3 -A1 "plt\.(plot|bar|scatter)" scripts/ --include='*.py' 2>/dev/null | grep -E "= \[[0-9.,\s]+\]"

# Val/test split overlap
python3 -c "
import json
for p in ['data/splits.json', 'data_split.json']:
    try:
        d = json.load(open(p))
        v = set(d.get('val', d.get('validation', [])))
        t = set(d.get('test', []))
        print(f'{p}: val∩test = {len(v & t)} of {len(v)} val, {len(t)} test')
    except: pass
"

When to invoke

SituationAction
About to say "tests pass"Run all three layers
About to commit/pushRun Layer 2 on changed files
About to write a paper numberRun Layer 2.B + 2.D on the producing script
Inheriting test suite from elsewhereRun Layer 2.A audit before trusting it
Reviewing a PRRun Layer 2 on the diff
Hyperparameter search resultsRun Layer 2.D on the seed / selection logic

Output format when fake pattern found

[FAKE-RUN DETECTED]

Pattern: <category>.<subcategory>
File: path/to/file.py:line
Evidence:
  <exact line(s) showing the pattern>

Why this is fake:
  <one sentence explanation>

Required fix:
  <concrete change>

Re-run command after fix:
  <exact command>

Re-running NOT optional — the previous claim of <X> is NOT supported.

Anti-rationalisation

ExcuseReality
"It's a stub, will fix later"Stub = fake-run for THIS run
"Just for demo purposes"Demos still claim things
"Tests can be added later"Then don't claim "tested"
"The mock is realistic"Mock = tests the mock
"We trust the cache"Re-compute or document staleness
"Random noise is small"Then derive deterministically
"Just to show the pipeline works"Then say "pipeline runs", not "results show X"

Companion

  • superpowers:verification-before-completion — Layer 1 (real-run discipline)
  • research-critic — audits inferential chain ON TOP of authentic artifacts
  • always-on-verification rule (in this lib) — when to invoke

Provenance

Originally authored as a user-level always-on gate; consolidated into agent-harness for cross-project reuse. Pairs with research-critic for full claim-defensibility coverage.

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.