Token导航 LogoToken导航

Agent Skill · 研究检索

codspeed-optimize(代码速度优化)

codspeed-optimize 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

codspeed-optimize 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为调用外部服务;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 14,148。

总安装 8,788周安装 359GitHub Stars 155下载 2,843核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:codspeed-optimize(代码速度优化)
来源仓库:https://github.com/codspeedhq/codspeed
仓库路径:skills/codspeed-optimize
安装命令:
npx skills add https://github.com/codspeedhq/codspeed --skill codspeed-optimize
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/codspeedhq/codspeed --skill codspeed-optimize

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

codspeed-optimize 通过 CodSpeed 基准测试和火焰图分析迭代优化代码性能。必须使用 codspeed run 执行所有测量,禁止直接运行原生 benchmark。工作循环为测量-分析-修改-再测量,直至无法进一步优化为止。安装前请确认项目是否已配置 CodSpeed 集成和基准测试套件。

适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/codspeed-optimize

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/codspeedhq/codspeed --skill codspeed-optimize;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要调用外部服务,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

codspeed-optimize 怎么安装?

在终端执行 npx skills add https://github.com/codspeedhq/codspeed --skill codspeed-optimize。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

codspeed-optimize 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

codspeed-optimize 需要什么权限?

权限级别是调用外部服务。该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

codspeed-optimize 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

codspeed-optimize 用的人多吗?

公开数据是累计安装 8,788 次,近一周安装 359 次,下载 2,843 次,GitHub 155 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

codspeed-optimize 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
codspeed-optimize

代码速度优化 · 本页

8,788155调用外部服务未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

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.
  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.):

# Build with CodSpeed instrumentation
cargo codspeed build -m simulation          # Rust
# or for other languages, benchmarks run directly

# Run benchmarks
codspeed run -m simulation -- <bench_command>

For projects using the exec harness or codspeed.yml:

codspeed run -m simulation
# or
codspeed exec -m simulation -- <command>

Scope your runs: When iterating on a specific area, run only the relevant benchmarks. This dramatically speeds up the feedback loop:

# Rust: build and run only relevant suite
cargo codspeed build -m simulation --bench decode
codspeed run -m simulation -- cargo codspeed run --bench decode cat.jpg

# codspeed.yml: individual benchmark
codspeed exec -m simulation -- ./my_binary

Save the run ID from the output — you'll need it for comparisons.

Step 2: Analyze with flamegraphs

Use the CodSpeed MCP tools to understand where time is spent:

  1. List runs to find your baseline run ID:

- Use list_runs with appropriate filters (branch, event type)

  1. Query flamegraphs on the hottest benchmarks:

- Use query_flamegraph with the run ID and benchmark name - Start with depth_limit: 5 to get the big picture - Use root_function_name to zoom into hot subtrees - Look for: - Functions with high self time (these are the actual bottlenecks) - Instruction-bound vs cache-bound vs memory-bound breakdown - Unexpected functions appearing high in the profile (redundant work, unnecessary abstractions)

  1. Identify optimization targets: Rank functions by self time. The top 2-3 are your targets. Consider:

- Can this computation be avoided entirely? - Can the algorithm be improved (O(n) vs O(n^2))? - Are there unnecessary allocations in hot loops? - Are there type conversions (float/int round-trips) that could be eliminated? - Could data layout be improved for cache locality? - Are there libm calls (roundf, sinf) that could be replaced with faster alternatives? - Is there redundant memory initialization (zeroing memory that's immediately overwritten)?

Step 3: Make targeted changes

Apply optimizations one at a time. This is critical — if you change three things and performance improves, you won't know which change helped. If it regresses, you won't know which one hurt.

Important constraints:

  • Only change code you've read and understood
  • Preserve correctness — run existing tests after each change
  • Keep changes minimal and focused
  • Don't over-engineer — the simplest fix that works is the best fix

Common optimization patterns by bottleneck type:

  • Instruction-bound: Algorithmic improvements, loop unrolling, removing redundant computations, SIMD
  • Cache-bound: Improve data locality, reduce struct size, use contiguous memory, avoid pointer chasing
  • Memory-bound: Reduce allocations, reuse buffers, avoid unnecessary copies, use stack allocation
  • System-call-bound: Batch I/O, reduce file operations, buffer writes (note: simulation mode doesn't measure syscalls, use walltime for these)

Step 4: Re-measure and compare

After each change, rebuild and rerun the relevant benchmarks:

# Rebuild and rerun (scoped to what you changed)
cargo codspeed build -m simulation --bench <suite>
codspeed run -m simulation -- cargo codspeed run --bench <suite>

Then compare against the baseline using the MCP tools:

  • Use compare_runs with base_run_id (baseline) and head_run_id (after your change)
  • Check for:

- Improvements in your target benchmarks - Regressions in other benchmarks (shared code paths can affect unrelated benchmarks) - The magnitude of the change — is it significant?

Step 5: Report and decide next steps

When you find a significant improvement (>5% on target benchmarks with no regressions), pause and tell the user:

  • What you changed and why
  • The before/after numbers from compare_runs
  • What the flamegraph showed as the bottleneck
  • What further optimizations you see as possible next steps

Then ask if they want you to continue optimizing or if they're satisfied.

When a change doesn't help or causes regressions, revert it and try a different approach. Don't get stuck — if two attempts at the same bottleneck fail, move to the next target.

Step 6: Validate with walltime

Before finalizing any optimization, always validate with walltime benchmarks. Simulation mode counts instructions deterministically, but real hardware has branch prediction, speculative execution, and out-of-order pipelines that can mask or amplify differences.

# Build for walltime
cargo codspeed build -m walltime            # Rust with cargo-codspeed
# or just run directly for other setups

# Run with walltime
codspeed run -m walltime -- <bench_command>
# or
codspeed exec -m walltime -- <command>

Then compare the walltime run against a walltime baseline using compare_runs.

Patterns that often show up in simulation but NOT walltime:

  • Iterator adapter overhead (e.g., .take(n) to [..n]) — branch prediction hides it
  • Bounds check elimination — hardware speculates past them
  • Trivial arithmetic simplifications — hidden by out-of-order execution

Patterns that reliably help in both modes:

  • Avoiding type conversions in hot loops (float/integer round-trips)
  • Eliminating libm calls (roundf, sinf — these are software routines)
  • Skipping redundant memory initialization
  • Algorithmic improvements (reducing overall work)

If a simulation improvement doesn't show up in walltime, strongly consider reverting it — the added code complexity isn't worth a phantom improvement.

Step 7: Continue or finish

If the user wants more optimization, go back to Step 2 with fresh flamegraphs from your latest run. The profile will have shifted now that you've addressed the top bottleneck, revealing new targets.

Keep iterating until:

  • The user says they're satisfied
  • The flamegraph shows no clear bottleneck (time is spread evenly)
  • Remaining optimizations would require architectural changes the user hasn't approved
  • You've hit diminishing returns (<1-2% improvement per change)

Language-specific notes

Rust

  • Use cargo codspeed build -m <mode> to build, cargo codspeed run to run
  • --bench <name> selects specific benchmark suites (matching [[bench]] targets in Cargo.toml)
  • Positional filter after cargo codspeed run matches benchmark names (e.g., cargo codspeed run cat.jpg)
  • Frameworks: criterion, divan, bencher (all work with cargo-codspeed)

Python

  • Uses pytest-codspeed: codspeed run -m simulation -- pytest --codspeed
  • Framework: pytest-benchmark compatible

Node.js

  • Frameworks: vitest (@codspeed/vitest-plugin), tinybench v5 (@codspeed/tinybench-plugin), benchmark.js (@codspeed/benchmark.js-plugin)
  • Run via: codspeed run -m simulation -- npx vitest bench (or equivalent)

Go

  • Built-in: codspeed run -m simulation -- go test -bench.
  • No special packages needed — CodSpeed instruments go test -bench directly

C/C++

  • Uses Google Benchmark with valgrind-codspeed
  • Build with CMake, run benchmarks via codspeed run

Any language (exec harness)

  • Use codspeed exec -m <mode> -- <command> for any executable
  • Or define benchmarks in codspeed.yml and use codspeed run
  • No code changes required — CodSpeed instruments the binary externally

MCP tools reference

You have access to these CodSpeed MCP tools:

  • list_runs: Find run IDs. Filter by branch, event type. Use this to find your baseline and latest runs.
  • compare_runs: Compare two runs. Shows improvements, regressions, new/missing benchmarks with formatted values. This is your primary tool for measuring impact.
  • query_flamegraph: Inspect where time is spent. Parameters:

- run_id: which run to look at - benchmark_name: full benchmark URI - depth_limit: call tree depth (default 5, max 20) - root_function_name: re-root at a specific function to zoom in

  • list_repositories: Find the repository slug if needed
  • get_run: Get details about a specific run

Guiding principles

  • Everything goes through CodSpeed. Never run benchmarks outside of the CodSpeed CLI. Never quote timing numbers from raw benchmark output. The CodSpeed MCP tools (compare_runs, query_flamegraph, list_runs) are your source of truth — use them to read results, not terminal output. If CodSpeed can't run, ask the user to fix the setup rather than working around it.
  • Measure first, optimize second. Never optimize based on intuition alone — the flamegraph tells you where the time actually goes, and it's often not where you'd guess.
  • One change at a time. Isolated changes make it clear what helped and what didn't.
  • Correctness over speed. Always run tests. A fast but broken program is useless.
  • Simulation for iteration, walltime for validation. Simulation is deterministic and fast for feedback. Walltime is the ground truth. Both run through CodSpeed.
  • Know when to stop. Diminishing returns are real. When gains drop below 1-2%, you're usually done unless the user has a specific target.
  • Be transparent. Show the user your reasoning, the numbers, and the tradeoffs. Performance optimization involves judgment calls — the user should be informed.

平台分布

Codex

33.09%
按下载量换算941

Claude

30.73%
按下载量换算874

Cursor

17.69%
按下载量换算503

Gemini CLI

9.28%
按下载量换算264

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

调用外部服务

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills