lean-interact: Skill for Claude Code

.claude/skills/mathlib-lookup/SKILL.md

mathlib-lookup is a skill for Claude Code from nasqret/lean-interact. It costs 170 tokens per session (2,369 once invoked), scanned A, original, MIT.

A procedure for finding the exact name and full type of a mathematical result in Mathlib, Lean 4’s mathematics library. It verifies the result before recommending it.

In plain words
What is it for?
Use it when looking for a Mathlib lemma, theorem, definition, instance, tactic, namespace API, or the precise hypotheses of a result.
Why use it?
It prevents relying on a guessed theorem name or overlooking required assumptions. The full type shows how the result must actually be used in a proof.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is nasqret/lean-interact's own configuration. It tells Claude Code how to work on lean-interact itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything lean-interact configures →

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python3 tools/mlq.py "modEq iff dvd" # free text over names and statements.

Reuse

Borrowing it

Nothing to install: this file belongs to nasqret/lean-interact. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/nasqret/lean-interact/main/.claude/skills/mathlib-lookup/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/nasqret/lean-interact

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mathlib-lookup

README.md
[![agentmods](https://agentmods.dev/badge/skills/nasqret/lean-interact/mathlib-lookup/github.svg)](https://agentmods.dev/skills/nasqret/lean-interact/mathlib-lookup)
Your own site
<a href="https://agentmods.dev/skills/nasqret/lean-interact/mathlib-lookup"><img src="https://agentmods.dev/badge/skills/nasqret/lean-interact/mathlib-lookup/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mathlib-lookup

Your own site · 80×15
<a href="https://agentmods.dev/skills/nasqret/lean-interact/mathlib-lookup"><img src="https://agentmods.dev/badge/skills/nasqret/lean-interact/mathlib-lookup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 170 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,369 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00170 $0.02369
Opus 5.5 $0.00068 $0.00948
Sonnet 5.5 $0.00034 $0.00474
Haiku 4.5 $0.00017 $0.00237

Measured 2mo ago against content hash 0e8b13c4663c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

mathlib-lookup scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/mathlib-lookup/SKILL.md · 184 lines

How it starts

The opening of the file, as written. The whole thing — 184 lines — stays where its author put it; the contents beside it link to each section on GitHub.

mathlib-lookup

This skill exists for the user's single stated pain point: they know the mathematics and not the Mathlib name. Two consequences govern everything below.

  1. A name is a claim, and claims get checked. Nothing unverified is ever reported, used, or written - not even hedged with "I think". A hedge disappears the moment the name is repeated.
  2. A name alone is not an answer. Report the real elaborated type. The user needs the hypotheses and their order to use the lemma; the name is only the handle.

Repository root: /path/to/lean-interact.


The escalation, in order of cost

Stop at the first step that yields a verified name.

1. Dot completion (free, when a hypothesis exists)

If the user has h : Nat.Coprime a b in context, the whole Nat.Coprime namespace is reachable as h.something, and the editor's completion list is guaranteed correct for this Mathlib. Tell the user to type h. in the VS Code infoview pane. The programmatic equivalent is step 2's --namespace.

2. Guess from the naming grammar (seconds)

Read vault/Naming Conventions.md. Construct the name rather than recall it:

  • Say the statement in Mathlib's vocabulary: "modEq iff dvd", "le of dvd", "prime dvd mul".
  • Conclusion first, hypotheses after of_; symbols become fragments (+ -> add, ∣ -> dvd, ↔ -> iff, ≤ -> le, ^ -> pow, % -> mod/emod).
  • Namespace = the type of the distinguished hypothesis, or the head of the conclusion.
  • Casing migration: natCast not nat_cast, intCast not int_cast. Pre-2024 sources and mathlib3 names are systematically wrong.
  • Always try the primed variant too; ' means different hypotheses or argument order (Nat.modEq_iff_dvd vs Nat.modEq_iff_dvd').

Then verify (step 4). A guess that verifies costs one command.

3. Search with tools/mlq.py (seconds)

python3 tools/mlq.py "modEq iff dvd"          # free text over names and statements
python3 tools/mlq.py --about "chinese remainder"   # by informal topic
python3 tools/mlq.py --concept ModEq          # by the concept appearing in the statement
python3 tools/mlq.py --namespace Nat.Prime    # the whole API of a namespace or type
python3 tools/mlq.py --help                   # authoritative; the tool wins over this note

Read the full file on GitHub · 184 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 184 lines · 170 tokens per session scan A 0e8b13c4663c

Subscribe to this mod's changes

mathlib-lookup is a skill published in the GitHub repository nasqret/lean-interact (11 stars, last pushed 2mo ago), licensed MIT. It adds 170 tokens to every session and 2,369 once invoked, about $0.0007 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

lean-expert

Lean 4 theorem-prover expertise for agents -- current versions, tactic cookbook, Mathlib search, compiler-error recoveries. Use when proving, debugging, or explaining Lean 4 proofs via leanforge-mcp.

sandraschi/leanforge-mcp · 47 tokens

screen

Screen informal↔Lean 4 statement pairs for faithfulness defects. Use whenever writing, editing, translating, or reviewing Lean 4 theorem or definition statements that are meant to formalize informal mathematics: after drafting a statement, before committing formalizations, when auditing a benchmark file, or when the…

ibrahimmian36/leanscreen · 0 tokens

lean-probe

Fast Lean 4 proof verification for coding agents via the LeanProbe MCP server's warm REPL. Use when you need to know whether Lean 4 code compiles (no errors, no sorry), iterate on a declaration inside a Lake/Mathlib project, test a replacement proof candidate, or explore a goal tactic by tactic — far faster than lake…

epfl-lara/LeanProbe · 139 tokens

mathlib-api

Evidence-driven workflow for designing a Mathlib definition and the API around it. Use when adding a new structure/def intended for mathlib; when choosing between design alternatives (index type as field vs parameter, Set vs indexed family, coarse set vs finer indexed structure and when the fine one should exist at…

homeowmorphism/mathlib-api · 234 tokens

hr-onboarding

A new-hire onboarding plan as a single page — first week schedule, buddy + manager intro, learning track, equipment checklist, and "you're set when…" outcomes. Use when the brief mentions "onboarding", "new hire", "first week plan", or "入职".

nexu-io/open-design · 62 tokens

book-mirror

Take any book (EPUB/PDF), produce a personalized chapter-by-chapter analysis. Each chapter is preserved in detail (The Chapter) and mirrored back to the reader's actual life (The Mirror) using brain context. The mirror observes and resonates — a friend pointing out parallels, NOT a consultant rearranging the reader's…

garrytan/gbrain · 138 tokens