Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Performance Profiling

ASecurity

Use when a ticket is about speed or resource use — a slow endpoint, a hot loop, memory growth, a test suite that takes too long, "make X faster" — and the change must be driven by a measurement, not a hunch, and proven with a before/after number under the same conditions. Invoke for latency, throughput, CPU, memory, bundle size, or startup-time work.

2 stars
0 votes
0 copies
0 views
Added 9/28/2026
ai-agentspythonrustgojavarubykotlinsqlreactnoderefactoring

Works with

mcp

Security Analysis

A100/100

Scanned 9/29/2026

$npx -y skills add tmj-90/gaffer --skill performance-profiling --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Performance Profiling?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Performance Profiling
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tmj-90-performance-profiling/badge)](https://www.skillsdirectory.com/skills/tmj-90-performance-profiling)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: performance-profiling
description: Use when a ticket is about speed or resource use — a slow endpoint, a hot loop, memory growth, a test suite that takes too long, "make X faster" — and the change must be driven by a measurement, not a hunch, and proven with a before/after number under the same conditions. Invoke for latency, throughput, CPU, memory, bundle size, or startup-time work.
stack: [node, python, go, java, rust, csharp, kotlin, ruby, react, web]
area: backend
---

# 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.

## Done when

Baseline and after numbers exist for the same command under the same conditions with
variance reported, the target is met (or the shortfall is stated with the current
profile), the suite passes, a regression guard is in place, and each acceptance
criterion has evidence via the `record-evidence` skill (command, baseline, profile top
entries, change, after numbers).

## Anti-patterns

- Optimising code the profile shows is cold; "it looked slow".
- Benchmarks on ten rows, cold caches, or a single run; closed-loop latency tests.
- Averaging percentiles across runs or hosts (merge histograms instead).
- Caches with no invalidation story or no bound on size.
- Timing assertions that make CI flaky.

## Review checklist

- [ ] Metric, percentile, load and target stated before the change.
- [ ] Profile evidence identifies the fixed hotspot.
- [ ] Before/after from the same harness with repeated runs and variance.
- [ ] New code paths (cache, batch, parallelism) tested, including concurrent use.
- [ ] A deterministic regression guard exists.

## Capture lore

This skill is one of the places durable, reusable knowledge naturally surfaces:
**While profiling you learn where this repo is actually hot and what a change to that path costs in measured terms.** That kind of fact is *lore*. Capture it via the **lore-capture
protocol in your brief** (`CLAUDE.factory.md`, step 11 "Memory contribution"):
call the Memory MCP `suggest_lore` once at the close of your work — reusable
conventions, gotchas, decisions, and boundaries only, never per-ticket trivia.

Attribution

tmj-90tmj-90
View sourceSee grades on GitHubMore from tmj-90 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698461 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →