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.
npx claudepluginhub melodic-software/claude-code-plugins --plugin formal-specificationThis skill is limited to using the following tools:
Create formal specifications for system components, behaviors, and algorithms.
Provides 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.
Designs system architecture using Mermaid component and sequence diagrams, module contracts, and SOLID principles. Useful for defining components, flows, project structure, and service organization.
Share bugs, ideas, or general feedback.
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: