Skip to content
Skills Library
Programming · Building & coding

create-tla-model

/create-tla-model

Write TLA+ models of a system's stateful parts (flows, protocols, state machines). Use when starting formal models for behavior tests rarely cover; not to re-check existing models (use tla-check) or to update models after code changes (use maintain-tla-model).

Licence
MIT
Last repository change
10.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 10.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Write TLA+ models of a system's stateful parts (flows, protocols, state machines). Use when starting formal models for behavior tests rarely cover; not to re-check existing models (use tla-check) or to update models after code changes (use maintain-tla-model).

Original author description

Write TLA+ models of a system's stateful parts (flows, protocols, state machines). Use when starting formal models for behavior tests rarely cover; not to re-check existing models (use tla-check) or to update models after code changes (use maintain-tla-model).

How it works

  1. 1. Choose the target from the code
  2. 2. Write the model
  3. 3. Show it can fail
  4. 4. Record coverage
  5. Done when
Original SKILL.md headings · 41 lines, 479 words
SKILL.md preview
---
name: create-tla-model
description: "Write TLA+ models of a system's stateful parts (flows, protocols, state machines). Use when starting formal models for behavior tests rarely cover; not to re-check existing models (use tla-check) or to update models after code changes (use maintain-tla-model)."
license: MIT
compatibility: droid
---

# Create TLA model

A test checks the cases someone thought of. A model checker checks every order of steps inside the model's bounds. Find the part of the repo where that matters most, model it, and leave a record the next agent can use to keep it honest.

## 1. Choose the target from the code

Start where the user pointed, if they did. Otherwise pick the strongest target, not the easiest: a promise the code makes, where a break harms users and tests rarely reach the bad case. Typical targets are retries and idempotency, locks and leases, multi-step flows with cancel or timeout, and protocol handshakes.

TLA+ answers "can these events happen in a bad order?" If the question is "does this function behave for every input" (overflow, memory safety, a data-structure invariant), TLA+ is the wrong tool. Say so and recommend a verifier that runs on the code or property-based tests instead.

## 2. Write the model

Put it in the project, for example `specs/tla/<Area>/<Area>.tla` with `<Area>.cfg`. Then:

- **True to the code.** Each variable and action points to code a reviewer can open. One atomic step in the code is one action in the model. Names come from the repo.
- **Rules as invariants.** Write each promise as an `INVARIANT` in the config. If the model lacks a variable for a rule, add one. Never weaken a rule so it holds.
- **Named actions.** Write `Next` as a disjunction of named actions, so traces say which step happened.
- **Correct end states.** Add a stuttering `Done` action for states that legitimately stop, or TLC reports a deadlock.
- **Small bounds.** Keep constants small, or add a `CONSTRAINT`, so a run finishes in seconds.

## 3. Show it can fail

Run `tla-check` on the model. Then break the model the way the code could break (remove a guard, split an atomic step) and confirm `tla-check` catches it. Revert the break. A rule you have never seen fail proves nothing.

If the current model of the current code breaks a rule, that is a finding. Report it with the counterexample in the code's words. Do not change product code unless the user asks.

## 4. Record coverage

Write `COVERAGE.md` beside the model:

- each rule in one plain sentence, with the harm if it breaks
- the files and functions each action models
- the bounds and assumptions, and what the model leaves out
- the command that runs it
- the commit at which you confirmed the model matches the code

## Done when

The model and config are in the project, `tla-check` passed (or failed only on reported findings), the deliberate break was caught, and `COVERAGE.md` records the sync commit. The reply says what was modeled, the bounds, what the check found in plain words, how to rerun it, and what it does not cover.

Versions

The database has no other skills named create-tla-model.

Database snapshot: 13.11.2026 · package version 3ff59e45428a (SHA-256 digest of the entire package)

Downloads in the last 30 days: 4 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100tla-check
    Check existing TLA+ models with TLC, render the state diagram, and report violations. Use to verify a model or when asked to run the checker; not to author or revise models (use create-tla-model or maintain-tla-model), and not for skill or prompt eval (use eval-runs or eval-hillclimb).
  • 100program-to-tlaplus-spec-generator
    Automatically generate TLA+ specifications from program code, repositories, or system implementations. Use when asked to generate TLA+ spec, create TLA+ specification from code, convert program to TLA+, formalize system in TLA+, extract TLA+ model from code, or when working with…
  • 100tla
    Use when writing or changing code that holds state across steps (a lifecycle, a lock, a queue, a protocol, a cache, storage, a retry, a screen's states), when a defect needs an interleaving, a restart or a crash to happen, or when simplifying such code. Models the whole program…
  • 100tla
    Formally verify a capability's invariants with TLA+ and TLC, and record the result as metamodel Evidence. Use when the constitution's formal verification assessment flags a component (concurrency, distributed state, financial transactions, safety-critical logic, complex state machines, protocols).
  • 100tla-check
    Write and iteratively refine executable TLA+ specs (.tla) and TLC model configs (.cfg) from natural-language system designs; run TLC model checking; summarize pass/fail and counterexamples with explicit assumptions and bounds. Use when asked to design or validate a…
  • 90tlaplus
    Use to model-check real code or a design with TLA+ and TLC. Model retries, locks, async flows, protocols or state machines as written, check invariants over every interleaving, and reproduce any counterexample trace as a failing test. Dispatched by /engineer.harden for…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.