Skip to content
Back to skills

Performance Optimization

ASecurity

Use when optimizing code performance, addressing slowness complaints, or measuring application speed improvements

  • 31 stars
  • 0 votes
  • 0 copies
  • 8 views
  • Added February 7, 2026
developmentnodeawsapidatabaseperformancedocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned February 12, 2026

npx -y skills add JeremyDev87/codingbuddy --skill performance-optimization --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Performance Optimization?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Performance Optimization
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jeremydev87-performance-optimization/badge)](https://www.skillsdirectory.com/skills/jeremydev87-performance-optimization)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: performance-optimization
description: Use when optimizing code performance, addressing slowness complaints, or measuring application speed improvements
---

# Performance Optimization

**Iron Law:** `NO OPTIMIZATION WITHOUT PROFILING FIRST`

No exceptions - not for "obvious" bottlenecks, "quick wins", or "best practices".

**Use for:** Slow APIs, UI lag, high memory, slow builds, database queries, any "make it faster" request.

## Five Phases

| Phase | Activity | Output |
|-------|----------|--------|
| **1. Profile** | Find hot paths with profiler | Bottlenecks with % of time |
| **2. Benchmark** | 5 warm-up + 10 measured runs | Baseline with mean, std, p95 |
| **3. Prioritize** | Apply Amdahl's Law | ROI-ranked list |
| **4. Optimize** | ONE change, verify | Measured improvement |
| **5. Prevent** | CI gates, monitoring | Regression detection |

### Phase 1: Profile

1. Clarify metrics ("It's slow" → p50? p95?)
2. Select profiler:
   - **CPU:** perf, py-spy, node --prof, Chrome DevTools
   - **Memory:** heaptrack, memray, Chrome Memory
   - **I/O:** strace, iostat, slow query log
   - **Distributed:** OpenTelemetry, Jaeger, Datadog
   - **Serverless:** AWS X-Ray, CloudWatch
   - **Mobile:** Android Profiler, Xcode Instruments
3. Profile cold AND warm cache
4. **Flame graphs:** Wider bars = more time
5. **Time-box:** Max 2 hours → Escalate if unclear

### Phase 3: Prioritize (Amdahl's Law)

**Formula:** `Speedup = 1 / ((1 - P) + P/S)`

| Bottleneck % | Max Speedup | Action |
|--------------|-------------|--------|
| < 5% | < 1.05x | Skip |
| 5-20% | 1.05-1.25x | Low priority |
| 20-50% | 1.25-2x | Medium |
| > 50% | > 2x | **High priority** |

**Multiple similar %?** Optimize easiest first. Re-profile after each.

### Phase 4: Optimize

1. Write benchmark test first
2. ONE change at a time
3. Compare statistically
4. **Rollback:** Separate commit, feature flags

### Phase 5: Prevent

Add CI gate: `PERF_BUDGET_MS: 150` → fail build if exceeded

## Red Flags - STOP

- "I know where the bottleneck is" → Profile first
- "Let's just add caching" → Measure first
- "One run is enough" → High variance
- "The fix is obvious" → Return to Phase 1

## Rationalizations

| Excuse | Reality |
|--------|---------|
| "I know the bottleneck" | Profiling surprises 90% of time |
| "Micro-optimizations add up" | Amdahl's Law: 5% code = 95% time |

See `documentation-template.md` for before/after template.

Files in this skill

  • CREATION-LOG.md3.5 KB
  • SKILL.md2.4 KB
  • documentation-template.md1.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.