Runs Z3 on SMT-LIB2 constraints to check for satisfiability, returning models or unsat cores with full audit logging.
Install
mkdir -p .claude/skills/solve && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/19297" && unzip -o skill.zip -d .claude/skills/solve && rm skill.zipInstalls to .claude/skills/solve
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Check satisfiability of SMT-LIB2 formulas using Z3. Returns sat/unsat with models or unsat cores. Logs every invocation to z3agent.db for auditability.Key capabilities
- →Check satisfiability of SMT-LIB2 formulas
- →Extract satisfying assignments for satisfiable formulas
- →Retrieve unsat cores from invalid constraints
- →Log solver invocations to a database for auditability
- →Execute Z3 solver via string input or file path
How it works
The skill pipes an SMT-LIB2 formula to the Z3 solver and records the execution details in a local database. It then parses the solver output to return the satisfiability status and associated data.
Inputs & outputs
When to use solve
- →Verify logical constraints in code
- →Find models for satisfiable logic problems
- →Extract unsat cores from invalid constraints
About this skill
Given an SMT-LIB2 formula (or a set of constraints described in natural language), determine whether the formula is satisfiable. If sat, extract a satisfying assignment. If unsat and tracking labels are present, extract the unsat core.
Step 1: Prepare the formula
Action: Convert the input to valid SMT-LIB2. If the input is natural language, use the encode skill first.
Expectation:
A syntactically valid SMT-LIB2 formula ending with (check-sat) and
either (get-model) or (get-unsat-core) as appropriate.
Result: If valid SMT-LIB2 is ready, proceed to Step 2. If encoding is needed, run encode first and return here.
Step 2: Run Z3
Action: Invoke solve.py with the formula string or file path.
Expectation:
The script pipes the formula to z3 -in, logs the run to
.z3-agent/z3agent.db, and prints the result.
Result:
Output is one of sat, unsat, unknown, or timeout.
Proceed to Step 3 to interpret.
python3 scripts/solve.py --formula "(declare-const x Int)(assert (> x 0))(check-sat)(get-model)"
For file input:
python3 scripts/solve.py --file problem.smt2
With debug tracing:
python3 scripts/solve.py --file problem.smt2 --debug
Step 3: Interpret the output
Action: Parse the Z3 output to determine satisfiability and extract any model or unsat core.
Expectation:
sat with a model, unsat optionally with a core, unknown, or
timeout.
Result:
On sat: report the model to the user.
On unsat: report the core if available.
On unknown/timeout: try simplify or increase the timeout.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| formula | string | no | SMT-LIB2 formula as a string | |
| file | path | no | path to an .smt2 file | |
| timeout | int | no | 30 | seconds before killing z3 |
| z3 | path | no | auto | explicit path to z3 binary |
| debug | flag | no | off | print z3 command, stdin, stdout, stderr, timing |
| db | path | no | .z3-agent/z3agent.db | path to the logging database |
Either formula or file must be provided.
When not to use it
- →When the input is natural language without prior encoding
- →When the formula results in unknown or timeout states without simplification
Prerequisites
Limitations
- →Requires either a formula string or a file path
- →Default timeout is 30 seconds
How it compares
Unlike manual solver execution, this skill automates the logging of every invocation to a specific database for audit purposes.
Compared to similar skills
solve side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| solve (this skill) | 0 | 4mo | Review | Intermediate |
| python-repl | 6 | 4mo | Review | Beginner |
| compare-cpython-versions | 1 | 7mo | Review | Advanced |
| prove | 0 | 4mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by Z3Prover
View all by Z3Prover →You might also like
python-repl
gptme
Interactive Python REPL automation with common helpers and best practices
compare-cpython-versions
DataDog
Compare CPython source code between two Python versions to identify changes in headers and structs. Use this when adding support for a new Python version to understand what changed between versions.
prove
Z3Prover
Prove validity of logical statements by negation and satisfiability checking. If the negation is unsatisfiable, the original statement is valid. Otherwise a counterexample is returned.
detect-silent-processing-failures
atniptw
Use to detect suspicious processor outputs even when no exception is thrown. Keywords: silent failure, metadata validation, glb checks, anomaly detection.
massgen-log-analyzer
massgen
Run MassGen experiments and analyze logs using automation mode, logfire tracing, and SQL queries. Use this skill for performance analysis, debugging agent behavior, evaluating coordination patterns, and improving the logging structure, or whenever an ANALYSIS_REPORT.md is needed in a log directory.
research
dmitryprg-ai
Analyze data, investigate datasets, debug with data, and explore system behavior. Use when analyzing, running SQL queries, data profiling, investigating patterns, building statistics, exploring CSV/JSON data, or debugging with data evidence.