From formal-specification
Generates formal specifications for components, behaviors, protocols, and algorithms using TLA+, SysML, state machines, or UML. For safety-critical systems and workflows.
How this skill is triggered — by the user, by Claude, or both
Slash command
/formal-specification:specifyThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Create formal specifications for system components, behaviors, and algorithms.
Create formal specifications for system components, behaviors, and algorithms.
/specify "distributed lock protocol"
/specify "order lifecycle" format=state-machine
/specify "vehicle control system" format=sysml
/specify "consensus algorithm" format=tla+
Parse the specification topic and determine:
If format not specified, auto-detect based on topic:
| Topic Pattern | Recommended Format |
|---|---|
| "protocol", "consensus", "distributed" | TLA+ |
| "lifecycle", "status", "workflow" | State Machine |
| "system", "hardware", "embedded" | SysML |
| "interaction", "flow", "sequence" | UML |
Load the relevant skill:
tla-specification for TLA+ specsstate-machine-design for state machinessysml-modeling for SysML modelsuml-modeling for UML diagramsIf working in a project with specifications:
docs/requirements/Create the formal specification including:
Deliver:
--------------------------- MODULE TopicName ---------------------------
EXTENDS Integers, Sequences
CONSTANTS ...
VARIABLES ...
Init == ...
Next == ...
Spec == Init /\ [][Next]_vars
Safety == ...
Liveness == ...
=============================================================================
@startuml
[*] --> Initial
Initial --> Active : trigger
Active --> Completed : complete
Completed --> [*]
@enduml
@startuml
class "<<block>>\nSystemName" as System {
values
--
parts
--
operations
}
@enduml
/specify "distributed lock with leader election" format=tla+
Output: TLA+ module with mutual exclusion safety property and eventual grant liveness property.
/specify "e-commerce order lifecycle"
Output: State machine diagram showing Draft → Submitted → Paid → Shipped → Delivered states with transitions and guards.
/specify "autonomous vehicle perception system" format=sysml
Output: SysML BDD showing sensors, processors, and data flows with parametric constraints.
The command integrates with:
npx claudepluginhub melodic-software/claude-code-plugins --plugin formal-specificationProvides TLA+ templates, syntax guidance, type invariants, and best practices for specifying distributed systems and concurrent algorithms. Useful for formal design and verification with TLC.
Writes and refines TLA+ specs (.tla) and TLC configs (.cfg) from natural-language designs; runs model checking; summarizes results, counterexamples, and assumptions. For protocol/state machine validation.
Guides spec-driven development with architecture diagrams, requirement documents, and tooling. Helps choose diagram types (C4, Mermaid, UML) and doc formats (PRD, ADR, BRD).