optimization

Diagnose and improve system performance through measurement, bottleneck attribution, and prioritized fixes.

Updated Aug 2, 2026
One-click install
npx skills add https://github.com/leonardoacosta/agents --skill optimization-leonardoacosta
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: optimization
Source: https://github.com/leonardoacosta/agents/tree/main/skills/optimization
Command: npx skills add https://github.com/leonardoacosta/agents --skill optimization-leonardoacosta

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Teams often optimize code blindly, wasting effort on micro-tweaks while missing the real bottlenecks. This Skill enforces a disciplined, evidence-based workflow for improving latency, throughput, memory usage, and overall efficiency. ## Core Features & Use Cases - Metric-First Workflow: Define target metrics (latency, throughput, memory, CPU, cost) and build repeatable benchmarks before changing any code. - Bottleneck Attribution: Instrument systems with ad hoc inspection and logged measurements to trace where time and resources actually go. - Static Analysis Checks: Catch wrong asymptotic complexity, poor algorithm or data structure choices, and repeated work without needing a profiler. - Macro Before Micro: Prioritize architectural fixes, caching, batching, and parallelism over low-level tweaks. - Use Case: An API endpoint responds in 2 seconds. Use this Skill to establish a baseline benchmark, attribute the cost across the request path, discover an N+1 query pattern, fix it, and verify the improvement with before/after measurements. ## Quick Start Use the optimization skill to find and fix the performance bottleneck in my slow API endpoint with measurable before and after evidence.

Frequently Asked Questions about optimization

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

FAQPage Schema
How do I optimize slow code performance?

Start by defining the exact metrics that matter, such as latency or memory, and build a repeatable benchmark. Then instrument the system to attribute where time goes, fix the highest-leverage bottleneck first, and re-measure to verify the improvement.

How to find performance bottlenecks in an application?

Combine runtime instrumentation with logged measurements so you can analyze runs after the fact. Attribute work across the full execution path rather than only the obviously slow component, and use static analysis to catch algorithmic issues.

Should I profile before optimizing my code?

Not always. Static analysis often reveals problems like wrong asymptotic complexity, poor data structures, or repeated work without any profiling. Use profiling when inspection alone cannot explain where the cost comes from.

What is the difference between macro and micro optimization?

Macro-optimization removes whole classes of work through architecture, caching, batching, and algorithm changes. Micro-optimization makes existing work slightly cheaper. Always pursue macro fixes first, especially when far from target metrics.

When should I stop optimizing a system?

Stop when the target metrics are met or when further gains are not worth the tradeoffs. Watch for regressions in correctness, reliability, maintainability, and security, and never claim an optimization without before-and-after evidence.