performance-profiling

performance-profiling is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 87 tokens per session (1,429 once invoked), scanned A, original, Apache-2.0.

A measurement-led process for finding and fixing slow code or excessive resource use. It records a baseline, profiles the relevant work, makes a change, and compares the result under the same conditions.

In plain words
What is it for?
It helps investigate slow requests, hot loops, long-running tests, memory growth, database work, and large browser bundles. It guides the choice of benchmarks, load tests, CPU profiles, allocation profiles, or query timings.
Why use it?
Optimising from guesswork can change the wrong code or make little difference. Controlled measurements show whether the endpoint, job, test suite, CPU use, memory use, or bundle actually improved.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps investigate slow requests, hot loops, long-running tests, memory growth, database work, and large browser bundles. It guides the choice of benchmarks, load tests, CPU profiles, allocation profiles, or query timings.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tmj-90/gaffer/performance-profiling
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 tmj-90/gaffer --skill performance-profiling
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

Made for: Claude Code, Codex.

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 performance-profiling

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/performance-profiling/github.svg)](https://agentmods.dev/skills/tmj-90/gaffer/performance-profiling)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/performance-profiling"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/performance-profiling/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 performance-profiling

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmj-90/gaffer/performance-profiling"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/performance-profiling.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 87 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,429 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.
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.00087 $0.01429
Opus 5.5 $0.00035 $0.00572
Sonnet 5.5 $0.00017 $0.00286
Haiku 4.5 $0.00009 $0.00143

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

Security

Grade A, and why

performance-profiling 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 16d 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.

runner/skills/performance-profiling/SKILL.md · 94 lines

How it starts

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

Profile before you optimise

Performance work without a measurement is refactoring with a story attached. Reproduce the slowness, profile it, fix what the profile points at, and show the same measurement afterwards. Most wins come from doing less work (fewer queries, allocations, bytes), not cleverer code. Sources: Brendan Gregg (USE method, flame graphs); Gil Tene on coordinated omission; Google SRE book ch. 6 (percentiles, not averages); the benchstat/hyperfine documentation on repeated runs and variance.

Steps

  1. Define the number and the target. Metric, percentile, load and environment: "p95 of GET /orders ≤ 200 ms at 50 req/s open-model load", "job wall time", "heap after 10k iterations", "gzipped bundle bytes". Averages hide tails; report p50/p95/p99. Write it down before changing code; the acceptance criterion should be this number. Call search_lore for known hot spots and past decisions.
  2. Build a reproducible harness. Use the repo's tooling (autocannon, k6, wrk2, pytest-benchmark, go test -bench, hyperfine, JMH, criterion): fixed inputs, realistic data volume, warm-up, and enough repetitions to see variance (≥ 10 runs or the tool's statistical mode). For latency under load use an open-model / constant-arrival-rate generator (k6 constant-arrival-rate, wrk2 -R): closed-loop tools that wait for each response under-report tail latency (coordinated omission). Record the exact command and machine. Use only tools already installed; never install one (npm/pip installs are hook-blocked; go install, cargo install, uv/pipx and a fetching npx are not blocked but are equally forbidden; node_modules is shared). If a needed tool is missing, say so in the evidence and use what exists.
  3. Find the bottleneck resource first. For each resource (CPU, memory, disk, network, connection pools, locks) check utilisation, saturation and errors (USE). A request waiting on a pool or a lock is not a CPU problem.
  4. Profile, do not guess. CPU: node --cpu-prof, py-spy record, go tool pprof, perf + flame graph, async-profiler. Memory: heap snapshots / allocation profiles taken at two points to see what grows. Database: query log with timings and per-request query count. Frontend: the bundler's analyzer. Fix the widest frame in the flame graph; if the profile disagrees with your hunch, the profile is right.
  5. Fix the top item with the least clever change. Usual order: remove an N+1 (batch or join), add the index the plan wants (the sql-query-performance skill), stop serialising unused data, stream instead of buffering, cache a pure or hot read (the caching-strategy skill), move work off the request path (the background-jobs skill). Algorithmic rewrites and micro-optimisations last.
  6. Keep behaviour identical, including under concurrency. Run the full suite. A new cache, batch boundary, memoisation or parallelism is a new code path: test it directly, including concurrent callers (stale reads, lost updates, shared mutable state; the concurrency-and-async skill). Never drop a validation, authorisation check or lock to win time.
  7. Measure again under identical conditions and compare distributions, not single runs: same command, data and machine, repeated; use the tool's comparison (benchstat old.txt new.txt, hyperfine with several commands) and report the change with its variance. A difference within noise is not a result. If the target is not met, say so and what the profile shows now.
  8. Guard the win with a deterministic check. Prefer assertions that do not flake on shared CI hardware: query count per request, allocation count, bundle-size budget, algorithmic complexity on a fixed input. Wall-clock assertions only with generous margins or on dedicated runners.

Read the full file on GitHub · 94 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. 16d ago Changed · +29 lines 45eea5774602
  2. 19d ago First seen · 65 lines · 87 tokens per session scan A 7f079e8b5781

Subscribe to this mod's changes

performance-profiling is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 87 tokens to every session and 1,429 once invoked, about $0.0003 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-09-28.