program-synthesis

Generate formally verified code using LLM-guided verification loops with verifier feedback for Rust, Dafny, and Lean 4 targets.

Updated Apr 20, 2026
One-click install
npx skills add https://github.com/thistleknot/skills --skill program-synthesis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: program-synthesis
Source: https://github.com/thistleknot/skills/tree/main/program-synthesis
Command: npx skills add https://github.com/thistleknot/skills --skill program-synthesis

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Program-synthesis helps you generate code that is formally verified against a specification so correctness holds for all inputs, not only the sampled cases covered by tests.

Core Features & Use Cases

  • Formal verification with proof artifacts: Produces a proof/ghost-spec artifact that must pass the selected verifier.
  • AutoVerus-style generate→refine→debug loop: Iteratively improves invariants and repair steps based on verifier failures.
  • Multi-target support (Verus, Dafny, Lean 4): Uses the most appropriate toolchain for Rust ghost specs, SMT-backed contracts, or theorem proving.
  • Escalation for safety-critical properties: Takes over when properties are universally quantified, security invariant–heavy, or concurrent correctness is required.

Quick Start

Use program-synthesis to verify a Rust (Verus) function by providing the target code and a correctness specification to the agent loop until the verifier succeeds.

Frequently Asked Questions about program-synthesis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I formally verify Rust code correctness for all inputs instead of just passing tests?

Formally verify Rust code by using Verus or AutoVerus to generate ghost specifications and proof artifacts that guarantee correctness for all inputs. The program-synthesis process iteratively refines invariants based on verifier feedback until the verifier succeeds.

What is the best way to prove security invariants and concurrent safety properties in Rust?

Prove security invariants and concurrent safety properties in Rust by escalating to formal verification with Verus. This approach uses LLM-guided loops to generate and repair universally quantified specifications that hold for all inputs.

Can I use Dafny SMT contracts to formally verify program correctness?

Yes, you can use Dafny SMT contracts to formally verify program correctness. The program-synthesis workflow supports Dafny as a multi-target verifier to generate proof artifacts that pass SMT-backed contract checks.

Do I need a verifier in PATH to generate Lean 4 theorem proving proofs?

Yes, you need a verifier available in PATH to generate Lean 4 theorem proving proofs. The iterative refinement loop depends on verifier feedback to guide error-trace repairs and output a verified status with proof artifacts.

Why use formal verification over traditional testing for safety-critical properties?

Use formal verification over testing when safety-critical properties require universally quantified correctness. Testing only validates sampled cases, whereas formal verification with proof artifacts ensures correctness holds for all possible inputs.

How to generate and refine Dafny or Verus specifications when verification fails?

Generate and refine Dafny or Verus specifications using an AutoVerus-style loop that analyzes verifier failure traces. The loop iteratively repairs invariants and code steps based on error feedback until the verifier confirms a verified status.