arabelatso/requirement-to-tlaplus-property-generator
Automatically derives TLA+ properties (invariants, safety, liveness) from natural-language requirements or structured requirement documents. Resolves ambiguities, asks clarifying questions for underspecified requirements, and outputs TLA+-compatible property definitions with semantic explanations. Use when translating system requirements, specifications, or behavioral constraints into formal TLA+ temporal logic properties for verification with TLC model checker.
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill requirement-to-tlaplus-property-generator
This skill transforms natural-language requirements into formal TLA+ properties, enabling rigorous verification of system specifications. It handles invariants, safety properties, and liveness properties, resolving ambiguities and seeking clarification when needed.
Parse and understand the input requirement:
When ambiguities are detected, use one of these strategies:
Strategy A: Reasonable Interpretation
If the ambiguity has a standard interpretation in the domain, resolve it automatically and document the assumption.
Example:
Strategy B: Ask Clarifying Questions
For critical or non-obvious ambiguities, ask the user:
See references/clarification_patterns.md for common question templates.
Translate the requirement into TLA+ syntax:
Invariants (Type Invariant or State Predicate):
TypeOK == /\ var1 \in ValidSet1
/\ var2 \in ValidSet2
/\ condition
StateInvariant == predicate_over_state_variables
Safety Properties (Always):
Safety == []P \* P holds in all reachable states
Liveness Properties (Eventually):
Liveness == <>P \* P eventually holds
Liveness2 == [](P => <>Q) \* If P holds, Q eventually holds
Fairness:
Fairness == WF_vars(Action) \* Weak fairness
Fairness2 == SF_vars(Action) \* Strong fairness
See references/tlaplus_syntax.md for comprehensive syntax reference.
Create the complete property definition:
Example output:
\* Property: Buffer never overflows
\* Requirement: "The system must ensure the buffer size never exceeds capacity"
\* Type: Safety (Invariant)
BufferSafety == buffer_size <= MAX_BUFFER_SIZE
\* Add to specification:
\* Spec == Init /\ [][Next]_vars /\ BufferSafety
Explain what the property means:
Requirement: "At most one process can be in the critical section"
TLA+ Property:
MutualExclusion ==
\A p1, p2 \in Processes :
(p1 # p2) => ~(pc[p1] = "critical" /\ pc[p2] = "critical")
Requirement: "Every request is eventually served"
TLA+ Property:
EventualService ==
\A req \in Requests :
(req.status = "pending") ~> (req.status = "completed")
Requirement: "The system responds within N steps"
TLA+ Property:
\* Note: TLA+ doesn't directly express bounded liveness
\* Use auxiliary counter variable
BoundedResponse ==
[](request_made => <>(response_sent \/ timeout_counter > N))
Requirement: "Event A must occur before event B"
TLA+ Property:
OrderingConstraint ==
[](event_B_occurred => event_A_occurred_before)
See references/requirement_patterns.md for more patterns.
Break down complex requirements into multiple properties:
Requirement: "The system must process requests in FIFO order and complete each within 10 steps"
Decomposition:
Use implication for conditional properties:
Requirement: "If the system is in safe mode, no writes are allowed"
TLA+ Property:
SafeModeConstraint == [](safe_mode => ~write_enabled)
Use TLA+ quantifiers appropriately:
Requirement: "All active processes eventually terminate"
TLA+ Property:
AllTerminate ==
\A p \in Processes :
(status[p] = "active") ~> (status[p] = "terminated")
Pitfall 1: Confusing safety and liveness
Pitfall 2: Unbounded liveness without fairness
Pitfall 3: Over-specification
Pitfall 4: Implicit state assumptions
For each requirement, provide:
Take arabelatso/requirement-to-tlaplus-property-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.