A self-contained kit for verifying TypeScript with LemmaScript: the toolchain source plus the Claude Code skills that drive it, bundled as git submodules.
| Path | Source | What it is |
|---|---|---|
LemmaScript/ |
midspiral/LemmaScript | The verifier — compiles annotated TypeScript to Dafny or Lean 4. CLI: lsc. |
.claude/skills/ |
midspiral/lemmascript-skills | Claude Code skills: lemmascript (annotation grammar + SPEC.md), design-doc, proof-review, verified-codebase. |
Both are git submodules — see Updating.
- Node.js ≥ 18
- Dafny ≥ 4.x — for the Dafny backend (install)
- Lean 4 (
v4.24.0, optional) — only if you use the Lean backend; managed viaelan/lake - git
The kit uses submodules, so clone recursively:
git clone --recurse-submodules https://github.com/midspiral/lemmascript-kit.git
cd lemmascript-kitAlready cloned without --recurse-submodules? Pull the submodules in:
git submodule update --init --recursive./setup.sh # inits submodules, installs deps, builds the CLIRun lsc from source through tsx:
npx tsx LemmaScript/tools/src/lsc.ts <gen|regen|check|info> --backend=dafny path/to/file.tsThe skills write the CLI as
npx lsc— that form needs thelemmascriptnpm package installed (ornpm link). In this source kit, substitutenpx tsx LemmaScript/tools/src/lsc.ts.
# generate Dafny next to your TS, preserving any hand-written proofs
npx tsx LemmaScript/tools/src/lsc.ts regen --backend=dafny src/domain.ts
# verify
dafny verify src/domain.dfyregen writes domain.dfy.gen (generated — don't edit) and domain.dfy (yours — add lemmas,
ghost predicates, and loop invariants here). See LemmaScript/GETTING_STARTED.md
for the full walkthrough and LemmaScript/SPEC.md for the annotation grammar.
Start Claude Code from the kit root: the skills under .claude/skills/ are auto-discovered. The
lemmascript skill is the annotation-grammar reference; design-doc, proof-review, and
verified-codebase cover the surrounding workflow.
git pull --ff-only
git submodule update --init --recursive
./setup.shMIT — see each submodule.