new-invariant

Implements and registers new invariants for the jolt-eval testing framework.

1.0k|330|Updated May 18, 2023
One-click install
npx skills add https://github.com/a16z/jolt --skill new-invariant
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: new-invariant
Source: https://github.com/a16z/jolt/tree/main/.claude/skills/new-invariant
Command: npx skills add https://github.com/a16z/jolt --skill new-invariant

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adding a new property-based invariant to the jolt-eval framework requires repetitive boilerplate across multiple files: the invariant struct, input type, trait implementation, enum registration, and fuzz target setup. This Skill automates that entire workflow so developers can focus on the property being tested rather than plumbing.

Core Features & Use Cases

  • Invariant Scaffolding: Creates the invariant struct, input type with Arbitrary implementation, and Invariant trait implementation following existing patterns like split_eq_bind and soundness.
  • Framework Registration: Registers the new invariant in the JoltInvariants enum, the all() method, and the dispatch! macro in jolt-eval/src/invariant/mod.rs.
  • Fuzz Target Generation: Creates a libFuzzer target and runs sync_targets.sh to update the fuzz workspace configuration.
  • Use Case: A Jolt contributor wants to verify that a new sumcheck optimization preserves polynomial binding. They invoke this Skill with the invariant name, describe the property, and receive a fully registered, tested invariant ready for seed testing, fuzzing, and red-teaming.

Quick Start

Ask the assistant to implement a new jolt-eval invariant named after your property, for example by saying: create a new invariant called sumcheck_binding that verifies the sumcheck prover binds correctly to the claimed evaluation.

Frequently Asked Questions about new-invariant

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

FAQPage Schema
How do I add a new invariant to jolt-eval?

Create a new file in jolt-eval/src/invariant/ defining an input type with Arbitrary and an invariant struct implementing the Invariant trait, then register it in the JoltInvariants enum, the all() method, and the dispatch! macro in mod.rs.

How do I create a fuzz target for a jolt-eval invariant?

Add a file in jolt-eval/fuzz/fuzz_targets/ that imports your invariant and invokes the jolt_eval::fuzz_invariant! macro with a default instance. Then run ./jolt-eval/sync_targets.sh to update the fuzz workspace Cargo.toml.

What traits must a jolt-eval invariant input type implement?

The input type must derive Debug, Clone, serde Serialize and Deserialize, and schemars JsonSchema, plus a manual Arbitrary implementation for fuzzing. Use bounded ranges in the Arbitrary impl to keep generated inputs meaningful.

When should I use CheckError::InvalidInput versus CheckError::Violation?

Use CheckError::InvalidInput for degenerate inputs that should be skipped rather than counted as failures. Use CheckError::Violation with InvariantViolation::with_details for actual property violations, including diagnostic information.

How do I validate a new jolt-eval invariant before submitting?

Run cargo fmt, cargo clippy -p jolt-eval with warnings denied, and cargo nextest run filtered to your invariant's auto-generated tests. If you created a fuzz target, also verify it compiles with cargo check inside jolt-eval/fuzz.