Skip to content
Skill

Optimize

Guides the agent to measure code first and keep only proven, behaviour-preserving speed

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
None
Platforms
Claude Code, Codex, Cursor
GitHub stars
19
Last commit
License
Apache-2.0
Listing updated

Similar skills

About Optimize

This skill makes the agent treat performance work as a measured process. When a user asks for code to run faster or use less memory, or when a profiling concern points at a hot path, the agent is directed to record a baseline before changing anything, locate the real call paths of the suspect code, and then keep a change only if a before-and-after measurement shows the improvement with behaviour unchanged. Otherwise the change is reverted.

The instructions include a checklist the agent must satisfy before calling the task done: a baseline recorded first, an after-measurement showing the win in numbers, a passing test suite, and reverts for anything unproven. A reference file covers what to measure, how to capture a baseline, and when a win is large enough to keep.

The skill expects a measurable target and a working test suite. It does not include scripts. It is designed to hand off to the mokata command set, which provides code graph queries and approval gates, and it asks that any behaviour change go through a separate deviation step rather than being slipped in as an optimisation.

When your agent uses it

mokata · Measure first; keep only proven, behaviour-preserving wins.

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 2 files (9 KB) on GitHub on 1 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

This skill ships in the mokata plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add JasGujral/mokata-oss
/plugin install mokata@mostack

Or copy only this skill to ~/.claude/skills/optimize:

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

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

Claude Code docs on skills

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

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

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

Codex docs on skills

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

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

For one project only, put the folder in .cursor/skills/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/JasGujral/mokata-oss.git --path src/mokata/skills/optimize

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

Gemini CLI docs on skills

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

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

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

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/JasGujral/mokata-oss.git

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

The SKILL.md format

What it does

Baseline before changes
The agent must record a measurement of the current code before editing anything.
Hot path confirmation
Guidance to verify where time is actually spent rather than assuming the likely bottleneck.
Before and after proof
Changes are kept only when numbers show a faster or lighter result.
Behaviour preservation
Requires the test suite to stay green and routes any behaviour change through a deviation step.
Revert unproven edits
Unmeasured or unproven changes are rolled back.
Measurement reference
A reference file explains what to measure and when a win is real enough to keep.

Good for

  • Make a slow data processing function faster without changing its output
  • Reduce memory use of a service's request handler and prove the saving
  • Profile a suspected hot path and tune only the code it actually calls
  • Lighten a build or startup step while keeping existing tests passing

Optimize FAQ

When does Optimize trigger?

It engages when the user wants code made faster or lighter and the change can be measured, when profiling points at a hot path, or when a speed or memory gain must be proven before it is kept.

Will Optimize change how my code behaves?

No. It is designed to keep behaviour unchanged. Any change in behaviour is supposed to go through a separate deviation step.

Does Optimize run any scripts?

The skill folder contains no scripts. It relies on the agent following its measurement protocol and on the mokata command set for code navigation.

Does Optimize work without a test suite or a measurable target?

The skill says it should not engage without a way to measure the before and after, and it depends on a green suite.

How do I install Optimize in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/optimize to use it in all your projects, or to .claude/skills/optimize in one project. Or install the mokata plugin, which includes it: /plugin marketplace add JasGujral/mokata-oss, then /plugin install mokata@mostack.

Does Optimize run scripts?

No. It is instructions only, with no 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 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 Optimize?

The closest alternatives to Optimize are Performance reasoning, Performance, Benchmark optimization loop, Frontend perf and Benchmark checklist.

Where this comes from

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

More from JasGujral/mokata-oss

  1. Makes the agent design API contracts first and check callers before changing them

    • Open source
    • 19 GitHub stars
    • Developer tools
  2. Gives an agent NestJS rules for guards, DTO validation, modules and tests

    • Open source
    • 19 GitHub stars
    • Developer tools
  3. Guides an agent through Socratic exploration of an approach before any spec or code

    • Open source
    • 19 GitHub stars
    • Developer tools
  4. Guides an agent to capture live browser console, network and page state for tests

    • Open source
    • 19 GitHub stars
    • Developer tools
  5. Guides the agent to reproduce a reported bug with a failing test before fixing it

    • Open source
    • 19 GitHub stars
    • Developer tools
  6. Guides an agent on CI/CD pipelines, release builds and pinned supply-chain posture

    • Open source
    • 19 GitHub stars
    • Developer tools