perf-optimize

Guides measurement-driven performance optimization by profiling before changing code.

96|8|Updated Aug 13, 2026
One-click install
npx skills add https://github.com/pingfanfan/hello-dsh --skill perf-optimize-pingfanfan
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: perf-optimize
Source: https://github.com/pingfanfan/hello-dsh/tree/main/examples/skills/perf-optimize
Command: npx skills add https://github.com/pingfanfan/hello-dsh --skill perf-optimize-pingfanfan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Engineers often optimize code based on intuition, which rarely matches real bottlenecks and adds complexity without speed gains. This Skill enforces a measure-first discipline so every optimization targets a verified hotspot with a defined goal. ## Core Features & Use Cases - Goal Definition First: Requires a concrete target (e.g., p99 latency under 200ms) before any work begins, preventing endless optimization. - Bottleneck Classification: Categorizes profiler findings into algorithmic complexity, N+1 queries, repeated computation, blocking, and excessive rendering, prioritizing order-of-magnitude wins over micro-optimizations. - One-Change-at-a-Time Verification: Mandates re-measuring after each single change and running full tests to catch correctness regressions from caching or concurrency changes. - Use Case: When an API endpoint is slow, use this Skill to profile it under realistic load, identify an N+1 query pattern, batch the queries, and verify the improvement against the recorded baseline. ## Quick Start Use the perf-optimize skill to diagnose why this endpoint is slow and propose a measured optimization plan.

Frequently Asked Questions about perf-optimize

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

FAQPage Schema
How do I find performance bottlenecks in my code?▼

Use a profiler to find hotspots instead of reading code and guessing. Measure under realistic conditions with production-like data volume, concurrency, and configuration, then record baseline numbers before changing anything.

What should I optimize first for the biggest performance gains?▼

Prioritize algorithmic complexity and N+1 query patterns, since these typically yield order-of-magnitude improvements. Micro-optimizations usually only gain a few percent and often add permanent code complexity.

When is performance optimization not worth doing?▼

Skip optimization when the code path runs rarely, when the complexity cost outweighs a one-time gain, or when a simpler fix like an index or config change exists. The fastest code is code that never executes.

Why do performance measurements mislead developers?▼

Common traps include measuring in development mode, using tiny datasets where complexity differences are invisible, running only once without checking variance, and mismatching cold versus warm start conditions.

What should I check before adding a cache?▼

Decide when the cache invalidates, what happens if stale data is shown, what the hit rate will be, and how much memory it consumes. A cache with unclear invalidation or low hit rate is pure overhead.