# Optimize

> Optimize is an open-source agent skill for developer tools. Guides the agent to measure code first and keep only proven, behaviour-preserving speed. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/JasGujral/mokata-oss/tree/main/src/mokata/skills/optimize
- **Repository:** https://github.com/jasgujral/mokata-oss
- **GitHub stars:** 19
- **License:** Apache-2.0
- **Skill name:** optimize
- **Collection:** https://github.com/JasGujral/mokata-oss
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-01

## About

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.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/JasGujral/mokata-oss/tree/HEAD/src/mokata/skills/optimize)
- [License: Apache-2.0](https://github.com/JasGujral/mokata-oss/tree/HEAD/src/mokata/skills/optimize)

## Features

- **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

## Install

### Claude Code

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

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

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

```sh
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.

### Codex

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

```sh
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.

### Cursor

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

```sh
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.

### Gemini CLI

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

```sh
gemini skills install https://github.com/JasGujral/mokata-oss.git --path src/mokata/skills/optimize
```

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

### VS Code

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

```sh
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.

### Other agents

Get the folder:

```sh
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.

## 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.

## Alternatives

- [Performance reasoning](https://ai-powered.com/skills/performance-reasoning): Performance reasoning is an open-source agent skill for developer tools.
- [Performance](https://ai-powered.com/skills/performance): Performance is an open-source agent skill for developer tools.
- [Benchmark optimization loop](https://ai-powered.com/skills/benchmark-optimization-loop): Benchmark optimization loop is an open-source agent skill for developer tools.
- [Frontend perf](https://ai-powered.com/skills/frontend-perf): Frontend perf is an open-source agent skill for developer tools.
- [Benchmark checklist](https://ai-powered.com/skills/benchmark-checklist): Benchmark checklist is an open-source agent skill for developer tools.
- [Rea analysis optimization](https://ai-powered.com/skills/rea-analysis-optimization): Rea analysis optimization is an open-source agent skill for developer tools.
- [Develop](https://ai-powered.com/skills/develop): Develop is an open-source agent skill for developer tools.
- [Performance](https://ai-powered.com/skills/performance-daveebbelaar): Performance is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/optimize-jasgujral
