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.

referencesverso-docs.md

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

Verso Docs

Scope: Not part of the prove/autoprove default loop. Consulted when writing or fixing Lean doc comments that use Verso roles.

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

  • Fixing doc.verso warnings about unresolved code elements or roles
  • Writing /-- ... -/ doc comments with inline code
  • Ensuring hoverable references are precise

Role Priority

  1. {name} for declared names (constants, structures, namespaces, theorems)
  2. {lean} for Lean expressions or snippets
  3. {lit} for literal code that should not resolve (last resort)

Composable Fixups

Use these small transforms in sequence:

  1. RoleForIdent: if the snippet is a declared name, wrap with {name}
  2. RoleForExpr: if it is an expression, wrap with {lean}
  3. RoleForLiteral: for pseudo-code or undefined vars, use {lit}
  4. RoleForGiven: introduce variables with {given} before use

Quick Rules

  • Wrap inline code in backticks and add a role:
    • `{name}TensorLayout.transpose
    • `{lean}fun x ↦ x + 1
    • `{lit}x[i,j]
  • Use {given} to declare variables, then reference with {lean}:
    • {given}``n`` then {lean}#[n]
  • Use {lit} for examples with undefined variables or pseudo-code

Fixing Common Warnings

  • "code element is not specific":
    • Replace `foo` with `{name}foo if it is a declared identifier
    • Replace `foo x` with `{lean}foo x if it is an expression
  • "unknown role":
    • Use one of the standard roles {name}, {lean}, {lit}, {given}
    • If a custom role is required, define it in your doc prelude

Examples

/--
Returns {name}``TensorLayout.transpose`` for {given}``n``.
Use {lean}``#[n]`` for a rank-1 shape literal.
Prefer {lit}``x[i,j]`` when writing pseudo-indexing.
-/

Checklist

  • All inline code has an explicit role
  • {lit} is used only when resolution should be disabled
  • Variables referenced in prose are introduced with {given}

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 16 hours ago.

Activeupdated last week

README badge

README badge for cameronfreer/lean4-skills