> ## Documentation Index
> Fetch the complete documentation index at: https://codspeed.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Skills

> Instruction sets that teach AI coding assistants how to set up benchmarks and optimize performance with CodSpeed.

Agent skills are instruction sets that teach AI coding assistants how to perform
specific tasks with CodSpeed. They work alongside the [MCP server](/ai/mcp) —
the MCP server provides access to your performance data, while skills provide
the know-how to act on it.

<Note>
  Skills require the [CodSpeed MCP server](/ai/mcp) to be configured. Set up the
  MCP server first if you have not already.
</Note>

## Installation

<Tabs>
  <Tab title="Claude Code" icon="https://mintcdn.com/codspeed/4PzkxvwqEer7fV5z/assets/icons/claude.svg?fit=max&auto=format&n=4PzkxvwqEer7fV5z&q=85&s=f60787f3ce3f0d36f7edc3b7edd49782" width="24" height="24" data-path="assets/icons/claude.svg">
    Install the plugin from the official Claude plugins marketplace:

    ```sh theme={null}
    /plugin install codspeed@claude-plugins-official
    ```

    <Tip>
      The plugin installs both the [MCP server](/ai/mcp) and agent skills
      automatically.
    </Tip>
  </Tab>

  <Tab title="Other agents">
    Skills are available as markdown files in the
    [CodSpeed repository](https://github.com/CodSpeedHQ/codspeed/tree/main/skills).
    Copy the skill files into your agent's skill directory.
  </Tab>
</Tabs>

### Alternative: auto-detect with `npx skills`

If your agent supports it, you can use
[`npx skills`](https://github.com/vercel-labs/skills) to automatically detect
installed agents and configure them:

```sh theme={null}
npx skills add CodSpeedHQ/codspeed
```

## Available skills

### Optimize ([`codspeed-optimize`](https://github.com/CodSpeedHQ/codspeed/blob/main/skills/codspeed-optimize/SKILL.md))

Turns your AI assistant into an autonomous performance engineer. It works in a
loop and keeps iterating until there is nothing left to gain.

1. **Measure** — run the benchmarks to establish a baseline.
2. **Analyze** — query flamegraphs to identify hot spots and bottlenecks.
3. **Optimize** — make a targeted change to the source code.
4. **Re-measure and compare** — run benchmarks again and compare against the
   baseline. Repeat until no further gains.

**Example prompts:**

> "Make my `parse_input` function faster."

> "Find the bottleneck in `bench_serialize` and fix it."

> "Optimize the hot path in this module."

> "There's a regression on `feat/parser` — investigate."

### Setup Harness ([`codspeed-setup-harness`](https://github.com/CodSpeedHQ/codspeed/blob/main/skills/codspeed-setup-harness/SKILL.md))

Analyzes your project, picks the right benchmarking framework for your language,
writes representative benchmarks, and verifies the setup works through the
CodSpeed CLI. Supports Rust, Python, Node.js, Go, C/C++, and any language via
the exec harness.

The Optimize skill relies on benchmarks to measure performance. If your project
does not have benchmarks yet, the Setup Harness skill will be triggered
automatically to create them.

**Example prompts:**

> "Add benchmarks to this project."

> "Set up CodSpeed for my Rust project."

> "Benchmark this function."
