codspeed-optimize

codspeed-optimize is a skill for Claude Code from CodSpeedHQ/codspeed. It costs 113 tokens per session (2,690 once invoked), scanned A, original, Apache-2.0.

A coding workflow for making programs run faster, using CodSpeed benchmarks and flamegraphs, which show where a program spends its time.

In plain words
What is it for?
Use it to optimize a function, module, or benchmark suite. It measures performance, analyzes the results, applies changes, and measures again.
Why use it?
It replaces guesswork with repeated measurements, helping identify performance bottlenecks and check whether changes actually improve speed, CPU use, or memory use.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the codspeed plugin — 3 skills, 1 MCP server shipped together

Good fit Use it to optimize a function, module, or benchmark suite. It measures performance, analyzes the results, applies changes, and measures again.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/codspeedhq/codspeed/codspeed-optimize
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add CodSpeedHQ/codspeed --skill codspeed-optimize
Clone the repo
git clone --depth 1 https://github.com/CodSpeedHQ/codspeed

Made for: Claude Code.

Or install codspeed, the plugin that ships this one along with the rest of its 3 skills, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for codspeed-optimize

README.md
[![agentmods](https://agentmods.dev/badge/skills/codspeedhq/codspeed/codspeed-optimize/github.svg)](https://agentmods.dev/skills/codspeedhq/codspeed/codspeed-optimize)
Your own site
<a href="https://agentmods.dev/skills/codspeedhq/codspeed/codspeed-optimize"><img src="https://agentmods.dev/badge/skills/codspeedhq/codspeed/codspeed-optimize/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for codspeed-optimize

Your own site · 80×15
<a href="https://agentmods.dev/skills/codspeedhq/codspeed/codspeed-optimize"><img src="https://agentmods.dev/badge/skills/codspeedhq/codspeed/codspeed-optimize.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 113 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,690 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 15 Nov 2026
  • Snyk pass 14 Nov 2026
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium MCP Rug Pull · line 192
    npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.
    Fix: Pin the version: npx @scope/[email protected]
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00113 $0.02690
Opus 5.5 $0.00045 $0.01076
Sonnet 5.5 $0.00023 $0.00538
Haiku 4.5 $0.00011 $0.00269

Measured 21d ago against content hash 613f69c26426, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

codspeed-optimize scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 21d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/codspeed-optimize/SKILL.md · 227 lines

How it starts

The opening of the file, as written. The whole thing — 227 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Optimize

You are an autonomous performance engineer. Your job is to iteratively optimize code using CodSpeed benchmarks and flamegraph analysis. You work in a loop: measure, analyze, change, re-measure, compare — and you keep going until there's nothing left to gain or the user tells you to stop.

All measurements must go through CodSpeed. Always use the CodSpeed CLI (codspeed run, codspeed exec) to run benchmarks — never run benchmarks directly (e.g., cargo bench, pytest-benchmark, go test -bench) outside of CodSpeed. The CodSpeed CLI and MCP tools are your single source of truth for all performance data. If you're unable to run benchmarks through CodSpeed (missing auth, unsupported setup, CLI errors), ask the user for help rather than falling back to raw benchmark execution. Results outside CodSpeed cannot be compared, tracked, or analyzed with flamegraphs.

Before you start

  1. Understand the target: What code does the user want to optimize? A specific function, a whole module, a benchmark suite? If unclear, ask.

  2. Understand the metric: CPU time (default), memory, walltime? The user might say "make it faster" (CPU/walltime), "reduce allocations" (memory), or be specific.

  3. Check for existing benchmarks: Look for benchmark files, codspeed.yml, or CI workflows. If no benchmarks exist, stop here and invoke the setup-harness skill to create them. You cannot optimize what you cannot measure — setting up benchmarks first is a hard prerequisite, not a suggestion. If a benchmark is noisy, flagged by CodSpeed, or does not measure the target code, fix it with the codspeed-write-benchmarks skill before optimizing.

  4. Check CodSpeed auth: Run codspeed auth login if needed. The CodSpeed CLI must be authenticated to upload results and use MCP tools.

The optimization loop

Step 1: Establish a baseline

Build and run the benchmarks to get a baseline measurement. Use simulation mode for fast iteration:

For projects with CodSpeed integrations (Rust/criterion, Python/pytest, Node.js/vitest, etc.):

Read the full file on GitHub · 227 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 21d ago Changed 613f69c26426
  2. 3mo ago First seen · 227 lines · 113 tokens per session scan A 01023deaa74c

Subscribe to this mod's changes

codspeed-optimize is a skill published in the GitHub repository CodSpeedHQ/codspeed (396 stars, last pushed today), licensed Apache-2.0. It adds 113 tokens to every session and 2,690 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

codspeed-optimize compared with skills from other repositories

codspeed-optimize next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
codspeed-optimizeCodSpeedHQ/codspeedSkill396todayApache-2.0A113Claude Code
Context ManagementRaidriar7170/hermes-skillevalSkill292mo agoMITA15Claude Code, Codex
reflectgithub/gh-awSkill5.8ktodayMITA66Claude Code, Codex
tiered-memorygithub/gh-awSkill5.8ktodayMITA20Claude Code, Codex
reskillgithub/gh-awSkill5.8ktodayMITA12Claude Code, Codex
napgithub/gh-awSkill5.8ktodayMITA15Claude Code, Codex
hotpath_init_grafanapawurb/hotpath-rsSkill1.9k12d agoMITA109Claude Code