Lean Mwe
Create minimal working examples (MWEs) from Lean errors for bug reports. Use when minimizing a Lean error, creating an MWE, or preparing a bug report for lean4 or mathlib4.
MCP get_skill({ skillId: "lean-mwe-a1e0b966" })Use this skill with your agent
Create a free account and connect via MCP
# Minimizing Lean Errors ## Workflow 1. **Set up the guard** (`#guard_msgs` or `#guard_panic`) 2. **Run `lake exe minimize`** 3. **Review and polish** the output ## Repository Setup For Mathlib-related bugs: ```bash cd /tmp git clone https://github.com/kim-em/mathlib-minimizer.git cd mathlib-minimizer lake exe cache get ``` For pure Lean 4 bugs: ```bash cd /tmp git clone https://github.com/kim-em/lean-minimizer.git cd lean-minimizer ``` ## Step 1: Create the Test File ### For Regular Errors Use `#guard_msgs` to capture the exact error: ```lean import Mathlib.SomeModule /-- error: the exact error message goes here verbatim -/ #guard_msgs in example : ... := by some_tactic ``` ### For Panics ```lean import Mathlib.SomeModule #guard_msgs in #guard_panic in some_command_that_panics ``` ## Step 2: Verify the Guard Works ```bash lake env lean YourFile.lean ``` No output = success (guard passed). Error output = guard failed, and you need to redesign the test case. ## Step 3: Run the Minimizer ```bash lake exe minimize YourFile.lean ``` Output is written to `YourFile.out.lean`. ### Useful Options - `--resume`: Continue from the output file if interrupted - `--quiet`: Suppress progress output - `--only-delete`: Only run the deletion pass - `--only-import-inlining`: Only inline imports **Never use `--no-import-inlining`**. The entire point is to produce a self-contained file. ### For Long-Running Minimizations Use `--resume` to continue from where you left off: ```bash # Initial run (Ctrl-C if needed) lake exe minimize YourFile.lean # Resume later lake exe minimize YourFile.lean --resume ``` After manually editing the `.out.lean` file, always use `--resume` to continue from the edited state. ## Step 4: Review the Output ```bash lake env lean YourFile.out.lean ``` ### Checklist Before Filing - [ ] The `.out.lean` file compiles with the expected error/panic - [ ] No Mathlib imports remain (ideal) or minimal imports remain - [ ] The error message in `#guard_msgs` matches exactly
Related Skills
More skills in Software Engineering
Accessibility Standards
Comprehensive web accessibility standards based on WCAG 2.2 AA, with 38+ anti-patterns, legal enforcement context (EAA, ADA Title II), WAI-ARIA patterns, and framework-specific fixes for modern web frameworks and libraries.
Accord
Authoring unified specification packages across Business/Development/Design teams via staged elaboration (L0 Vision → L1 Requirements → L2 Team Detail → L3 Acceptance Criteria). No code. Use when authoring cross-team specs, building L0-L3 packages, or aligning Biz/Dev/Design on a single source of truth.
Acquire Codebase Knowledge
Use this skill when the user explicitly asks to map, document, or onboard into an existing codebase. Trigger for prompts like "map this codebase", "document this architecture", "onboard me to this repo", or "create codebase docs". Do not trigger for routine feature implementation, bug fixes, or narrow code edits unless the user asks for repository-level discovery.
Acreadiness Assess
Run the AgentRC readiness assessment on the current repository and produce a static HTML dashboard at reports/index.html. Wraps `npx github:microsoft/agentrc readiness` and hands off rendering to the @ai-readiness-reporter custom agent. Supports policies (--policy) for org-specific scoring. Use when asked to assess, audit, or score the AI readiness of a repo.
Acreadiness Generate Instructions
Generate tailored AI agent instruction files via AgentRC instructions command. Produces .github/copilot-instructions.md (default, recommended for Copilot in VS Code) plus optional per-area .instructions.md files with applyTo globs for monorepos. Use after running /acreadiness-assess to close gaps in the AI Tooling pillar.
Acreadiness Policy
Help the user pick, write, or apply an AgentRC policy. Policies customise readiness scoring by disabling irrelevant checks, overriding impact/level, setting pass-rate thresholds, or chaining org baselines with team overrides. Use when the user asks about strict mode, AI-only scoring, custom weights, CI gating, or wants org-wide standardisation.
Explore Other Categories
Skills from other categories with shared topics
Lean PR
PR conventions for the leanprover/lean4 repository. Use when creating pull requests, writing commit messages, or following project conventions for Lean contributions.
Lean Proof
Use when asked to prove something in Lean. Covers one-step-at-a-time proving, error priority, working on the hardest case first, proof cleanup, and handling dependent type rewriting issues.
Lean4
Use when editing .lean files, debugging Lean 4 builds (type mismatch, sorry, failed to synthesize instance, axiom warnings, lake build errors), searching mathlib for lemmas, formalizing mathematics in Lean, or learning Lean 4 concepts. Also trigger when the user asks for help with Lean 4, mathlib, or lakefile. Do NOT trigger for Coq/Rocq, Agda, Isabelle, HOL4, Mizar, Idris, Megalodon, or other non-Lean theorem provers.