performance-optimizer

An evidence-based method for finding and fixing slow code. It uses profiling and benchmarks to locate the real bottleneck before changes are made.

In plain words
What is it for?
Use it for high CPU or memory use, slow responses, large data processing, complex algorithms, and performance investigations in Rust and other codebases.
Why use it?
It prevents developers from optimizing the wrong part of a program and makes speed improvements measurable, while considering trade-offs such as memory use and readability.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/firstp1ck/pi-coding-agent-forge/performance-optimizer
Any agent
npx skills add Firstp1ck/pi-coding-agent-forge --skill performance-optimizer
Clone the repo
git clone --depth 1 https://github.com/Firstp1ck/pi-coding-agent-forge

Made for: Claude Code, Codex.

Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,022 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00047 $0.02022
Opus 5 $0.00023 $0.01011
Sonnet 5 $0.00009 $0.00404
Haiku 4.5 $0.00005 $0.00202

Measured 2d ago against content hash e4e35945348a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

performance-optimizer 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 2d 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.

pi-skill-performance-optimizer/skills/performance-optimizer/SKILL.md · 202 lines

How it starts

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

Performance Optimizer

Evidence-based performance optimization. Never optimize without profiling first. Every optimization comes with a trade-off analysis.

Quick Start

Investigate a Performance Issue

  1. Reproduce: Can you reliably reproduce the slowness? What are the conditions?
  2. Measure: Profile to find the actual bottleneck. Don't guess.
  3. Analyze: What's the root cause? Algorithm? I/O? Memory? Contention?
  4. Propose: 2-3 options with trade-offs (speed vs readability, memory vs CPU, etc.)
  5. Verify: After optimization, re-measure to confirm improvement.

The cardinal rule: Profile first, optimize second. Gut feelings about performance are wrong more often than right.


Profiling Toolkits

Rust

Tool Purpose Command
cargo bench Micro-benchmarks (criterion) cargo bench
cargo flamegraph CPU flamegraph visualization cargo flamegraph --bin <name>
perf Linux perf events perf record --call-graph dwarf ./target/release/<bin>
valgrind --tool=callgrind Instruction-level profiling valgrind --tool=callgrind ./target/release/<bin>
cargo bloat Binary size analysis cargo bloat --release
DHAT (via valgrind) Heap allocation profiling valgrind --tool=dhat ./target/release/<bin>

Quick benchmark setup with criterion:

// benches/my_bench.rs
use criterion::{criterion_group, criterion_main, Criterion};

fn benchmark_function(c: &mut Criterion) {
    c.bench_function("descriptive name", |b| {
        b.iter(|| {
            // code to benchmark
        })
    });
}

criterion_group!(benches, benchmark_function);
criterion_main!(benches);

TypeScript / React

Tool Purpose How
React DevTools Profiler Component render timing Browser extension, Profiler tab
Lighthouse Overall web performance Chrome DevTools > Lighthouse
console.time() / console.timeEnd() Quick timing Wrap suspicious code
webpack-bundle-analyzer Bundle size analysis bun run build --analyze
performance.mark() / performance.measure() Web Performance API Precise timing of code sections
React <Profiler> component Programmatic render profiling Wrap components in <Profiler>

Read the full file on GitHub · 202 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. 2d ago First seen · 202 lines · 47 tokens per session scan A e4e35945348a

Subscribe to this mod's changes

performance-optimizer is a skill published in the GitHub repository Firstp1ck/pi-coding-agent-forge (74 stars, last pushed 2d ago), licensed MIT. It adds 47 tokens to every session and 2,022 once invoked, about $0.0002 per session on Opus 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.