Skip to content
Skill

Pair optimize

Runs measured, output-checked speedup experiments on queries and Python code with a second

Pair optimize is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
shell
Platforms
Claude Code, Codex, Cursor
GitHub stars
10
Last commit
License
MIT
Listing updated

Similar skills

About Pair optimize

Pair-optimize guides an agent through a structured loop for making a concrete, runnable target faster or cheaper. The target can be a SQL or DuckDB query, a hot Python function, an endpoint, or a pipeline step. The agent first records a baseline, profiles to find the real bottleneck, and proposes ranked candidate changes.

Each candidate is implemented and benchmarked against the baseline on the same harness and data, with repeated runs reported as a median and spread. A candidate is kept only if it is measured better and produces output identical to the baseline; otherwise it is reverted or marked unverified. The workflow also covers equivalence checks for SQL, including row-multiplicity traps, and sampling profilers for Python.

The skill is built for a two-agent setup in which a second agent, such as Codex or Claude, re-runs the benchmarks and challenges the numbers in alternating rounds. State is kept in a local .optimize folder, and the skill ships bash helper scripts for handoff and waiting. It expects a repository with runnable code and representative data.

When your agent uses it

Use when the user wants a measured speedup or cost reduction for something concrete and runnable — a DuckDB/SQL query, a hot Python path, an endpoint, a pipeline step — with a second agent (Claude ↔ Codex) challenging the numbers, rather than vibes-based tuning. Also use when invoked as the peer ("Resume the pair-optimize skill"). Hard rule — no optimization is kept unless it is measured faster/cheaper AND produces output identical to the baseline.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 7 files (73 KB) on GitHub on 3 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

Copy the skill folder to ~/.claude/skills/pair-optimize to use it in all your projects:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccomkhj/skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/pair-optimize &&
cp -R "$tmp/pair-optimize" ~/.claude/skills/pair-optimize &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/pair-optimize inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/pair-optimize to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccomkhj/skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/pair-optimize &&
cp -R "$tmp/pair-optimize" ~/.agents/skills/pair-optimize &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/pair-optimize inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/pair-optimize to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccomkhj/skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/pair-optimize &&
cp -R "$tmp/pair-optimize" ~/.cursor/skills/pair-optimize &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/pair-optimize inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/ccomkhj/skills.git --path pair-optimize

Or copy the folder to ~/.gemini/skills/pair-optimize yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/pair-optimize:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccomkhj/skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/pair-optimize &&
cp -R "$tmp/pair-optimize" ~/.copilot/skills/pair-optimize &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/pair-optimize inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/ccomkhj/skills.git

Then copy skills/pair-optimize into your agent's skills folder as pair-optimize. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Baseline measurement first
Records a timed baseline with repeated runs before any change is considered.
Sampling-based bottleneck profiling
Uses a sampling profiler to locate the real hotspot rather than relying on cProfile.
Output equality enforcement
Requires candidate results to match the baseline, including row multiplicity for SQL.
Memory as a cost metric
Measures peak memory and allocation deltas so cheaper, not only faster, changes can be kept.
Peer challenge rounds
A second agent re-runs the benchmarks and audits the measurements and correctness checks.
Shared state and helper scripts
Tracks rounds and status in a local folder and provides bash helpers for handoff and waiting.

Good for

  • Speed up a slow DuckDB or SQL query without changing its results
  • Reduce the runtime of a hot Python function with measured benchmarks
  • Cut the latency of an API endpoint while proving responses stay the same
  • Find out whether a proposed pipeline optimization actually helps
  • Check whether a memory-heavy Python step can stream instead of materializing

Pair optimize FAQ

When does the skill trigger?

When the user wants a measured speedup or cost reduction for something concrete and runnable, with a second agent challenging the numbers. It also triggers when invoked as the peer with a resume instruction.

What is the rule for keeping an optimization?

A change is kept only if it is measured faster or cheaper than the baseline and produces output identical to the baseline. Unmeasurable candidates are labeled unverified and the baseline stays.

What does Pair optimize need to run?

A runnable target and a way to feed it representative data. The skill is built around a Python codebase and uses bash helper scripts; if the target cannot be run, it falls back to clearly marked static analysis.

Does Pair optimize work with every AI client?

The skill is a plain SKILL.md folder and the content does not tie it to specific clients, so it is listed for all supported agents.

How do I install Pair optimize in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/pair-optimize to use it in all your projects, or to .claude/skills/pair-optimize in one project.

Does Pair optimize run scripts?

Yes. It runs shell scripts. No network calls were found in its scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Pair optimize?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

What are the best alternatives to Pair optimize?

The closest alternatives to Pair optimize are Benchmark optimization loop, Performance reasoning, Pair ratchet, Optimize and Optimize loop.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from ccomkhj/skills

  1. Audits AGENTS.md project memory files and proposes targeted, approved updates

    • Open source
    • 10 GitHub stars
    • Developer tools
  2. Builds interactive HTML lessons that teach AI, ML or science concepts through worked cases

    • Open source
    • 10 GitHub stars
    • Education and exam prep
  3. Runs a project and builds an interactive walkthrough from what actually executed

    • Open source
    • 10 GitHub stars
    • Developer tools
  4. Turns a clear improvement target into a measurable Claude Code /goal condition

    • Open source
    • 10 GitHub stars
    • Developer tools
  5. Races Claude against Codex in separate git worktrees until a measurable goal is met

    • Open source
    • 10 GitHub stars
    • Developer tools
  6. Runs a per-turn race between two coding agents and keeps the better diff

    • Open source
    • 10 GitHub stars
    • Developer tools