performance-optimization

Optimizes code performance through profile-driven measurement and baseline comparison loops.

Updated Apr 6, 2026
One-click install
npx skills add https://github.com/toderian/project_template --skill performance-optimization-toderian
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: performance-optimization
Source: https://github.com/toderian/project_template/tree/main/plugins/agents-core/skills/performance-optimization
Command: npx skills add https://github.com/toderian/project_template --skill performance-optimization-toderian

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Teams often waste effort optimizing code that is not the real bottleneck, or ship changes that never measurably improve performance. This Skill enforces a measure-first discipline: profile the actual hot path, record a baseline, change one thing at a time, and re-measure before keeping any optimization. ## Core Features & Use Cases - Profile-Guided Hot Path Detection: Reproduce a representative workload and use CPU, allocation, I/O, or query-time profiling to find where time actually goes instead of guessing. - Baseline-Verified Change Loop: Record a baseline number, hypothesize the cause, change one variable, and re-measure against the baseline, reverting anything that does not move the metric. - Correctness and Audit Trail: Keep tests green, add tests for behavior the optimization could affect, and record baseline and post-change numbers in the commit, PR, or task. - Use Case: A user asks why an API endpoint is slow. The Skill guides profiling to discover 70% of wall time in N+1 queries, fixes the query shape, and verifies the latency drop against the recorded baseline. ## Quick Start Ask the agent to profile this slow endpoint and optimize the real hot path using the performance-optimization skill.

Frequently Asked Questions about performance-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize slow code without guessing?

Profile first to find the real hot path, record a baseline number, then change one thing at a time and re-measure against that baseline. Revert any change that does not meaningfully move the metric, since unverified optimizations add complexity without payoff.

What is the difference between performance optimization and diagnosing a regression?

Optimization improves a known, measured hot path against a baseline. Diagnosing a regression means finding what changed when something got slower; use a diagnosis workflow to localize the regression first, then this optimization loop to improve the identified hot path.

Which optimizations should I try first for slow applications?

Start with algorithmic and I/O-shape fixes such as N+1 queries, missing indexes, redundant serialization, and unbounded allocation. These typically dwarf micro-optimizations, so exhaust them before hand-tuning inner loops.

Why should I revert an optimization that does not improve the metric?

A change that does not move the measured metric is complexity with no payoff. Keeping it makes the code harder to maintain without any verified benefit, so the discipline requires reverting unverified changes.

When should I write an ADR for a performance optimization?

Write an architecture decision record when an optimization makes the code meaningfully harder to read or locks in a trade-off, such as caching with staleness risk. This documents the reasoning so future maintainers understand the accepted cost.