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.
npx claudepluginhub tmdgusya/engineering-discipline --plugin engineering-disciplineThis skill uses the workspace's default tool permissions.
1. **You can't tell where a program is going to spend its time.** Bottlenecks occur in surprising places. Don't guess — prove it.
Guides performance tuning for slow code, timeouts, OOM errors, high CPU/memory via mandatory profiling, 7-step decision tree, and expensive operations reference.
Autonomously optimize code for performance using CodSpeed benchmarks, flamegraph analysis, and iterative improvement. Use this skill whenever the user wants to make code faster, reduce CPU usage, optimize memory, improve throughput, find performance bottlenecks, or asks to 'optimize', 'speed up', 'make faster', 'reduce latency', 'improve performance', or points at a CodSpeed benchmark result wanting improvements. Also trigger when the user mentions a slow function, a regression, or wants to understand where time is spent in their code.
Guides performance optimization with principles like measure first, find bottlenecks, know when to stop, and evaluate tradeoffs. Useful for slow code, latency, profiling, or benchmarking discussions.
Share bugs, ideas, or general feedback.
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: