Catalog
Yeachan-Heo/create-formal-verification-skill

Yeachan-Heo

create-formal-verification-skill

Verify the project's riskiest invariant with TLA+, Lean, or Kani — chosen by property shape — and leave a project-local skill the next agent reruns; assumptions are part of the deliverable. For properties tests cannot reach.

NewUpdated Nov 9, 2026

Create Formal Verification Skill

Generate a project-local skill that formally verifies one high-risk property and can be rerun by any later agent. Formal methods pay off only on properties tests cannot reach; this skill exists to find that one property, verify it, and leave the verification behind as structure.

When to use

  • a concurrency or locking protocol where interleavings defeat tests
  • exact arithmetic a test can sample but not exhaust (backoff schedules, quorum math, budget accounting)
  • a Rust invariant you want checked over all executions of a function

When not to use

  • ordinary business logic — verify and the test suite are the right tools
  • more than one property at a time; pick the riskiest, ship it, come back

Workflow

  1. Survey candidates. Ask the user (or infer from recent incidents) for the invariants whose violation would hurt most. Rank by risk times likelihood-of-undetected-breakage. Name the top three and pick one with the user when reachable; otherwise pick the riskiest and say so.
  2. Choose the tool by shape, not fashion:
    • TLA+ — concurrent processes, locks, retries, distributed-ish protocols. Model each atomic step; check safety (nothing bad) and liveness (something good eventually) with TLC.
    • Lean — exact arithmetic and algorithmic properties. Transcribe the computation as a function over naturals; prove the theorem.
    • Kani — Rust; harnesses check panics, overflows, and invariants over all inputs a function can receive. If none fits, say so and stop rather than forcing one.
  3. Model honestly. Write the spec next to the code it models, citing file and line. Open the spec with an "Assumptions the model makes" register: every assumption numbered, each citing the source lines it abstracts, and each marked (!) when the code does not actually guarantee it (pid reuse, atomic filesystem steps, integer widths, an honest clock). The register is part of the deliverable — an unlisted assumption is an unearned theorem, and a (!) the code later starts guaranteeing is a model owed an update.
  4. Verify. Run the tool (apalache/TLC, lake build, cargo kani). A violated property is a finding: minimize the counterexample, check whether the code shares the flaw, and report before adjusting the model.
  5. Generate the project skill at .claude/skills/verify-formal-<property>/SKILL.md containing: the property in one sentence, the spec file path, the exact run command, the pass criteria, the assumption list, and the source lines the model tracks. The next agent reruns the command; it never re-derives the model.
  6. Record the verification through the ledger's locked writer — import appendLedgerEntry and defaultLedgerPath from the installed package's dist/features/verification-ledger/index.js (resolve the package root the figure-it-out way; babysit's ledger step demonstrates the exact invocation). Never append raw rows to .omc/state/verification-ledger.tsv; the writer owns header creation, locking, and cell sanitization. Write formally-verified only after a green rerun with the run command as evidence; a counterexample records verifier-failed with the counterexample as evidence, and no positive row is written until the finding is resolved.

Maintenance

When the modeled code changes shape (lines move, protocol steps change), hand to the maintain-formal-verification-skill skill: it re-checks each assumption against current code, updates cited lines, and reruns. A spec that cites lines that no longer exist is stale, and a stale spec's green is worthless — say so out loud in the session.

Rules

  • One property per generated skill.
  • The model's assumptions are written down, or the verification does not ship.
  • A counterexample is reported, never papered over by weakening the property to make it pass.
Files1
1 files · 1.0 KB

Select a file to preview

Overall Score

77/100

Grade

B

Good

Grades are signals, not a certification. Always review a skill yourself before use.

Safety

78

Quality

76

Clarity

79

Completeness

73

Summary

This skill guides an AI agent to formally verify a single high-risk property in a codebase using TLA+, Lean, or Kani, chosen based on property shape. It produces a project-local verification skill documenting assumptions, specifications, and re-runnable verification commands for future agents.

Detected Capabilities

file writeshell executioncode analysisledger access and manipulationproject-local skill generation

Trigger Keywords

Phrases that agents use to match this skill to user intent.

verify concurrent protocolformal property checkcheck rust invariantexhaustive arithmetic proofminimize counterexample

Risk Signals

INFO

Shell execution of formal verification tools (apalache, TLC, lake build, cargo kani)

Step 4 'Verify' section
INFO

Access to package ledger system via dist/features/verification-ledger/index.js

Step 6 'Record' section
INFO

File writes to .claude/skills/ directory for generated skill

Step 5 'Generate the project skill' section
WARNING

No explicit guardrails against running verification on untrusted specs or malicious harnesses

General
WARNING

Skill assumes formal verification tools are installed and accessible in PATH

Steps 4-5

Referenced Domains

External domains referenced in skill content, detected by static analysis.

github.com

Use Cases

  • Verify concurrent protocols and locking invariants where interleaving defeats unit tests
  • Formally verify exact arithmetic properties (quorum logic, budget accounting, backoff schedules) that tests cannot exhaustively cover
  • Check Rust invariants and prevent panics/overflows over all possible inputs using Kani
  • Create reusable, documented formal verification artifacts for code review and maintenance
  • Isolate and minimize counterexamples in critical systems before fixing code

Quality Notes

  • Strength: Excellent workflow structure with clear decision points (survey → choose tool → model → verify → generate → record)
  • Strength: Strong epistemic rigor — assumptions are mandatory, counterexamples must be reported, not hidden
  • Strength: Tool selection is principled (TLA+ for concurrency, Lean for arithmetic, Kani for Rust) with clear guidance on when *not* to use formal methods
  • Strength: Deliverable is precisely specified (assumptions register, spec file path, run command, source line citations)
  • Strength: References both original work (pstack) and port author, showing attribution discipline
  • Weakness: Limited error handling guidance — what if apalache/TLC/cargo kani are not installed? What if the model is ambiguous or the property unchecked?
  • Weakness: No fallback strategy if formal verification fails or is infeasible for the chosen property
  • Weakness: Assumes user familiarity with TLA+/Lean/Kani syntax; no template or scaffolding provided
  • Weakness: Ledger integration is terse — 'resolve the package root the figure-it-out way' is vague for an AI agent
  • Weakness: No guidance on property negation or partial verification if full verification is intractable
Model: claude-haiku-4-5-20251001Analyzed: Nov 9, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Version History

  1. v1.1

    Content updated

    ✦ AIRefactors assumption documentation to require numbered register with source citations and (!) marks for unguaranteed behaviors

    2026-11-09

    LATEST
  2. v1.0

    2026-11-08

    View This VersionInitial version

Use Yeachan-Heo/create-formal-verification-skill in your dev environment

Command Palette

Search for a command to run...