agentleFS
gregwebsgregwebs/skills-sdlc/skills/rust/verus/SKILL.md

verus

Skill20 starsChanged 44 days agoMITView on GitHub

Verify Rust code with Verus by writing proof annotations. Use when a Verus file fails verification with requires/ensures errors, when asked to prove or verify Rust code with the verus! macro and vstd, or when running verus or cargo verus.

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 6 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the LLM chapter of the Verus guide before the first run.

    line 11
  2. Very specific:

    Add only proof code: proof functions, assert/assert ...

    line 16
  3. Very specific:

    Never change requires, ensures, recommends, a function-level decreases, a spec fn body, or executable code.

    line 18
  4. Very specific:

    Never use assume, admit, axiom, assume_specification, #[verifier::external_body], #[verifier::external], or uninterp spec fn.

    line 21
  5. Very specific:

    Keep the pre-edit file. git show HEAD:PATH > BASELINE or copy it aside.

    line 32
  6. Distinctive:

    Run inside the project's sandbox or container.

    line 39
  7. Distinctive:

    Run the verifier, read the complete error output, edit annotations, repeat.

    line 44
  8. Very specific:

    Verify one item at a time when a file has many failures: verus FILE.rs --verify-root --verify-function '*name*'.

    line 47
  9. Very specific:

    Add --expand-errors when the failing predicate is unclear.

    line 50
  10. Very specific:

    Leave --rlimit near its default.

    line 51
  11. Very specific:

    Use --profile-all or --time before blaming the tool for slowness.

    line 54
  12. Very specific:

    Search vstd and the project for an existing lemma before writing one.

    line 58
  13. Very specific:

    Prefer a lemma that states the needed fact over a long assert chain.

    line 59
  14. Very specific:

    Prefer assert(...) by { ...

    line 60
  15. Distinctive:

    When a goal will not close, say which goal, why the available lemmas do not reach it, and what lemma would.

    line 65
  16. Distinctive:

    Treat a finding as a bug in your proof.

    line 89
  17. Distinctive:

    Verify the whole crate, not just the edited file, so nothing else regressed.

    line 96

≈ “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

Verus proofs

The job is to add proof annotations until the verifier reports no errors, without touching what is being proved. Read the LLM chapter of the Verus guide before the first run.

Guardrails

  • Add only proof code: proof functions, assert/assert ... by, proof blocks, loop invariants, loop decreases clauses, helper lemmas, ghost state.
  • Never change requires, ensures, recommends, a function-level decreases, a spec fn body, or executable code. A proof that needs one of these is a specification bug: stop and report it.
  • Never use assume, admit, axiom, assume_specification, #[verifier::external_body], #[verifier::external], or uninterp spec fn. A goal you cannot close is a result, not a failure to hide.

1. Preflight

  1. Find the verifier command. Try the repository's documented one first (AGENTS.md, CONTRIBUTING.md, justfile, Makefile, CI config), then verus --version for a single file and cargo verus verify (or cargo verus focus to skip dependency crates) for a crate. Do not build Verus from source without asking; the release binary is the normal install.
  2. Keep the pre-edit file. git show HEAD:PATH > BASELINE or copy it aside. The cheat check diffs against it, so it must be the pristine version.
  3. Locate the references the proof will need: vstd/ ships next to the verus binary in a release, the Verus test suite is rust_verify_test in the Verus source, and lemma signatures are in the vstd docs and the guide.
  4. Run inside the project's sandbox or container. Verification needs many verifier invocations and no human intervention in between.

2. Develop the proof

Run the verifier, read the complete error output, edit annotations, repeat. The errors are the design feedback; one attempt per proof is luck.

  • Verify one item at a time when a file has many failures: verus FILE.rs --verify-root --verify-function '*name*'. Pass the same flags through a crate build with cargo verus verify -- FLAGS.
  • Add --expand-errors when the failing predicate is unclear.
  • Leave --rlimit near its default. Raising it to hundreds of seconds buys a slow failure; splitting the goal into lemmas buys a proof. Report the --rlimit you used.
  • Use --profile-all or --time before blaming the tool for slowness.
  • A loop body does not inherit facts from the function's requires. Repeat what the proof needs in the loop invariant, or assertions inside the loop fail with no visible cause.
  • Search vstd and the project for an existing lemma before writing one. Prefer a lemma that states the needed fact over a long assert chain.
  • Prefer assert(...) by { ... } over a monolithic proof body, and discharge quantifiers with assert forall ... by.
  • An assert the verifier does not need is dead weight. Re-run without it before keeping it.

When a goal will not close, say which goal, why the available lemmas do not reach it, and what lemma would. That is the handoff a human needs.

3. Cheat check

Both checks must pass before you report success.

verus FILE.rs --no-cheating
${CLAUDE_SKILL_DIR}/scripts/check-verus-cheats.sh BASELINE FILE.rs

--no-cheating rejects assume, admit, external_body, and assume_specification. The script rejects the remaining shortcuts: axiom, uninterp spec, changed signatures (which is where requires, ensures, and function-level decreases live), deleted functions, and removed or rewritten lines inside functions that already existed. It exits 1 and prints the finding.

Loop invariants and loop decreases clauses are proof, not specification: the checker treats them as body edits, so keep them honest yourself. An older Verus without --no-cheating reports an unknown-option error: say so and rely on the script, which needs no Verus install.

Treat a finding as a bug in your proof. Do not edit the checker, do not pass a baseline that already contains the change, and do not describe a failing check as clean. If the specification really is wrong, stop and ask the user to change it.

4. Finish

  • Verify the whole crate, not just the edited file, so nothing else regressed.
  • LLM proofs run 2-3x longer than necessary. Delete annotations the verifier does not need, then verify again.
  • Report: what now verifies, the exact command, any remaining errors, the highest --rlimit used, and any specification or executable change you believe is required.

Where this fails

Expect trouble with inductive invariants, macro-generated code, opaque or closed spec fns that need the right reveal, and large functions. Decompose the goal or hand back partial progress before spending a long budget; a single hard proof can cost more than the rest of the task.

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.