agent-briefing
Use when writing a prompt for a subagent or teammate, deciding how much context another agent needs, writing or reading a handoff…
Use when something is reported slow, sluggish, memory-hungry or too large, when a performance budget, Core Web Vitals threshold or latency target is breached, when asked to optimise or make code faster, or when tempted to add a cache, index, async rewrite or micro-optimisation.
Claude Code
$ npx -y skills add NoobyGains/godmode --skill performance-tuning --agent claude-code
Codex
$ npx skills add NoobyGains/godmode --skill performance-tuning -a codex -y
Cursor
$ npx skills add NoobyGains/godmode --skill performance-tuning -a cursor -y
Gemini CLI
$ npx skills add NoobyGains/godmode --skill performance-tuning -a gemini-cli -y
GitHub Copilot
$ npx skills add NoobyGains/godmode --skill performance-tuning -a github-copilot -y
OpenCode
$ npx skills add NoobyGains/godmode --skill performance-tuning -a opencode -y
Windsurf
$ npx skills add NoobyGains/godmode --skill performance-tuning -a windsurf -y
name: performance-tuning description: "Use when something is reported slow, sluggish, memory-hungry or too large, when a performance budget, Core Web Vitals threshold or latency target is breached, when asked to optimise or make code faster, or when tempted to add a cache, index, async rewrite or micro-optimisation."
Intuition about where time goes is wrong more often than it is right. You measure the problem, profile to find where the time or memory actually goes, change one thing, and measure again with the same method. **No measurement, no optimisation: every change is justified by a number before and proven by a number after.**
NO OPTIMISATION WITHOUT A MEASUREMENT PROVING THE PROBLEM
No exceptions. No workarounds. No shortcuts.
**Required:**
**Skip:**
digraph perf {
rankdir=TB;
target [label="1. Target\n(number + percentile)", shape=box];
baseline [label="2. Baseline\n(repeatable measurement)", shape=box];
met [label="Target met?", shape=diamond];
profile [label="3. Profile\n(where does it go?)", shape=box];
hypo [label="4. One hypothesis", shape=box];
change [label="5. Change one thing", shape=box];
remeasure [label="6. Re-measure\n(same method)", shape=box];
better [label="Significant\nimprovement?", shape=diamond];
revert [label="Revert", shape=box];
done [label="7. Record + guard", shape=box];
target -> baseline -> met;
met -> done [label="yes"];
met -> profile [label="no"];
profile -> hypo -> change -> remeasure -> better;
better -> met [label="yes, keep"];
better -> revert [label="no"];
revert -> hypo;
}1. **Set the target.** A number, a percentile and a context: "p95 under 300 ms for `GET /orders` at 50 requests per second", "LCP 2.5 s or less at the 75th percentile on mobile", "bundle under 200 KB gzipped". Without a target there is no end condition; ask the user for one or propose one.
2. **Take a baseline that you can repeat.** Same input data, same environment (production-like, not a debug build), warm-up runs discarded, several runs, and the spread reported, not one number. Save the exact command and its output. Tools are in the table below.
3. **Profile before you guess.** Use a profiler, query plan, trace or bundle analyser to find where the time, memory or bytes go. The evidence is a profile artefact (flame graph, `EXPLAIN ANALYZE` output, trace) that names the hot spot. Usual suspects, in rough order: database queries (N+1, missing index, full scans), network round trips made in sequence, serialisation of oversized payloads, algorithmic complexity, synchronous I/O, and memory churn.
4. **State one hypothesis** that links the hot spot to a change: "The order list makes one query per item (N+1); a single joined query should cut p95 from 920 ms to under 300 ms."
5. **Change one thing.** One change per measurement, behind passing tests, so the effect is attributable. Keep the change on its own commit.
6. **Re-measure with the identical method** and compare against the baseline, including the spread. If the improvement is within the noise or misses the expectation, revert it, even if it "should" help. If it helps, go back to step 2 with the new baseline until the target is met.
7. **Record and guard.** Write the before and after numbers, the method and the commit in the PR description. Add a guard so the regression cannot return silently: a benchmark in CI, a budget check (`godmode:quality-gates`), or a test that asserts the query count.
<!-- Commands checked 2026-10-25 against: https://github.com/sharkdp/hyperfine ; https://github.com/benfred/py-spy ; https://nodejs.org/api/cli.html ; https://pkg.go.dev/cmd/go ; https://www.postgresql.org/docs/current/sql-explain.html ; https://github.com/GoogleChrome/lighthouse -->
| What | Measure | Profile | |---|---|---| | A command or script end to end | `hyperfine --warmup 3 'cmd'` (compare two: `hyperfine 'old' 'new'`) | the language profiler below | | Python | `pytest-benchmark`, `timeit` | `py-spy record -o profile.svg -- python app.py`, `py-spy top --pid <pid>` | | Node.js | `hyperfine`, a benchmark library | `node --cpu-prof app.js` (CPU), `node --heap-prof app.js` (memory); open the files in browser DevTools | | Go | `go test -bench . -benchmem` | `go test -bench . -cpuprofile cpu.out`, then `go tool pprof cpu.out` | | Rust | a benchmark harness such as Criterion | `perf` or a flame-graph tool on Linux | | PostgreSQL query | `EXPLAIN (ANALYZE, BUFFERS) <query>` | the same plan: look for sequential scans, row-estimate errors, loops | | HTTP service under load | a load generator at a fixed request rate, reporting percentiles | APM traces or the language profiler on the server | | Web page | `lighthouse <url>` (lab), field data from real users for Core Web Vitals | browser DevTools Performance panel | | Bundle size | the bundler's analyser or a size-limit check | the same analyser, per module |
`EXPLAIN ANALYZE` executes the statement. For `INSERT`, `UPDATE` or `DELETE`, run it inside a transaction and roll back.
<!-- Core Web Vitals thresholds from
Engineering discipline for AI coding agents: question the request, verify against current docs, plan, build test-first on the cheapest capable model, review with a second model family, prove it before saying done. One repo for Claude Code, Codex, Antigravity, Cursor, Gemini CLI and OpenCode.
Use when writing a prompt for a subagent or teammate, deciding how much context another agent needs, writing or reading a handoff…
Use when a task, feature or bug fix is implemented and before it is committed, merged or handed back to the user, and when the…
Use when about to add or change code in an existing codebase: a new file, module, route, component, service, test, migration,…
Use when about to say that work is done, fixed, passing, working, deployed or ready, before committing, opening or merging a pull…
Use when a reviewed change is about to land on a shared branch, be released or be deployed, and when the user asks for a second…
Use when a written implementation plan is ready to execute in the current session and its tasks are mostly independent, so each…
Use your assigned AgentMail inbox to read email tasks, explicitly send or reply, and check delivery. Provided automatically by…
Create a new Architecture Decision Record with sequential numbering and AgentDB registration