agentleFS
chrisduvillardchrisduvillard/codex-engineering-skills/skills/adversarial-review/SKILL.md

adversarial-review

Skill1 starsChanged 3 months agoMITView on GitHub

Falsify a code change with evidence-backed edge-case, state, failure, concurrency, resource, and security attacks. Use for bounded correctness or security testing of a change; not for a broad architecture audit.

63 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use design-doc, simplify and 6 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.
  • maragudkSkill

    design-doc

    For when you're asked to write a design doc or specification, especially after a brainstorm or feature design session.

    Also in 3 projects that use this

  • Hugging FaceSkill

    simplify

    Refactor code after tests pass. The "Refactor" phase of Red-Green-Refactor.

    Also in 4 projects that use this

  • AnthropicSkill

    status

    Case status summary by audience — client-facing (plain language), internal (for the professor), or court-ready (formal caption format per local rules). Same facts, different framing and depth. Use when a student needs to update the client, brief the professor, or prepare a court status report.

    Also in 3 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 6 projects that use this

  • VercelSkill

    web-design-guidelines

    Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

    Also in 3 projects that use this

  • DockerSkill

    research

    Research a documentation topic — locate affected files, understand the problem, identify what to change. Use when investigating an issue, a question, or a topic before writing a fix. Triggers on: "research issue 1234", "investigate what needs changing for #500", "what files are affected by #200", "where is X documented", "is our docs page about Y accurate", "look into how we document Z".

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

18 rules. 0 are common, 14 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 56 edited versions we read keep these.

  • 14

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read repository instructions, domain vocabulary, architecture records, and the relevant specification before naming behavior or choosing an …

    line 21
  2. Distinctive:

    Use the repository's installed toolchain.

    line 23
  3. Distinctive:

    Read adversarial-lenses.md while deriving attacks.

    line 31
  4. Distinctive:

    Read the relevant sections of technique-playbook.md before using a dynamic technique.

    line 32
  5. Distinctive:

    Read report-contract.md before constructing the ledger.

    line 33
  6. Distinctive:

    Run the cheapest bounded focused initial test in the disposable target snapshot only when safe.

    line 45
  7. Distinctive:

    Put exact boundaries and nearest representable values on both sides into separate rows.

    line 73
  8. Distinctive:

    Add interaction rows where dimensions can couple.

    line 75
  9. Distinctive:

    Update the row immediately using report-contract.md:

    line 89
  10. Very specific:

    When a distinct sibling partition reaches the exact already-confirmed mechanism and consequence by cited source/data-flow evidence, link …

    line 92
  11. Very specific:

    When a required oracle, runtime, service, tool, or safe environment is unavailable before execution, record the missing prerequisite and …

    line 95
  12. Very specific:

    When the campaign reaches its final reserve, stop launching new exploration.

    line 100
  13. Distinctive:

    Use parallel agents only for genuinely disjoint surfaces.

    line 119
  14. Distinctive:

    Every ledger row has a terminal status from report-contract.md.

    line 129
  15. Very specific:

    Every relevant changed predicate/error branch and each contract-derived input partition is reached, covered by the exact mechanism of a …

    line 130
  16. Distinctive:

    Run the repository's proportionate final verification if it is safe and within review scope.

    line 135
  17. Distinctive:

    Follow report-contract.md.

    line 142
  18. Distinctive:

    Use the exact no-finding and partial-closure language from report-contract.md.

    line 144

“Common” is measured: kept by at least 6 in 10 of the 56 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

Adversarial Review

Try to falsify the code's claimed behavior. Treat existing tests, static warnings, and coverage as evidence that guides attacks, never as proof of correctness.

Execution profiles

  • Fast: one focused attack ledger, one safe technique, and one minimization pass.
  • Standard: adaptive attacks across material partitions plus reproduction and counterevidence.
  • Deep: multiple techniques, platform or concurrency checks, and independent challenge for authentication, money, migrations, destructive effects, or public contracts.

Choose by consequence and uncertainty rather than diff size alone.

Operating contract

  • Do not edit product code unless the user explicitly asks for a fix. Do not add or edit tests unless the user explicitly asks for test changes. Put one-off harnesses, corpora, caches, build outputs, and reports in disposable storage; compare working-tree state before and after execution and never clean unexpected writes from the user's tree.
  • Read repository instructions, domain vocabulary, architecture records, and the relevant specification before naming behavior or choosing an oracle.
  • Preserve dirty work and distinguish the reviewed target from unrelated local changes.
  • Use the repository's installed toolchain. Do not install a dependency merely to obtain a technique; choose the closest available attack or mark it blocked.
  • Treat reviewed code as executable content. Execute it only from a disposable snapshot with the user's worktree absent or read-only and scratch/output mounts writable. Before running it, assess provenance and trust. Run untrusted or uncertain code only in an ephemeral sandbox with no credentials, restricted network, minimal mounts, and explicit CPU/memory/process/time limits; otherwise stay source-only and mark dynamic attacks blocked.
  • Exercise only local, test, or explicitly authorized sandbox targets. Do not scan live services, send adversarial traffic to third parties, run migrations or deployments, expose secrets, or perform destructive/resource-exhaustion tests without explicit authorization.
  • Bound the whole campaign and each randomized, fuzz, load, fault, or schedule exploration before starting. Never accept an indefinite default run.
  • Do not promise literal exhaustive testing. Except for tiny finite domains, all possible inputs and schedules cannot be executed. Make “every edge case” operational: derive a finite attack model from scoped evidence, give every derived row an honest terminal disposition, and disclose deferred work and blind spots.

Load the references selectively

  • Read adversarial-lenses.md while deriving attacks. Apply only lenses justified by the scoped behavior.
  • Read the relevant sections of technique-playbook.md before using a dynamic technique. Prefer tools already configured by the project.
  • Read report-contract.md before constructing the ledger. Its status and finding definitions are authoritative.

1. Pin scope, comparison, and safety

  1. Resolve exactly what is under review: a fixed-point diff, PR/branch, commit range, file, function, or behavior. For a diff review, record the merge-base and commit list. If no base was named, infer the repository's default base when unambiguous and state the assumption.
  2. Capture working-tree state before running anything. Do not attribute pre-existing or unrelated edits to the target.
  3. Identify the governing contract in this order: explicit spec and acceptance criteria; public API/schema/type contract; architecture/domain decisions; callers and consumers; established tests; a simple independent model. Keep intended behavior separate from current implementation.
  4. Map changed behavior to reachable entry points, callers, state owners, effects, trust boundaries, and failure containment. Expand beyond changed lines when the changed behavior can break an unchanged consumer or control.
  5. Apply the executable-content trust gate from the operating contract before any build, test, hook, or package command. If isolation is required but unavailable, continue statically and record the blocked dynamic work.
  6. Discover existing test, coverage, fuzz, sanitizer, race, and mutation commands without executing them.
  7. Define the test envelope and a global campaign budget: permitted side effects; maximum time/cases/depth/size/threads/schedules; unavailable infrastructure; and a named final reserve for replay, minimization, baseline comparison, and reporting (default 20%). Choose proportionate bounds when the user supplied none.
  8. Create a disposable target snapshot before executing any reviewed code, including ordinary tests and build hooks. Keep the user's worktree unmounted or read-only; redirect caches, corpora, coverage, builds, temporary files, and other outputs to scratch. Treat redirection as additional containment, never as a substitute for snapshot isolation.
  9. Run the cheapest bounded focused initial test in the disposable target snapshot only when safe. Record initial failures with attribution unknown until a controlled comparison.
  10. When attribution matters, prepare separate disposable target and baseline snapshots pinned to exact revisions or recorded content digests. Use the same externally stored harness, input, seed, command, runtime, environment, and relevant configuration in both; record intentional lock/config differences. Never switch or overwrite the user's working tree.

2. Build the live attack ledger

Create a coordinator-owned ledger. Keep it in conversation or disposable scratch storage unless the user requests an artifact. First screen the lenses and router for applicability; record a short rationale for excluded dimensions or unselected techniques without creating fake blocked rows. Record shared campaign context once, then let rows reference it.

Use these fields:

FieldMeaning
IDStable attack identifier
SurfaceEntry point, branch, state transition, trust boundary, or effect
InvariantBehavior that must remain true
Adversary goalHow the invariant could be broken or abused
Dimension and partitionExact value class, interaction, failure, or sequence to attack
OracleExpected result or justified relation
TechniqueCheapest discriminating experiment
BoundCases, seed, time, size, depth, or schedule limit
Execution contextCampaign-context reference plus row-specific executable/runtime/tool versions and relevant flags
EvidenceCommand/harness, input/trace, and observed output
AttributionTarget-only, pre-existing, environmental, or unknown
Finding / covered byConfirmed finding ID, UNVERIFIED, or —
StatusOne authoritative status from report-contract.md

Derive rows from evidence, not from a universal checklist:

  1. Split every relevant predicate, type restriction, schema rule, loop, state transition, and error contract into equivalence partitions.
  2. Put exact boundaries and nearest representable values on both sides into separate rows.
  3. Derive relational and sequence attacks from data flow, callers, transformations, transaction boundaries, retry logic, and state ownership.
  4. Add interaction rows where dimensions can couple. Use covering combinations rather than a blind Cartesian product; increase interaction strength around high-impact coupling or observed failures.
  5. Turn threat-model assets, actors, entry points, and trust boundaries into abuse cases when security or tenant/role integrity is in scope.
  6. Seed rows from historical bugs, regression tests, static analysis, uncovered changed branches, surviving mutants, and production-shaped fixtures. Treat each as a lead until runtime or source proof establishes it.
  7. Merge duplicate rows. Add a row only when it contributes a distinct partition, interaction, oracle, caller, state sequence, or consequence.
  8. Rank the queue by consequence, reachability, change proximity, oracle strength, uncertainty, and experiment cost. Prefer the attack with the greatest expected information, not simply the easiest input.

3. Run the adaptive attack loop

Repeat until the closure rule is satisfied:

  1. Select the highest-value unresolved ledger row.
  2. Choose the narrowest technique that can falsify its invariant. Use the router below, then follow the relevant playbook section.
  3. Confirm that the attack reaches the intended class. A generated test that rejects, filters, skips, or early-returns is not evidence that the class survived.
  4. Execute with a recorded seed/configuration and explicit bound. Capture enough raw evidence to replay the observation.
  5. Update the row immediately using report-contract.md:
    • On expected behavior, mark only the exact attacked partition SURVIVED; do not close its siblings.
    • On a reproducible discrepancy, minimize the input or action sequence and mark it COUNTEREXAMPLE. Qualify it separately as a confirmed finding only after it meets the finding bar; otherwise link it to UNVERIFIED.
    • When a distinct sibling partition reaches the exact already-confirmed mechanism and consequence by cited source/data-flow evidence, link the finding and mark it COVERED_BY_FINDING; do not manufacture a duplicate finding or redundant execution.
    • Mark an executed row INCONCLUSIVE when bounded work cannot reach the intended class, the harness/tool fails after starting, evidence is unstable/conflicting, the oracle remains inadequate, or replay/minimization cannot finish. Name what would resolve it.
    • Mark a row CONTRACT_EXCLUDED only when the governing contract and cited reachability assumptions exclude that class. Implementation-only non-reachability of contract-required behavior remains a counterexample or inconclusive risk.
    • When a required oracle, runtime, service, tool, or safe environment is unavailable before execution, record the missing prerequisite and mark it BLOCKED.
  6. Compare a minimized discrepancy through the controlled target/baseline experiment from step 1 when feasible. Use target-only only when the isolated target fails and the matched baseline survives. Use pre-existing only when the matched baseline reproduces the same violated invariant and mechanism; use environmental only when a controlled environment change reproduces or removes it. Otherwise use unknown. Never infer attribution from the diff alone.
  7. Expand the frontier after every surprise or failure. Add only distinct adjacent values, alternate encodings, shorter and longer sequences, reordered/replayed operations, sibling callers, other instances of the root-cause pattern, stronger interactions, or an independent oracle. Group partitions that share one proven mechanism and consequence under one finding ID.
  8. Re-rank the whole queue after each result. Let passes redirect effort: unreached branches require a better generator/harness; weak observations require a stronger oracle; fuzz plateaus require better seeds/dictionaries/structure; surviving mutants require assertion-focused attacks; flaky results require deterministic control before interpretation.
  9. Escalate case counts or expensive techniques only when consequence, uncertainty, missed reach, or a surprise justifies them. A small pure change may close with decision tables and focused differential/property probes; do not run every technique.
  10. When the campaign reaches its final reserve, stop launching new exploration. Merge the queue, mark unexecuted rows DEFERRED_BY_BOUND, and spend the reserve replaying, minimizing, attributing, and reporting. Transition any active row that cannot finish adjudication to INCONCLUSIVE. Do not silently extend the global budget.
  11. Re-run the directly affected focused tests after each confirmed counterexample. Do not fix product code unless asked.

Technique router

Evidence shapePrimary attack
Comparison, clamp, parser branch, validation ruleBoundary/decision table plus adjacent representable values
Pure or deterministic transformation over a broad domainProperty-based generation and shrinking
Parser, decoder, protocol, file format, or byte/string boundaryCoverage-guided or structured fuzzing; add applicable sanitizers
Workflow, lifecycle, cache, transaction, retry, or reusable objectModel-based or rule-based stateful sequences
Exact output oracle is unavailableMetamorphic relations with explicit preconditions
Independent model, prior version, backend, algorithm, or configuration existsDifferential testing over defined behavior
Filesystem, database, subprocess, network, queue, clock, or dependencyDeterministic fault injection and partial-failure tests
Shared mutable state, async work, locks, or cancellationControlled schedule exploration, replay traces, and a race detector
Native memory, unsafe arithmetic, lifetime, or uninitialized dataASan/UBSan/MSan as applicable, in separate instrumented runs
Executed code may be weakly assertedSelective mutation testing on changed/high-risk code, then triage survivors
Authorization, tenant, identity, secret, or trust-boundary changeAbuse-case tests and source-to-sink/control tracing

Use parallel agents only for genuinely disjoint surfaces. Keep one coordinator responsible for the evolving ledger, cross-surface discoveries, attribution, and closure. Do not launch a fixed fan-out and call it dynamic coverage.

4. Enforce the finding bar

Apply the sole normative finding criteria in report-contract.md. Keep every counterexample, differential disagreement, surviving mutant, coverage hole, static warning, suspicious pattern, or flaky failure as a hypothesis until it meets that contract; otherwise report it only as an unverified risk with the missing evidence.

5. Close the bounded attack model

Finish only when all conditions hold:

  1. Every ledger row has a terminal status from report-contract.md; none remain queued or active.
  2. Every relevant changed predicate/error branch and each contract-derived input partition is reached, covered by the exact mechanism of a confirmed finding, contract-excluded under cited assumptions, or explicitly incomplete (INCONCLUSIVE, BLOCKED, or DEFERRED_BY_BOUND).
  3. Relevant interaction, state/sequence, failure, time, permission, concurrency, resource, representation, and configuration dimensions from the lenses have a disposition. Justify excluded dimensions from the scoped contract/data flow; do not run irrelevant techniques merely to say they passed.
  4. For each selected technique, record applicable reach, distribution, coverage, mutant, corpus, or schedule evidence. Metrics expose gaps but never certify correctness. Give each unselected expensive technique a short risk-based rationale rather than a fake ledger row.
  5. Each confirmed finding has been minimized, replayed, attributed when possible, expanded to adjacent/root-cause-related attacks, and deduplicated so one root cause and consequence is reported once with sibling triggers beneath it.
  6. Re-read the diff/source, contracts, callers, and ledger once more. Add any distinct newly visible row while exploration budget remains; otherwise mark it DEFERRED_BY_BOUND.
  7. Run the repository's proportionate final verification if it is safe and within review scope. Create or reopen a ledger row for every relevant surprise or blocked check, then recompute closure. Leave only demonstrably unrelated failures as report-only context.
  8. Compare the user's working-tree state with the pre-run snapshot. Record it as unchanged or list every unexpected path and leave those paths untouched.

Classify closure as COMPLETE_WITHIN_MODEL only when no row is INCONCLUSIVE, BLOCKED, or DEFERRED_BY_BOUND, and every counterexample is linked to a confirmed finding. Otherwise classify it as PARTIAL and name the incomplete rows. A terminal ledger is auditable; it is not automatically complete.

6. Report findings and bounded residual risk

Follow report-contract.md. Put confirmed findings first, ordered by severity. Then summarize the attack ledger, tested bounds, baseline comparison, and blocked or untested areas.

Use the exact no-finding and partial-closure language from report-contract.md. Never say the code is correct, safe, exhaustive, or that “all edge cases pass.”

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.