lean-mwe
Skill3 starsChanged 24 days agoApache-2.0View on GitHub
USE FOR: creating minimal working examples (MWEs) from Lean 4 errors for upstream bug reports. DO NOT USE FOR: bisecting which Lean version introduced the bug (@lean-bisect). TRIGGERS: MWE, minimal repro, "minimise the error", "#guard_msgs".
1 other project uses a version of this.
Adopted by
Most recently taken up by
- leanprover/skillstheir own version, first seen Feb 21, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- leanprover/skills★ 72same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository65 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ai-guard-judge-evalSkill
- applied-data-information-securitySkill
- applied-engineering-disciplinesSkill
- applied-legal-reasoningSkill
- epistemic-discovery-engineSkill
- epistemic-mappingSkill
- hol-metamath-adapterSkill
- isabelle-isar-adapterSkill
- itp-cross-portingSkill
- lean-ai-formalizationSkill
- lean-applied-reasoningSkill
- lean-axiom-closureSkill
- lean-bigraph-modelingSkill
- lean-bisectSkill
- lean-blueprintSkill
- lean-buildSkill
- lean-causal-reasoningSkill
- lean-competitive-mathSkill
- lean-convergence-verificationSkill
- lean-core-onlySkill
- lean-dag-visualizerSkill
- lean-deep-auditSkill
- lean-doc-feedbackSkill
- lean-doc-improvementSkill
- lean-doc-requirementsSkill
- lean-enforcementSkill
- lean-formalization-breakdownSkill
- lean-gatewaySkill
- lean-integration-protocolSkill
- lean-knowledge-formalizationSkill
- lean-math-analysisSkill
- lean-math-discreteSkill
- lean-math-dynamicalSkill
- lean-math-foundationsSkill
- lean-math-optimizationSkill
- lean-math-stochasticSkill
- lean-nested-learningSkill
- lean-package-researchSkill
- lean-pedagogical-expositionSkill
- lean-proof-refactorSkill
- lean-proof-repairSkill
- lean-proof-reviewSkill
- lean-proofSkill
- lean-prSkill
- lean-quality-engineSkill
- lean-replay-verificationSkill
- lean-reportSkill
- lean-researchSkill
- lean-retroactive-auditSkill
- lean-retro-methodologySkill
- lean-review-councilSkill
- lean-security-formalizationSkill
- lean-setupSkill
- lean-specificationSkill
- lean-tautology-triageSkill
- lean-upstream-portingSkill
- lean-vendor-substrateSkill
- lean-zettelkastenSkill
- math-product-managementSkill
- The first 60 shown.
The file
Files
Minimizing Lean Errors
Agnostic Minimal Working Example (MWE) contract for Lean 4. Guides isolating tactic, elaborator, or compiler bugs into self-contained reproducers using
#guard_msgs,#guard_panic, and LSP-guided dependency pruning.
Routing
- USE FOR: wrapping a failing Lean fragment in a
#guard_msgs/#guard_panicguard that captures the exact diagnostic, then drivinglake exe minimize(or manual LSP-guided import pruning) to delete imports and definitions until a self-contained reproducer remains; verifying the result withlake env lean; resuming interrupted minimisations with--resume. - DO NOT USE FOR: bisecting which Lean commit broke the file (use
@lean-bisectafter the MWE is self-contained); building or running the live project
Workflow
- Set up the guard -- choose
#guard_msgs(for errors / warnings) or#guard_panic(for panics). Paste the exact diagnostic text verbatim into the guard. - Verify the guard --
lake env lean YourFile.leanmust produce no output (guard passes). If it errors, the guard text does not match; adjust the guard before minimising. Always uselake env lean, never barelean. - LSP-guided import pruning -- before running heavy minimization, inspect the forward import tree via
$/lean/moduleHierarchy/imports. Remove unused transitive imports to isolate the dependency closure. - Minimise --
lake exe minimize YourFile.lean. Use--quietfor long runs;--resumeafter manual edits to.out.lean;--only-delete/--only-import-inliningfor surgical passes.
Recovery & STOP
- Guard fails on first verify -> STOP, the diagnostic text doesn't match the model's output character-for-character; widen the guard or fix the example before running the minimiser.
- Minimiser hangs > 60 min with
--resumenot progressing -> STOP, hand to@lean-bisectif the failure may be version-dependent; otherwise reduce the input by hand.
Handoffs
- Predecessors / successors: see FM
handoffs. Typical inbound:@lean-proof(when a tactic fails unexpectedly) or@lean-build(when CI surfaces an unexpected compiler error). Typical outbound:@lean-bisect(find the introducing commit) or@lean-pr(file the issue/PR with the MWE attached). - Sister skill:
@lean-bisect-- typically the next step after the MWE is Mathlib-free.
Detailed reference
Full encyclopedic reference, decision trees, and lookup tables live in
references/lean-mwe-handbook.md .
See also
../../references/lean-mwe-handbook.md-- Handbook Handbook../lean-gateway/SKILL.md-- Top-level skill router
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
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.

