Command Palette

Search for a command to run...

Назад к скиллам
скилл № 82841

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от 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]
  • THEOREM accepts a full declaration name or a unique dotted suffix in FILE.lean. Unsafe declarations and non-theorem definitions exit 2.
  • Pass --out to a scratch folder outside the repo so generated charts stay out of your checkout. Without --out, the output goes to <short-theorem>-proof beside FILE.lean. The folder must be new or empty.
  • --view FILE applies a plain-English view module to lemmas.mmd and proof.mmd.
  • --tactics adds raw Lean tactic lines back inside proof.mmd boxes for Lean authors. Without it, boxes show claims, new local assumptions, invoked lemmas, and proof outcomes, while report.md keeps the full hypotheses and tactic scripts.
  • --config applies only to TLA+ specs and exits 2 on .lean inputs.
  • Toolchain lookup checks LEAN_SYSROOT, then lean and lake on PATH from the package root, then a pinned mise http:lean install for v4.34.1. Every resolved binary must report v4.34.1; any other pin or binary version exits 2.
  • Interactive runs call lake setup-file in place, which writes the gitignored .lake/ folder and may create lake-manifest.json if 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 Next as a disjunction of the actions, such as YouPressPlay \/ YouPressStop. If you do not, TLC names every step Next.
  • 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 is CHECK_DEADLOCK. Add to Next an action that is true only in the end states and changes nothing, such as Done == phase \in {"paid", "failed"} /\ UNCHANGED vars, and give it a label in step().

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

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • 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 запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить statechart с