LeanAutoformalizationSkills skill

Lean 4 skills for Codex and Claude Code: from project design to checking the statement against the source theorem

  • 69 ★ on the repository
  • Last commit
Skill

Minimal access

Why this level

  • The skills are text instructions and Python helper scripts, and the agent runs Lean builds in your project
All reasons and checks

scottnarmstrong/leanautoformalizationskills

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add skills/leanautoformalizationskills

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Minimal accessThe tool runs nothing and makes no network calls.

  • The skills are text instructions and Python helper scripts, and the agent runs Lean builds in your project

This is third-party code. Review the repository files before installing.

What it does

A collection of skills for formalizing mathematics in Lean 4 with Codex or Claude Code. The skills cover project design, Mathlib discovery, proof writing, performance, independent mathematical audits and coordinated proof work. Examples and accumulated guidance lean toward PDE, probability and analysis, but the workflows suit any area. The central goal is to prove the theorem the source actually states. A successful Lean build checks the formal statement, and the `lean-statement-audit` skill additionally compares hypotheses, definitions, quantifiers and conclusion with the intended mathematics. The skills include `lean-workflow` as the entry point, `lean-project-architecture` for module boundaries, `lean-search-discovery`, `lean-proof-patterns`, `lean-orchestrator` for bounded tasks with independent review and `build-proof-dependency-graph` for source proof dependencies. The `scripts/install_skills.py` installer creates links to the skill folders.

Who it is for. Mathematicians and developers who formalize theorems in Lean 4 and hand lemma search, proofs and statement checks to Codex or Claude Code.

Good fit when

  • A theorem from a paper must become a Lean declaration shown in full before it is frozen
  • You need to find missing ingredients for a proof in Mathlib
  • A proof is split into bounded tasks with independent review and integration
  • A Lean statement must be checked against the source: quantifiers, hypotheses, definitions
  • A project is prepared for release and you need a release flow and naming

Not a fit when

  • Lean and Lake are not set up: the skills give instructions and checks but do not install Lean
  • You need an automated proof search service: the set does not contain one
  • The area is far from mathematics and formal proofs

Example request

Use lean-workflow to formalize the theorem in this paper excerpt, find the needed lemmas in Mathlib and show the full Lean declaration before freezing it

Limitations

Checking proofs needs a working Lean project with Lake, the declared toolchain and dependencies, since the skills install no Lean and run no proof search service. Helper scripts need Python 3.10 or newer on the standard library. The installer creates links to folders in the clone, so the clone must stay in place, and for a shared project the folders are copied whole. On a name conflict the installer stops and overwrites nothing. Per-agent details are in the README.

How to disable. Delete the skill links from `~/.claude/skills/` or `~/.agents/skills/` or from the project `.claude/skills/`. The repository clone can be removed afterwards.

FAQ

How do I install the skills in Claude Code?

From the repository clone run `python3 scripts/install_skills.py --agent claude`, optionally with `--dry-run` first. For one project add `--project /path/to/lean-project`.

How do I invoke the main skill?

In Claude Code with `/lean-workflow`, in Codex with `$lean-workflow`. The agent can also pick a skill from an ordinary request.

How does the statement audit differ from a Lean build?

A build checks that the formal statement is proved. The audit compares hypotheses, definitions, quantifiers and conclusion with the intended mathematics.

Do the skills install Lean itself?

No. A ready Lean project with Lake is required, and the skills supply instructions and checks.

Can I install one skill at a time?

Yes, a single proof writing skill or the full formalization workflow can be used.

Discussion

No questions or reviews yet.

Skills

A plugin for proving theorems in Lean 4: mathlib search, sorry-filling cycles, axiom checks and safety hooks

PluginExtended access486Repository stars

lencx skills

lencx-skills

Two skills for Claude Code and Codex: keel works through architecture questions, coding-protocol keeps code edits inside the task

SkillMinimal access197Repository stars

Standalone skills for the whole development lifecycle: product, architecture, planning, implementation, QA, delivery and operations

SkillBroad access593Repository stars

A Claude Code plugin for large specs: requirements with proof obligations, a walking skeleton and audited sprints

PluginExtended access183Repository stars
Official

Sixteen Leanmcp team skills for Claude Code: MCP servers, Fireworks inference, benchmark failure analysis and code docs.

SkillExtended access2.1KRepository stars

Seventeen Claude Code skills for product work: specs, branch review, a pre-commit check and cleanup of leftovers.

SkillMinimal access106Repository stars

README in short

The README explains the goal: prove the theorem the source actually states. Next come a start guide, install through the agent or the installer for Codex and Claude Code, a sample prompt and a table of skills with a purpose for each, and finally notes on the origin of materials.

README badge

Original SKILL.md

---
name: lean-workflow
description: Route Lean 4 work through a repository's Mathlib/Lake conventions. Use when editing Lean files, checking source fidelity or axioms, searching dependencies, validating focused targets, or protecting dependency build artifacts.
---

# Lean workflow

Use this as the general router for a Lean 4 repository built with Lake and Mathlib. Read the repository's own instructions first; they override generic commands and thresholds here. Select a more focused sibling skill when it applies:

- `lean-project-architecture` for public declarations, abstractions, module boundaries, or imports;
- `lean-search-discovery` before attempting a new proof;
- `lean-proof-patterns` while translating or repairing a proof;
- `lean-naming-style` for declarations, files, namespaces, and docstrings;
- `lean-elaboration` for measured performance diagnosis or repair;
- `lean-elaboration-test` for a repository-wide performance snapshot;
- `lean-statement-audit` for exact source-to-declaration correspondence;
- `lean-orchestrator` for an explicitly authorized multi-agent formalization effort.

Use `build-proof-dependency-graph` for a source-level proof dependency database. It records source topology; it does not determine Lean proof status.

## Build and dependency hygiene

- Treat pinned dependencies and their compiled artifacts as read-only during routine project work.
- Never delete dependency `.olean`, `.ilean`, trace, hash, IR, or object files as an invalidation shortcut.
- Follow repository-provided build wrappers and cache guards. Otherwise validate the narrowest project target that covers the edit, for example `lake build Project.Foo.Bar`.
- Do not run `lake clean`, update the toolchain or dependency pins, or trigger a full dependency rebuild without explicit authorization.
- Before a destructive project-artifact invalidation, resolve the exact project-owned path and confirm that no dependency tree can match it.
- Distinguish project compilation from dependency compilation in build and performance reports.

## Workflow

1. Read `AGENTS.md` or `CLAUDE.md`, the Lake configuration, toolchain file, target module, and nearby imports.
2. Identify the authoritative mathematical source when a declaration represents an external claim. Preserve its binders, carriers, quantifiers, hypotheses, constants, and endpoint conditions.
3. Search Mathlib and the project before adding a declaration or inventing a proof route.
4. Do not move proof obligations into hypotheses, introduce custom axioms, or disguise unfinished proofs. Keep any explicitly authorized draft theorem quarantined and visibly marked under the repository's draft policy.
5. Make the smallest coherent edit and validate it with the repository's guarded command or the narrowest appropriate Lake/Lean command.
6. Audit affected public declarations for `sorry`, custom axioms, hidden stronger hypotheses, quantifier drift, and constant-dependence drift. Run `#print axioms` from an untracked probe or other repository-approved audit path, not from a compiled source file.
7. Report exact commands and targets, skipped validation, remaining placeholders, and source mismatches.

If work is delegated, obey the repository's agent policy and give each worker a bounded, disjoint task. Do not infer a model requirement, concurrency policy, or permission to spawn agents from this skill.

Report a problem