loogle-search — Claude Code skill: find Mathlib lemmas by type
Searches Mathlib for lemmas by type signature pattern, for when you know the shape but not the name. Useful during Lean proofs.
npx skills add parcadei/Continuous-Claude-v3 --skill loogle-search -a claude-codeWhat loogle-search does
The skill hands your agent a loogle-search command that takes a signature pattern and returns matching lemmas. The syntax is small: _ stands for any single type, ?a and ?b are type variables where the same name means the same type. Writing Foo, Bar requires both names to appear in the lemma, and Foo.bar matches a name exactly. Add --json for machine-readable output.
Query speed hinges on the server. With loogle-server running in the background a query takes roughly 100–200ms, since the index stays in memory. Without it every query pays a cold start of about 10s to load a 343MB index. If you plan to sit in proofs for a while, start the server first.
Loogle itself has to be built before any of this works: cd ~/tools/loogle && lake build, then lake build LoogleMathlibCache or a build with --write-index. Skip that step and the command returns nothing — that is where people get stuck. The loop afterwards is straightforward: work out the type shape you need, look up the lemma name, apply it.
What it helps with
- find a lemma when you know the type shape but not the name
- see what lemmas exist for a given type
- run type-directed proof search
- check which lemmas connect two notions, such as cyclicity and center
- pull a machine-readable list of
Fintype.cardlemmas
Example prompts for the agent
- find a lemma for
Nontrivial _ ↔ 1 < Fintype.card _ - what does Mathlib have for
IsCyclic, center - run
loogle-search "(?a → ?b) → List ?a → List ?b"and show me the output
How to install loogle-search
1Skills CLI (Vercel)
npx skills add parcadei/Continuous-Claude-v3 --skill loogle-search -a claude-code2Manually: put the files in place
~/.claude/skills/loogle-search/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/loogle-search/
1Skills CLI (Vercel)
npx skills add parcadei/Continuous-Claude-v3 --skill loogle-search -a codex2Manually: put the files in place
.agents/skills/loogle-search/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add parcadei/Continuous-Claude-v3 --skill loogle-search -a cursor2Manually: put the files in place
.cursor/skills/loogle-search/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install parcadei/Continuous-Claude-v3 loogle-search2Manually: put the files in place
.github/skills/loogle-search/SKILL.md1Skills CLI (Vercel)
npx skills add parcadei/Continuous-Claude-v3 --skill loogle-search -a gemini-cli2Platform CLI
gemini skills install https://github.com/parcadei/Continuous-Claude-v3 --path .claude/skills/loogle-searchManually: put the files in place
.devin/skills/loogle-search/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add parcadei/Continuous-Claude-v3 --skill loogle-search -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about loogle-search
How do I install loogle-search in Claude?
Run npx skills add parcadei/Continuous-Claude-v3 --skill loogle-search -a claude-code. The skill file lands at ~/.claude/skills/loogle-search/SKILL.md.
What does loogle-search do?
It searches Mathlib for lemmas matching a type signature pattern. Handy when you know the type shape but not the lemma name.
What has to be set up before the first query?
Build Loogle first: cd ~/tools/loogle && lake build, then lake build LoogleMathlibCache or a build with --write-index. Without that build the search will not run.
Source text
SKILL.md · MIT
--- name: loogle-search description: Search Mathlib for lemmas by type signature pattern --- # Loogle Search - Mathlib Type Signature Search Search Mathlib for lemmas by type signature pattern. ## When to Use - Finding a lemma when you know the type shape but not the name - Discovering what's available for a type (e.g., all `Nontrivial ↔ _` lemmas) - Type-directed proof search ## Commands ```bash # Search by pattern (uses server if running, else direct) loogle-search "Nontrivial _ ↔ _" loogle-search "(?a → ?b) → List ?a → List ?b" loogle-search "IsCyclic, center" # JSON output loogle-search "List.map" --json # Start server for fast queries (keeps index in memory) loogle-server & ``` ## Query Syntax | Pattern | Meaning | |---------|---------| | `_` | Any single type | | `?a`, `?b` | Type variables (same variable = same type) | | `Foo, Bar` | Must mention both `Foo` and `Bar` | | `Foo.bar` | Exact name match | ## Examples ```bash # Find lemmas relating Nontrivial and cardinality loogle-search "Nontrivial _ ↔ _ < Fintype.card _" # Find map-like functions loogle-search "(?a → ?b) → List ?a → List ?b" # → List.map, List.pmap, ... # Find everything about cyclic groups and center loogle-search "IsCyclic, center" # → commutative_of_cyclic_center_quotient, ... # Find Fintype.card lemmas loogle-search "Fintype.card" ``` ## Performance - **With server running**: ~100-200ms per query - **Cold start (no server)**: ~10s per query (loads 343MB index) ## Setup Loogle must be built first: ```bash cd ~/tools/loogle && lake build lake build LoogleMathlibCache # or use --write-index ``` ## Integration with Proofs When stuck in a Lean proof: 1. Identify what type shape you need 2. Query Loogle to find the lemma name 3. Apply the lemma in your proof ```lean -- Goal: Nontrivial G from 1 < Fintype.card G -- Query: loogle-search "Nontrivial _ ↔ 1 < Fintype.card _" -- Found: Fintype.one_lt_card_iff_nontrivial exact Fintype.one_lt_card_iff_nontrivial.mpr h ```
© parcadei · MIT · parcadei/Continuous-Claude-v3