smv-model-extractor
Automatically extract abstract finite-state models in SMV/NuSMV format from source code (C/C++, Java, Python) for formal model checking. Use when users need to: (1) Generate SMV models from program code for verification, (2) Extract state-transition models from protocol implementations, (3) Analyze control flow and data flow to construct formal models, (4) Create models for checking safety and liveness properties, (5) Convert imperative code to declarative state machines. Particularly effective for protocol implementations, concurrent systems, and control logic with clear state transitions.
npx skills add majiayu000/claude-skill-registry --skill smv-model-extractor --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# SMV Model Extractor Automatically extract abstract finite-state models from source code for formal verification with NuSMV model checker. ## Overview This skill transforms imperative programs (C/C++, Java, Python) into declarative SMV models suitable for model checking. It analyzes control flow, data flow, and program variables to construct states and transitions, applying appropriate abstraction to make models tractable while preserving properties of interest. ## Workflow ### 1. Analyze Source Code Read and understand the program structure: ```bash # For single file python3 scripts/extract_model.py program.c -o model.smv # For multiple files python3 scripts/extract_model.py file1.c file2.c file3.java -o model.smv # For entire directory python3 scripts/extract_model.py src/*.py -o model.smv ``` The extractor automatically: - Detects programming language from file extensions - Parses source code into AST - Identifies functions, control structures, and variables - Builds control flow graph (CFG) ### 2. Apply Abstraction The skill uses **medium abstraction** by default (balanced approach): **Data abstraction:** - Booleans → preserved as boolean - Integers → bounded to small ranges (
- Overview
- Workflow
- 1. Analyze Source Code
- 2. Apply Abstraction
- 3. Generate SMV Model
- 4. Add Verification Properties
- 5. Run Model Checker
- Common Use Cases
- Protocol Implementation
- Concurrent System
- State Machine
- Advanced Options
- Focus on Specific Functions
- Track Specific Variables
For single file python3 scripts/extract_model.py program.c -o model.smv For multiple files python3 scripts/extract_model.py file1.c file2.c file3.java -o model.smv For entire directory python3 scripts/extract_model.py src/*.py -o model.smv Low abstraction (more detail, larger state space) python3 scripts/extract_model.py program.c -o model.smv --abstraction low Medium abstraction (recommended, balanced) python3 scripts/extract_model.py program.c -o model.smv --abstraction medium
What does the smv-model-extractor skill do?
Automatically extract abstract finite-state models in SMV/NuSMV format from source code (C/C++, Java, Python) for formal model checking. Use when users need to: (1) Generate SMV models from program code for verification, (2) Extract state-transition models from protocol implementations, (3) Analyze control flow and data flow to construct formal models, (4) Create models for checking safety and liveness properties, (5) Convert imperative code to declarative state machines. Particularly effective for protocol implementations, concurrent systems, and control logic with clear state transitions.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill smv-model-extractor --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
