/engineer:leanfrom engineer
Formally verifies real code with Lean 4 by modeling functions or state machines, proving invariants for all inputs, and reproducing counterexamples as failing tests. Useful for high-assurance code like parsers, money math, and permission predicates.
Ships in engineer. 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.
None: SKILL.md is the whole skill.
Lean is only useful here if the proof actually compiles. Don't hand back
sorry-riddled code and call it done — the whole point of a proof assistant
is that lake build is the ground truth, not your judgment about whether the
proof "looks right."
First run:
which lean lake elan
If missing, tell the user and offer to install via elan (the Lean toolchain manager) — don't install it silently, it's a real download:
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh
If the project has a lakefile.lean/lakefile.toml + lean-toolchain, just
cd into it and use lake build — don't reinvent the toolchain setup.
.lean file.lake build (whole project) or lake env lean file.lean
(single file, faster while iterating).exact? — closes the goal if an exact Mathlib lemma exists.apply? — suggests lemmas that partially match the goal.sorry in the final result. A sorry is a placeholder for an
unproved gap — it compiles but proves nothing. If you can't close a goal,
say so and show the remaining goal state rather than papering over it with
sorry.This is a different job from proving a math statement: the goal isn't a
polished proof, it's finding real bugs in real code and getting them fixed.
Lean here is a bug-finding tool, not a deliverable — nobody merges the
.lean files, they merge the PRs the proofs led to. Structure the work as a
todo list and post progress as you go; this runs long and the user wants
visibility into where you are, not just a final answer.
claude.ts, the SDK) and identify the handful of orthogonal
subsystems worth modeling separately — retry logic, a turn loop, stream
parsing, session phase transitions, a control protocol. Model each as its
own small Lean 4 file. Small independent models are easier to get right
and to review than one giant one, and a bug in one doesn't block proving
the others.${CLAUDE_PLUGIN_ROOT}/references/handoff-dispatch.md). When
/engineer.harden dispatched you, don't propose one: return the verdict and
the reproduction, and harden pins and fixes on the feature branch.lake build succeeds, #print axioms on every top-level theorem shows no unexpected axioms snuck in
(e.g. via a bad sorry-adjacent tactic), and grep -rn sorry on the
Lean sources is empty.rfl, simp, ring, linarith, omega, exact, apply, intro, cases,
induction, rcases, constructor, unfold. simp and omega in
particular close a large fraction of routine goals — try them before hand-
building a proof term.
After any proof claimed "done", the runnable check is lake build (or
lake env lean on the file) exiting 0 with no sorry/admit left in the
diff. Report the actual exit status, not "looks correct."
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub swingerman/engineer --plugin engineer25 skills in this plugin
/arch-checkUse to check a feature's code against the charter's architecture rules — dependency layering, cycles, forbidden patterns, file naming, file size. Triggers — "/engineer.arch-check", "architecture check", "check architecture fitness", "does this follow the charter", "check layering"./atddUse to write a feature's acceptance specs and generate its test pipeline — Checkpoint 3 of the DAE pipeline. The engineer-namespace entry point into the atdd plugin's acceptance workflow. Triggers — "/engineer.atdd", "write the spec", "Checkpoint 3", "formalize the ACs as specs", "generate the test pipeline"./clarifyUse when a single DAE artifact has ambiguities to resolve. Triggers — "/engineer.clarify", "clarify this spec", "resolve ambiguities", "this is vague — tighten it".Other plugins' skills for the same job