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 formal specification of concurrent systems, distributed systems, protocols, algorithms, or state machines that need to be verified.
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill program-to-tlaplus-spec-generator
This skill enables automatic generation of TLA+ specifications from source code. It analyzes program structure, identifies state variables and transitions, and produces well-formed TLA+ modules with proper syntax and semantics.
Follow this sequential process to generate TLA+ specifications from code:
Read and understand the source code:
Ask clarifying questions if needed:
Identify variables that represent system state:
Look for:
Determine types:
Output: List of state variables with TLA+ type declarations
Extract operations that modify state:
Look for:
For each action, identify:
Output: List of actions with their effects
Identify how the system starts:
Output: Initial state predicate (Init)
Understand execution patterns:
Output: Understanding of how actions compose
Identify correctness conditions:
Safety properties (something bad never happens):
Liveness properties (something good eventually happens):
Output: List of properties to specify
Construct the specification following TLA+ syntax:
Module structure:
---- MODULE ModuleName ----
EXTENDS Naturals, Sequences, FiniteSets
CONSTANTS [constants]
VARIABLES [state variables]
vars == <<var1, var2, ...>>
Init == [initial state predicate]
Action1 == [action definition]
Action2 == [action definition]
...
Next == Action1 \/ Action2 \/ ...
Spec == Init /\ [][Next]_vars
TypeInvariant == [type constraints]
SafetyProperty == [safety properties]
====
Key elements:
See references/tlaplus_syntax.md for detailed syntax guide.
Document how program maps to TLA+:
State variable mapping:
Program Variable -> TLA+ Variable
---------------------------------
counter (int) -> counter \in Nat
buffer (array) -> buffer \in Seq(Data)
lock (bool) -> lock \in BOOLEAN
Action mapping:
Program Function -> TLA+ Action
--------------------------------
increment() -> Increment
send(msg) -> Send(msg)
acquire_lock() -> AcquireLock
Abstractions applied:
Assumptions made:
Create model checking configuration:
SPECIFICATION Spec
CONSTANTS
MaxValue = 10
NumProcesses = 3
INVARIANTS
TypeInvariant
SafetyProperty
PROPERTIES
LivenessProperty
Provide outputs in this structure:
[Complete .tla file content]
State Variables:
program_var → tla_var: [explanation]Actions:
program_function() → TLAAction: [explanation]Abstractions:
Assumptions:
[.cfg file content]
Program characteristics:
TLA+ approach:
Program characteristics:
TLA+ approach:
Program characteristics:
TLA+ approach:
Program characteristics:
TLA+ approach:
What to abstract:
What to preserve:
Abstraction levels:
Choose abstraction level based on verification goals.
C/C++:
Java:
Go:
Python:
Rust:
For detailed patterns, see references/language_patterns.md.
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Take arabelatso/program-to-tlaplus-spec-generator from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.