关于 create-formal-verification-skill
create-formal-verification-skill 会生成项目本地技能,用形式化方法验证一项高风险属性,并使检查可重复执行。它根据问题选择方法、记录模型假设,并保存验证结果。
主要功能
- 01按风险为候选属性排序
- 02根据问题选择 TLA+、Lean 或 Kani
- 03记录模型假设和代码位置
- 04运行验证并报告反例
- 05生成可重复运行的项目技能
- 06通过日志写入器记录结果
适用场景
- 01检查并发或锁协议
- 02验证精确算术属性
- 03检查 Rust 函数的所有输入
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ yeachan-heo/ oh-my-claudecode --skill create-formal-verification-skill安装后在 Claude Code 中输入/create-formal-verification-skill确认已加载。
README 原文English
来自项目 READMEREADME 暂无中文译文,以下为英文原文;中文介绍见上方。
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 —
verifyand the test suite are the right tools - more than one property at a time; pick the riskiest, ship it, come back
Workflow
- 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.
- 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.
- Model honestly. Write the spec next to the code it models, citing file and line. List every assumption the model makes that the code does not guarantee (pid reuse, atomic filesystem steps, integer widths). The assumption list is part of the deliverable — an unlisted assumption is an unearned theorem.
- 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. - Generate the project skill at
.claude/skills/verify-formal-<property>/SKILL.mdcontaining: 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. - Record the verification through the ledger's locked writer — import
appendLedgerEntryanddefaultLedgerPathfrom the installed package'sdist/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. Writeformally-verifiedonly after a green rerun with the run command as evidence; a counterexample recordsverifier-failedwith 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.