All skills

Use when editing .lean files, debugging Lean 4 builds (type mismatch, sorry, failed to synthesize instance, axiom warnings, lake build errors), searching mathlib for lemmas, formalizing mathematics in Lean, finding a counterexample to, refuting, or disproving a Lean statement, or learning Lean 4 concepts. Also trigger when the user asks for help with Lean 4, mathlib, or lakefile. Do NOT trigger for Coq/Rocq, Agda, Isabelle, HOL4, Mizar, Idris, Megalodon, or other non-Lean theorem provers.

Use this Skill: https://skilld.dev/gh/cameronfreer/lean4-skills/lean4

This session only. Nothing lands on disk.

referencesprofiling-workflows.md

≈487 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Profiling Workflows

Scope: Not part of the prove/autoprove default loop. Consulted when diagnosing slow Lean builds or proofs.

Version metadata:

  • Verified on: Lean reference + release notes through v4.27.0
  • Last validated: 2026-02-17
  • Confidence: medium (docs reviewed; snippets not batch-compiled)

When to Use

  • A file or lemma is slow to elaborate or compile
  • A tactic is timing out or producing long traces
  • You need hotspots before refactoring

Composable Profiling Blocks

  • Scope: set options near the slow section
  • Target: build a single module with lake build +My.Module
  • Threshold: raise/lower trace.profiler.threshold
  • Clock: use useHeartbeats when wall-clock noise is high
  • Output: write JSON to inspect in Firefox Profiler

Quick Setup

set_option trace.profiler true
set_option trace.profiler.threshold 200
-- optional:
-- set_option trace.profiler.useHeartbeats true
-- set_option trace.profiler.output "/tmp/lean-profile.json"
-- set_option trace.profiler.output.pp true

Notes:

  • Threshold is in milliseconds unless useHeartbeats is true
  • If trace.profiler.output is set, Lean writes Firefox Profiler JSON and suppresses stdout traces

Workflow

  1. Narrow scope: add profiling options near the slow section
  2. Build a single target: lake build +My.Module
  3. If noisy, increase trace.profiler.threshold
  4. If wall-clock noise is high, enable useHeartbeats
  5. If using JSON output, open in Firefox Profiler and inspect hot traces
  6. Iterate by shrinking scope or adding local reductions to isolate the hotspot

What to Record

  • The slowest trace entries and surrounding lemmas
  • Whether the slowdown is elaboration, simp, or typeclass search
  • Any change in performance after narrowing scope

See Also

Source: SKILL.md on GitHub

2 warnings2d5 checks · Risk MEDIUM
  • Gen Agent Trust Hub2d

    The skill provides a specialized environment for Lean 4 theorem proving. It includes functionality for generating and executing dynamic scripts to refute mathematical statements and processes data from external sources such as PDFs and web pages, which introduces an indirect prompt injection surface.

  • Socket2d

    No alerts

  • Snyk2d

    Risk: LOW · No issues

  • Runlayer6mo

    14/36 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 818c19a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 14 hours ago.

Activeupdated last week

README badge

README badge for cameronfreer/lean4-skills