Skip to main content
skill CX Codex

writing-lean-proofs — Claude Code skill for Lean 4

Guides Lean 4 proof writing and review using Mathlib conventions. Use it when formalising theorems, restructuring tactic code, or adding project checks.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add trailofbits/skills --skill writing-lean-proofs -a claude-code
Open on GitHub

What writing-lean-proofs does

The skill starts with declarations and theorem statements, then works down to proofs. It encourages compiling a skeleton with sorry, isolating each goal, and using calc for equality chains. It also distinguishes forward helper facts with have from backward reductions with suffices.

It covers APIs around new definitions, including ext, @[simp], coercion, and injectivity lemmas. For proof-state inspection, it uses trace_state, done, and lake env lean Path/To/File.lean. It also addresses slow proof terms and maxHeartbeats timeouts.

Its guidance follows Mathlib practice. If a Lean project has its own CONTRIBUTING rules, check those first; that matters more than applying this style unchanged. The skill is aimed at Lean 4 rather than Lean 3, Coq, Isabelle, or Agda.

What it helps with

  • split a Lean 4 proof into separate lemmas
  • replace sorry placeholders in a development
  • refactor a long tactic proof into calc steps
  • diagnose a maxHeartbeats timeout
  • add CI checks for unproved obligations

Example prompts for the agent

  • “Create a Lean 4 proof skeleton for this theorem and leave separate steps as sorry.”
  • “Review this Lean file against Mathlib conventions and identify lemmas to extract.”
  • “Investigate the maxHeartbeats timeout in Path/To/File.lean using trace_state.”

How to install writing-lean-proofs

1Skills CLI (Vercel)

npx skills add trailofbits/skills --skill writing-lean-proofs -a claude-code

2Manually: put the files in place

~/.claude/skills/writing-lean-proofs/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/writing-lean-proofs/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about writing-lean-proofs

How do I install writing-lean-proofs in Claude Code?

Run npx skills add trailofbits/skills --skill writing-lean-proofs -a claude-code, then run npx skills add trailofbits/skills --skill writing-lean-proofs -a claude-code again. The skill file is at ~/.claude/skills/writing-lean-proofs/SKILL.md.

What does writing-lean-proofs do?

It guides the design, writing, review, and refactoring of Lean 4 proofs using Mathlib-oriented practices. It also covers linters and CI verification work.

Does writing-lean-proofs support Lean 3?

No. Its conventions target Lean 4, and Lean 3 uses different tactics and idioms.

Similar skills

All skills for Programming languages →

From the same set77

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor