Enforces Rob Pike's 5 rules for measurement-driven performance optimization, preventing premature code changes without profiling data. Activates on speed complaints or optimization requests.
How this skill is triggered — by the user, by Claude, or both
Slash command
/engineering-discipline:rob-pikeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
1. **You can't tell where a program is going to spend its time.** Bottlenecks occur in surprising places. Don't guess — prove it.
Before asking "have you measured?", determine whether measurement is even possible right now.
Scan the codebase for signs of existing instrumentation:
Then ask the user:
The goal is NOT to prescribe a specific tool — Claude already knows the right profiling approach for the language. The goal is to make sure measurement exists before any optimization conversation continues. If there is nothing to measure with, the first action is adding instrumentation, not changing code.
Stop and ask these questions in order:
When you catch yourself or the user doing any of these, STOP and redirect:
| Impulse | Rule violated | Response |
|---|---|---|
| "This loop looks slow, let me optimize it" | Rule 1 | Have you profiled? The bottleneck may be elsewhere entirely. |
| "Let me add a cache here" | Rule 2 | Measure first. Does this path actually dominate runtime? |
| "Let me use a B-tree / trie / skip list" | Rule 3 | What's n? If small, a sorted slice + binary search wins. |
| "Let me implement a custom allocator" | Rule 4 | Start simple. Measure. Only get fancy if data forces you. |
| "The algorithm is O(n²), needs fixing" | Rule 3 | What's n? O(n²) with n=100 is 10μs. Measure first. |
| "Let me parallelize this" | Rule 2 | Is this actually CPU-bound? Measure. Often it's I/O. |
Proceed with optimization only when ALL of these are true:
npx claudepluginhub tmdgusya/engineering-discipline --plugin engineering-disciplineMeasures and optimizes performance with data-driven profiling, identifying bottlenecks like N+1 queries, missing indexes, and synchronous I/O. Triggers on performance, speed, latency, profiling, or benchmark keywords.
Guides measure-first optimization: profile to identify hot spots, apply algorithm/data-structure improvements before micro-optimizations, and validate each change to prevent regression.
Autonomously optimizes code performance using CodSpeed benchmarks, flamegraph analysis, and iterative improvement. Activates on optimization requests, slow functions, or regression mentions.