# rust-performance

Teaches an agent a measured workflow for Rust performance work. Use it when code runs slow, memory grows, or the binary ships too large.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 1 install · ★ 224 repo stars
- Author: NeverSight
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/NeverSight/learn-skills.dev/tree/HEAD/data/skills-md/full-stack-skills/rust-skills/rust-performance/SKILL.md
- Updated: 2026-10-29
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/rust-performance

## What it does

The skill pushes the agent to work from evidence. It writes down the contract first: workload, inputs, hardware, toolchain, build profile, success metrics. Then it builds a reproducible baseline, profiles the hot spot, and changes one thing at a time.

Tooling spans Criterion and Divan for microbenchmarks, samply and cargo-flamegraph for CPU profiles, DHAT for allocation analysis. Separate reference files cover regression gates, CPU and latency profiling, memory, binary size, and compile time.

Optimizing debug builds or synthetic inputs is off-limits unless they match the real problem. The skill also refuses unsafe, custom allocators, SIMD, and lock-free structures until plain fixes run out. Profiles and heap dumps may contain sensitive data, so storage and upload policy needs a check before sharing.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add NeverSight/learn-skills.dev --skill rust-performance -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/rust-performance/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/rust-performance/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add NeverSight/learn-skills.dev --skill rust-performance -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/rust-performance/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add NeverSight/learn-skills.dev --skill rust-performance -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/rust-performance/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install NeverSight/learn-skills.dev data/skills-md/full-stack-skills/rust-skills/rust-performance
```

2. **Manually: put the files in place**
- File: `.github/skills/rust-performance/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add NeverSight/learn-skills.dev --skill rust-performance -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/NeverSight/learn-skills.dev --path data/skills-md/full-stack-skills/rust-skills/rust-performance
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/rust-performance/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add NeverSight/learn-skills.dev --skill rust-performance -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/NeverSight/learn-skills.dev/tree/HEAD/data/skills-md/full-stack-skills/rust-skills/rust-performance/SKILL.md

## When to use it
- find where Rust code burns CPU time
- spot retained allocations with DHAT
- shrink a binary using cargo-bloat
- set a regression gate on a benchmark
- separate p50 from p95/p99 latency

## Example prompts
- Profile the slow endpoint in `src/api/handlers.rs`, build a baseline, and find the dominant cost
- Run the Criterion benchmark before and after replacing clone with borrow, report variance and p95
- Break down the binary with cargo-bloat and tell me which features drive most of the size

## Similar
- [rust-profiling](https://affpapa.org/en/nevibecode/skills/rust-profiling.md) — skill · 751 installs
- [m10-performance](https://affpapa.org/en/nevibecode/skills/m10-performance.md) — skill · 4000 installs
- [golang-performance](https://affpapa.org/en/nevibecode/skills/golang-performance.md) — skill · 44500 installs
- [python-performance-optimization](https://affpapa.org/en/nevibecode/skills/python-performance-optimization.md) — skill · 35675 installs
- [go-performance](https://affpapa.org/en/nevibecode/skills/go-performance.md) — skill · 1300 installs
- [java-performance](https://affpapa.org/en/nevibecode/skills/java-performance.md) — skill · 490 installs

From the same set: [neversight/learn-skills.dev](https://affpapa.org/en/nevibecode/by/neversight/learn-skills.dev.md) — 6 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
