new-objective

Implements new optimization objectives for the jolt-eval framework in Rust.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Adding a new measurable objective to the jolt-eval optimization framework requires touching many files: the objective struct, trait implementation, enum registration, const keys, objective functions, and Criterion benchmarks. This Skill automates that boilerplate so a new objective is wired in correctly and consistently.

Core Features & Use Cases

  • Guided Requirements Gathering: Validates the objective name and asks whether it is a static analysis or performance objective, plus units and measured paths.
  • Template-Based Implementation: Generates the objective file from reference templates for static analysis (code metrics) or performance (Criterion benchmarks).
  • Full Registration: Updates enums, dispatch methods, const re-exports, objective functions, and bench targets, then runs sync_targets.sh.
  • Validation Pipeline: Runs cargo fmt, clippy, nextest, and measurement or benchmark verification before reporting success.
  • Use Case: A developer wants the AI optimizer to minimize cyclomatic complexity in jolt-prover-legacy; this Skill scaffolds the objective, registers it, and verifies it end to end.

Quick Start

Ask the assistant to implement a new jolt-eval objective named cyclomatic_complexity that statically measures code complexity in the prover crate.

Frequently Asked Questions about new-objective

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

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

Provide a lowercase snake_case objective name and specify whether it is static analysis or performance. The Skill creates the objective file, implements the Objective trait, registers it in the enums, adds an ObjectiveFunction, and validates with clippy and tests.

What is the difference between static analysis and performance objectives in jolt-eval?

Static analysis objectives compute metrics by analyzing source code, such as lines of code, and override collect_measurement() with Setup = (). Performance objectives run or profile computations, such as wall-clock time, and override setup() and run() measured via Criterion.

Does a performance objective require a Criterion benchmark?

Yes. Performance objectives need a bench file in jolt-eval/benches that invokes the bench_objective! macro, followed by running sync_targets.sh to add the [[bench]] entry to Cargo.toml. Without it the optimization harness cannot measure the objective.

What naming rules apply to new jolt-eval objectives?

The objective name must be a valid Rust identifier using lowercase alphanumeric characters and underscores, such as cyclomatic_complexity. Names failing this validation are rejected before any files are created.

How is a new objective verified after implementation?

The Skill runs cargo fmt, clippy with warnings denied, and nextest for the jolt-eval package. Static analysis objectives are additionally checked via the measure-objectives binary, and performance objectives via a Criterion test-mode benchmark run.