/mays:model-checkfrom mays
Checks distributed system designs for races, crashes, and ordering failures by modeling failure paths in Quint or Python before implementation. Use when a plan relies on leases, dedup, locks, or idempotency keys.
Ships in mays. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
A model check tests a design against bad timing before anyone writes the code. A subagent writes a spec: a small model of the design's state and of the actions that change that state. A runner then tries the actions in many orders and looks for an order that breaks one of the plan's rules.
The spec covers only the failure paths that can break the plan's protections, never the whole system. The spec checks the design, not the code. A pass says something about the code only when each spec action matches one atomic unit in the code.
step is the current code, and stepDesign is the proposed design.general-purpose subagent. It writes the spec and the mapping. Dispatch it through claude-subagents with model: unset.scripts/check.py. It runs every check for one spec and applies the mechanical rules.Each role has limits:
quint typecheck. The writer never runs quint run, quint verify, or the runner. A writer that sees results can change the spec until it passes.The writer's prompt follows claude-subagents and carries every input, plus the engine. It tells the writer to load model-check, and to follow "Write the spec", "Write mutants", and the engine's reference file. The writer creates one spec per flow in <scratch>/model/, plus <scratch>/model/mapping.md, and nothing else.
The runner checks a spec with one of 2 engines. The spec's file extension picks the engine.
| Quint | Python | |
|---|---|---|
| Spec file | <flow>.qnt | <flow>.py |
| Needs | quint, installed with brew install quint. --verify also needs Java. | Python 3.9 or later |
| How it checks | quint run tries random runs. With --verify, quint verify also checks every run up to a step bound. | The runner visits every state that the spec can reach. |
| Report a pass as | "random sampling", or "bounded check" with --verify | "full search", or "search to K steps" when a limit stops the search |
| Limit | Sampling can miss a rare path. quint verify is slow: the worked example took 82 seconds at 8 steps and didn't finish 10 steps in 11 minutes. | The search of a step stops past 500,000 states or 600 seconds. The worked example has 1,296 states and takes under 1 second. |
| Reference | references/quint.md | references/python.md |
| Worked example | references/example-queue-consumer.qnt | references/example-queue-consumer.py |
Each reference file lists the runner's options, its output fields, and the engine's pitfalls.
The caller passes:
bug, feature, or new-flow. When it's missing, use feature if code paths are in scope, else new-flow.<scratch>. When it's missing, use the session scratchpad.quint or python. When it's missing, "Preflight" picks one.Model check: skipped — no failure path to model to <scratch>/model-check.md and stop. This rule applies even when a caller forces the check, for example with --full. The caller continues without the gate.quint --version: use Quint when the command works, else Python.quint is missing, use Python. Note the switch in the result.<scratch>/model-check.md. See "Run", "Witnesses", and "Result".bug: the current-code step must break an invariant. Its counterexample must match the reported cause, not just any break. The design step must pass.
feature, a change to an existing flow: the current-code step is expected to pass the existing invariants.
new-flow: model the design only.spec-over-budget.mapping.md every behavior the spec assumes and doesn't model, such as "the Postgres row lock holds" or "SQS delivers every message at least once". A pass holds only while those assumptions hold.SELECT followed by an UPDATE in one transaction isn't atomic.step is the current code.stepDesign is the proposed design.stepMut<Name>.stepDesign and its mutants only.mapping.md is a table with one row per action. Each current-code row is one claim that claims-verification can check. Each design row becomes one claim in the conformance phase.| Model | Action | Code | Why it's atomic |
| --- | --- | --- | --- |
Model is current or design. Code is path:line for the current code, or the intended statement for the design.
After the table, mapping.md has an ## Assumptions list with one line per assumption:
## Assumptions
- <behavior the spec assumes and doesn't model>
<= to <.unkilled-invariant, and a mutant with no kill as useless-mutant.A mutant that survives has 4 possible causes:
Rule out a missed break first:
--budget run already gives each mutant extra samples against the invariants that no mutant killed. The caller asks the writer for a witness of the exact order of events that the protection guards against. The caller then reruns with --verify, which also checks each mutant against each invariant that sampling left unkilled. To check only a mutant that kills no invariant, pass --verify-step stepMut<Name> instead.--max-steps, --max-states, or --run-timeout and rerun.Then report which cause applies. A weak invariant, or a state that can't show the break, goes back to the writer. An unnecessary protection goes into the result as a finding for the plan.
Run claims-verification on the mapping's current-code rows. Inside implement-ticket, that check happens in the same pass as the plan's claims. A standalone caller runs it alone. A false mapping claim sends the spec back to the writer once. If a claim is still false, record the gate as unverified and continue.
Run the runner on each spec, and save its output. For a Quint spec:
python3 "${CLAUDE_SKILL_DIR}/scripts/check.py" <scratch>/model/<flow>.qnt \
--main MODULE --invariants INVARIANTS --terminal TERMINAL --witnesses WITNESSES \
--budget 60 --format md > <scratch>/model/<flow>.md
For a Python spec:
python3 "${CLAUDE_SKILL_DIR}/scripts/check.py" <scratch>/model/<flow>.py \
--invariants INVARIANTS --terminal TERMINAL --witnesses WITNESSES \
--format md > <scratch>/model/<flow>.md
MODULE is the Quint spec's module name, and TERMINAL is the terminal witness. INVARIANTS and WITNESSES are names separated by spaces.
The Quint command samples a fixed number of runs, and then --budget 60 adds 60 seconds of sampling on every core. The budget first samples each mutant against the invariants that no mutant killed, then samples stepDesign. Add --verify only when a mutant survives the budget, or when an invariant guards money or security. Examples are a double charge, a cross-tenant leak, and an auth bypass. A Python spec needs neither option, because its search already checks every state.
Act on the exit status:
| Exit | Verdict | Next step |
|---|---|---|
0 | pass | Make the judgment calls that follow. |
1 | fail | The design breaks an invariant. Record it as a finding for the plan, with its counterexample. |
2 | invalid | The check proves nothing. The engine's reference file lists each problem code and its next step. A usage error also exits 2, with its message on stderr. |
3 | broken-spec | The spec has a syntax error, a type error, or an error while it runs. Send the error to the writer. |
4 | none | quint is missing for a Quint spec. Have the writer rewrite the spec in Python. That return counts as a run-phase attempt under "Retries". |
A spec over the size limit in "Write the spec" gets a spec-over-budget warning in the output's ## Warnings section. The warning never changes the verdict or the exit status. On that warning, the caller sends the spec back to the writer once to trim or split it. That return counts as a run-phase attempt under "Retries". If the returned spec is still over the limit, the caller runs it as is, and the result notes the warning.
The caller makes the judgment calls, never the runner:
A witness is a condition on the state. Quint reports the percentage of runs in which a witness held, and Python reports the number of states. Every witness must be false at the initial state. A witness that holds there comes true even when no action ever runs, so it proves nothing. The runner reports such a witness as witness-true-at-init, and the spec goes back to the writer.
--witnesses. The runner reports one that never holds on stepDesign as unreached-failure-path.
--budget and a higher --max-steps. A witness still at 0% goes back to the writer.settled, to show that runs reach a finished state. Pass it as --terminal. The runner reports vacuous when a step breaks no invariant and its terminal witness never holds, or when every run stops at the initial state. The step never fires or never settles, so the spec goes back to the writer.
Each phase gets at most 2 writer attempts: the write phase, the claims phase, and the run phase. After that, record the failure in the result and continue. Never block a headless run. The conformance phase sends nothing back to the writer, because it only reports.
Build <scratch>/model-check.md from each flow's runner output. That output holds the result line, a table of every check with its result, the mutant matrix, each counterexample as numbered steps, and any warnings. Add these parts:
mapping.md. Plan reviewers get only the spec and this file. They need the table to attack the atomicity claims, and the list to attack what the spec didn't model.path:line from that action's mapping row.Model check: <flow> — <n> invariants, <k>/<m> mutants killed; <random sampling, N runs ≤K steps | bounded check to K steps | full search, N states | search to K steps, N states>; current code: <passes | fails <invariant> (matches reported bug | pre-existing bug)>
The runner writes the line up to fails <invariant>, and the caller adds (matches reported bug) or (pre-existing bug). The runner drops the current-code part when the spec has no step. For a fail verdict, it appends ; design: fails <invariant>, and for invalid, it appends ; invalid: <codes>. For broken-spec, it writes broken spec: <error> in place of the counts. A skipped or unverified gate says so, with the reason.
Test hand-offs come from 2 sources only: each killed mutant's counterexample, and a bug ticket's current-code counterexample. A bug that already exists on a feature ticket is a risk only, as "Ticket types" says. Each hand-off follows 2 rules:
A pass says nothing about the code unless each spec action matches one atomic unit in the code. The claims phase checks only the current-code rows, because the design code doesn't exist yet. The conformance phase checks the design rows after implementation. Inside implement-ticket, it runs before code review.
When the write phase didn't run, or the model check was skipped, skip this phase. Write Model conformance: skipped — <reason> to <scratch>/model-conformance.md.
Run claims-verification on the design rows of <scratch>/model/mapping.md, against the implemented working tree. Each design row is one claim with 2 parts:
When that reason rests on a behavior in the mapping's ## Assumptions list, such as "the Postgres row lock holds", the verifier checks only that the code uses that mechanism. The assumption stays an assumption, as in the run phase. When the reason rests on a behavior outside the repo that the list omits, the row scores unverifiable, and its false-row entry names the missing assumption.
The verifier cites the path:line that implements each row. A row holds only when its claim scores supported. Every other score makes it a false row.
Write <scratch>/model-conformance.md. Its first line is the result line:
Model conformance: <k>/<n> design rows hold
After the result line, list each false row: its action, its intended statement, and what the code at path:line does in its place. For an unsupported row, write not found and the search the verifier ran. For an unverifiable row, write why no oracle is in reach.
A false row means the code breaks an assumption that the spec's pass depends on, so the pass no longer covers the code. The model check only reports. Skip the "Act" step of claims-verification, because the caller decides what to do with a false row.
<scratch> and are never committed to the repo. A committed spec drifts from the code unless tests replay its counterexamples.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub stevenmays/dotfiles --plugin mays14 skills in this plugin
/adversarial-reviewTwo-family adversarial review of a plan or a diff — one fresh Claude subagent and one external run (GPT through Codex, or Grok through Cursor) on identical briefs, launched concurrently, then triaged into verified blockers, concerns, and rejected findings. Use before approving a plan, before shipping a change, or whenever a workflow asks for an adversarial review./claims-verificationCheck the factual claims a plan makes about existing code against the repo — extract atomic claims, have a fresh subagent answer neutral questions without seeing the plan, then score each claim. Use after a plan is drafted and before adversarial review, or whenever a workflow asks to verify a plan's claims./claude-subagentsDispatch planning, review, implementation, or a scoped question to a fresh Claude subagent with the Agent tool — which subagent type and model to pick, what the prompt must carry, and how to check what comes back. Use whenever a workflow hands work to a Claude subagent, including the Claude half of adversarial-review./codex-image-generatorDefault image generation path. Generate or edit raster images (hero images, illustrations, textures, product shots, mockups, transparent cutouts) through the Codex CLI's built-in image_gen tool, run in a subagent. Use whenever the user asks for an image, picture, illustration, or visual asset and does not name a provider. Not for SVG, icons, or diagrams that belong in code./deslopClean up AI slop in existing code — measure complexity with real tools, delete dead and redundant code, refactor the worst hotspots first, and prove behavior is unchanged. Use when the user asks to clean up slop, deslop, reduce complexity, untangle spaghetti, simplify a god function, or make AI-generated code maintainable. Not a review skill — extreme-code-quality-review covers review; this one changes the code./external-subagentsRun a planning, research, review, or implementation task on a second model family as a background subagent that cannot hang the session — GPT through the Codex CLI, or the newest Grok through the Cursor CLI where Codex is missing. A wrapper kills stalled runs and salvages partial output. Use whenever a workflow sends work to Codex, Cursor, GPT, Grok, a second model, or a non-Claude subagent, including the external half of adversarial-review. Not for images.Other plugins' skills for the same job