statechart
Check a TLA+ model or a Lean 4 proof and draw it as Mermaid. For TLA+, checks rules with TLC and shows shortest bug paths. For Lean 4, draws lemma…
от minghinmatthewlam★ 46 звёзд на GitHub
Установить statechart в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Statechart
The chart shows how a TLA+ system moves between states or how a Lean 4 theorem is proved, in the words of the operator who must decide whether the behavior or proof is right.
Run
scripts/statechart.ts is TypeScript, so run it with a runtime that executes TypeScript. scripts/statechart is a POSIX shell script that picks Node 22.18 to 22.x, Node 23.6 or later, Bun 1.1.5 or later, or Deno 2.0 or later. On native Windows, run node --disable-warning=ExperimentalWarning <skill dir>/scripts/statechart.ts with Node 22.18 to 22.x, or Node 23.6 or later.
The CLI auto-dispatches on the first positional argument.
TLA+ models
Work in a scratch folder outside the repo. Write a TLA+ spec and its config. Then run:
<skill dir>/scripts/statechart SPEC.tla [--config FILE] [--view FILE] [--out DIR]
The first TLA+ run installs TLC and Java with mise and needs the network. --tactics applies only to .lean files and exits 2 on .tla inputs.
Lean 4 proofs
Run against any .lean file pinned to Lean v4.34.1 (or a standalone .lean file with no lean-toolchain):
<skill dir>/scripts/statechart FILE.lean THEOREM [--view FILE] [--tactics] [--out DIR]
THEOREMaccepts a full declaration name or a unique dotted suffix inFILE.lean. Unsafe declarations and non-theorem definitions exit 2.- Pass
--outto a scratch folder outside the repo so generated charts stay out of your checkout. Without--out, the output goes to<short-theorem>-proofbesideFILE.lean. The folder must be new or empty. --view FILEapplies a plain-English view module tolemmas.mmdandproof.mmd.--tacticsadds raw Lean tactic lines back insideproof.mmdboxes for Lean authors. Without it, boxes show claims, new local assumptions, invoked lemmas, and proof outcomes, whilereport.mdkeeps the full hypotheses and tactic scripts.--configapplies only to TLA+ specs and exits 2 on.leaninputs.- Toolchain lookup checks
LEAN_SYSROOT, thenleanandlakeonPATHfrom the package root, then a pinnedmisehttp:leaninstall forv4.34.1. Every resolved binary must reportv4.34.1; any other pin or binary version exits 2. - Interactive runs call
lake setup-filein place, which writes the gitignored.lake/folder and may createlake-manifest.jsonif the package has none. Tests copy packages into temporary folders so the checkout stays clean.
TLA+ workflow
Write the spec
- Write each rule that the operator agrees to as an INVARIANT. A rule can be about a screen, a result, a stored value, or a message. If the model has no variable for a rule, add the variable. Never weaken a rule to make it hold.
- Write
Nextas a disjunction of the actions, such asYouPressPlay \/ YouPressStop. If you do not, TLC names every stepNext. - A state with no step out breaks
NoDeadlock, also when it is a correct end state. When an INVARIANT or a PROPERTY already has that name, the rule isCHECK_DEADLOCK. Add toNextan action that is true only in the end states and changes nothing, such asDone == phase \in {"paid", "failed"} /\ UNCHANGED vars, and give it a label instep().
Pick the TLA+ chart
You do the work that needs judgment: the words on each state and arrow, the phases and their colors, the title, and the report to the operator. Put your work in a view module, and give it with --view.
To show the operator's words, the view exports state(vars). The value that state() returns picks the form:
- A string gives a flat chart:
export const state = (v) => (v.paid ? "Paid" : "Paying"); - An array gives parent states:
export const state = (v) => v.main.split("."); - An object gives one parallel region for each key:
export const state = (v) => ({ Playback: v.playback, Volume: v.volume });
Label each state with what the operator can see or cares about, such as "Paying" or "Lease held, write pending". Keep variable names out of labels. In vars, a TLA+ sequence is an object with keys from 1, so v.pc[1] is pc[1]. A set is an array.
The view can also export step(action, from, to). It gets the TLC action name and the values before and after the step, and it returns the label of the arrow. Write each step label as the operator sees it happen, such as "you press play" or "the connect fails". Do not name the code or the TLA+ action. Two actions that end the same in the chart get the same label, so that they share one arrow.
When a step can occur only in some conditions, end its label with the condition in brackets, in the operator's words, such as you press play [while the file loads]. In a regions chart, the command writes the condition on the other regions on the arrow, in the words of their labels, such as [when Offline]. Your brackets replace it, and two arrows from one state can then look the same. So in a regions chart, do not write brackets for a condition on another region. When a value that no label shows decides where a step g
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/render.md
- scripts/backends/cfg.ts
- scripts/backends/mermaid.ts
- scripts/backends/plain-text.ts
- scripts/backends/report.ts
- scripts/frontends/config.ts
- scripts/frontends/dot.ts
- scripts/frontends/marks.ts
- scripts/frontends/messages.ts
- scripts/frontends/spec.ts
- scripts/frontends/trace.ts
- scripts/frontends/value.ts
- scripts/frontends/verdict.ts
- scripts/frontends/view.ts
- scripts/ir.ts
- scripts/janitor.ts
- scripts/kill.ts
- scripts/lean/Extract.lean
- scripts/lean/backends/lemma-chart.ts
- scripts/lean/backends/mermaid.ts
- scripts/lean/backends/proof-chart.ts
- scripts/lean/backends/report.ts
- scripts/lean/frontends/facts.ts
- scripts/lean/frontends/view.ts
- scripts/lean/ir.ts
- scripts/lean/passes/attribute.ts
- scripts/lean/passes/blocks.ts
- scripts/lean/passes/budget.ts
- scripts/lean/passes/check.ts
- scripts/lean/passes/contract.ts
- scripts/lean/passes/fold.ts
- scripts/lean/passes/inline.ts
- scripts/lean/passes/mark.ts
- scripts/lean/passes/reduce.ts
- scripts/lean/passes/trust.ts
- scripts/lean/passes/view-lemmas.ts
- scripts/lean/pipeline.ts
- scripts/lean/run.ts
- scripts/lean/toolchain.ts
- scripts/package.json
FAQ
Что делает скилл statechart?
Check a TLA+ model or a Lean 4 proof and draw it as Mermaid. For TLA+, checks rules with TLC and shows shortest bug paths. For Lean 4, draws lemma dependencies and proof trees in plain English, flagging unproven gaps, failing steps, native code, and custom axioms. Use for /statechart.
Как установить скилл statechart?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл statechart запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…