Lean 4 and Mathlib conventions for code, proofs, naming, documentation and compile-time tests that mirror the public library API.
Type: Skill
Trigger: /write-lean-code (also activates automatically)
See the marketplace install instructions.
Provides Lean 4 style conventions covering naming, proof style, formatting, Mathlib API discovery, build infrastructure, metaprogramming, and general functional-programming idioms. Activates automatically when working with .lean files, Lean docstrings, the proofs/ directory, or any discussion of Lean naming or design decisions.
Includes a condensed essential checklist plus comprehensive references organized by topic. Covers Lake build wiring patterns, Mathlib search workflows, and PFR-downstream conventions.
/write-lean-code
The skill also activates automatically when Claude Code touches Lean source.
- Editing a
.leanfile: activates automatically - "review this Lean proof for style": activates automatically
- Naming a new lemma or definition: activates automatically
- "/write-lean-code": loads the full style guide explicitly
- Write Lean Tests: the sibling test-side conventions for compile-time API regression tests
- Write Math: mathematical exposition for Lean docstrings and informal proof prose
- Write Formalization Roadmap: structuring multi-milestone proof projects
- All plugins
Compile-time test conventions are in skills/write-lean-code/references/tests/workflow.md. The single Lean review checklist includes mirrored test coverage where the project uses that convention.