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.

referencesscaffold-dsl.md

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

DSL Scaffold Template

Copy-paste starting point for a new embedded DSL. Includes syntax categories, bridge macro, AST, elaboration, and tests.

How to use: Copy the template below into a new .lean file. Replace MyDSL/myDSL/myExpr/myAtom with your DSL's names and Expr with your target AST type. Run lake build to verify, then inspect expansion with set_option pp.notation false in #check [myDSL| ...]. See lean4-custom-syntax.md for the full API reference.

import Lean
open Lean Elab Meta

namespace MyDSL

-- 1. Syntax categories (hierarchical)
declare_syntax_cat myAtom
declare_syntax_cat myExpr

-- 2. Atoms
syntax ident : myAtom
syntax num : myAtom
-- Add more atoms (e.g., str) with matching macro_rules if needed.

-- 3. Expressions
syntax myAtom : myExpr
syntax "(" myExpr ")" : myExpr
syntax:70 myExpr:70 " * " myExpr:71 : myExpr
syntax:65 myExpr:65 " + " myExpr:66 : myExpr

-- 4. Bridge to term
syntax "[myDSL|" myExpr "]" : term

-- 5. Target AST
inductive Expr where
  | var : String → Expr
  | num : Int → Expr
  | add : Expr → Expr → Expr
  | mul : Expr → Expr → Expr
  deriving Repr

-- 6. Elaboration
macro_rules
  | `([myDSL| $i:ident]) => `(Expr.var $(Lean.quote i.getId.toString))
  | `([myDSL| $n:num]) => `(Expr.num $n)
  | `([myDSL| ($e)]) => `([myDSL| $e])
  | `([myDSL| $a + $b]) => `(Expr.add [myDSL| $a] [myDSL| $b])
  | `([myDSL| $a * $b]) => `(Expr.mul [myDSL| $a] [myDSL| $b])

-- 7. Test
#check [myDSL| x + 1 * 2]
example : [myDSL| 1 + 2] = Expr.add (.num 1) (.num 2) := rfl

end MyDSL

Debug Commands

set_option pp.notation false in #check [myDSL| ...]  -- see expansion
set_option pp.all true in #check [myDSL| ...]        -- full detail
set_option trace.Macro.expand true in #check [myDSL| x + 1 * 2]  -- trace expansion

Source: SKILL.md on GitHub

2 warnings3d5 checks · Risk MEDIUM
  • Gen Agent Trust Hub3d

    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.

  • Socket3d

    No alerts

  • Snyk3d

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

Activeupdated last week

README badge

README badge for cameronfreer/lean4-skills