OP

optimizing-performance

Provides a data-driven framework to profile, identify, and resolve performance bottlenecks across your entire stack.

Install

mkdir -p .claude/skills/optimizing-performance && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2384" && unzip -o skill.zip -d .claude/skills/optimizing-performance && rm skill.zip

Installs to .claude/skills/optimizing-performance

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Analyzes and optimizes application performance across frontend, backend, and database layers. Use when diagnosing slowness, improving load times, optimizing queries, reducing bundle size, or when asked about performance issues.
227 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Conducts pre/post measurement of performance metrics
  • Categorizes bottlenecks into CPU, memory, I/O, or DB
  • Provides profiling CLI commands for Node and Python
  • Suggests bundle size reduction and code-splitting
  • Guides systematic optimization workflows

How it works

It enforces a rigorous measurement-first cycle, guiding the user to profile baselines, identify categories of bottlenecks, and verify improvements.

Inputs & outputs

You give it
Problem description (slowness, high memory)
You get back
A step-by-step optimization checklist and profiling instructions

When to use optimizing-performance

  • Diagnosing high CPU usage in application code
  • Reducing bundle size for web applications
  • Optimizing slow database queries
  • Resolving memory leaks or high RAM consumption

About this skill

Optimizing Performance

When to Load

  • Trigger: Diagnosing slowness, profiling, caching strategies, reducing load times, bundle size optimization
  • Skip: Correctness-focused work where performance is not a concern

Performance Optimization Workflow

Copy this checklist and track progress:

Performance Optimization Progress:
- [ ] Step 1: Measure baseline performance
- [ ] Step 2: Identify bottlenecks
- [ ] Step 3: Apply targeted optimizations
- [ ] Step 4: Measure again and compare
- [ ] Step 5: Repeat if targets not met

Critical Rule: Never optimize without data. Always profile before and after changes.

Step 1: Measure Baseline

Profiling Commands

# Node.js profiling
node --prof app.js
node --prof-process isolate*.log > profile.txt

# Python profiling
python -m cProfile -o profile.stats app.py
python -m pstats profile.stats

# Web performance
lighthouse https://example.com --output=json

Step 2: Identify Bottlenecks

Common Bottleneck Categories

CategorySymptomsTools
CPUHigh CPU usage, slow computationProfiler, flame graphs
MemoryHigh RAM, GC pauses, OOMHeap snapshots, memory profiler
I/OSlow disk/network, waitingstrace, network inspector
DatabaseSlow queries, lock contentionQuery analyzer, EXPLAIN

Step 3: Apply Optimizations

Frontend Optimizations

Bundle Size:

// ❌ Import entire library
import _ from "lodash";

// ✅ Import only needed functions
import debounce from "lodash/debounce";

// ✅ Use dynamic imports for code splitting
const HeavyComponent = lazy(() => import("./HeavyComponent"));

Rendering:

// ❌ Render on every parent update
function Child({ data }) {
  return <ExpensiveComponent data={data} />;
}

// ✅ Memoize when props don't change
const Child = memo(function Child({ data }) {
  return <ExpensiveComponent data={data} />;
});

// ✅ Use useMemo for expensive computations
const processed = useMemo(() => expensiveCalc(data), [data]);

Images:

<!-- ❌ Unoptimized -->
<img src="large-image.jpg" />

<!-- ✅ Optimized -->
<img
  src="image.webp"
  srcset="image-300.webp 300w, image-600.webp 600w"
  sizes="(max-width: 600px) 300px, 600px"
  loading="lazy"
  decoding="async"
/>

Backend Optimizations

Database Queries:

-- ❌ N+1 Query Problem
SELECT * FROM users;
-- Then for each user:
SELECT * FROM orders WHERE user_id = ?;

-- ✅ Single query with JOIN
SELECT u.*, o.*
FROM users u
LEFT JOIN orders o ON u.id = o.user_id;

-- ✅ Or use pagination
SELECT * FROM users LIMIT 100 OFFSET 0;

Caching Strategy:

// Multi-layer caching
const getUser = async (id) => {
  // L1: In-memory cache (fastest)
  let user = memoryCache.get(`user:${id}`);
  if (user) return user;

  // L2: Redis cache (fast)
  user = await redis.get(`user:${id}`);
  if (user) {
    memoryCache.set(`user:${id}`, user, 60);
    return JSON.parse(user);
  }

  // L3: Database (slow)
  user = await db.users.findById(id);
  await redis.setex(`user:${id}`, 3600, JSON.stringify(user));
  memoryCache.set(`user:${id}`, user, 60);

  return user;
};

Async Processing:

// ❌ Blocking operation
app.post("/upload", async (req, res) => {
  await processVideo(req.file); // Takes 5 minutes
  res.send("Done");
});

// ✅ Queue for background processing
app.post("/upload", async (req, res) => {
  const jobId = await queue.add("processVideo", { file: req.file });
  res.send({ jobId, status: "processing" });
});

Algorithm Optimizations

// ❌ O(n²) - nested loops
function findDuplicates(arr) {
  const duplicates = [];
  for (let i = 0; i < arr.length; i++) {
    for (let j = i + 1; j < arr.length; j++) {
      if (arr[i] === arr[j]) duplicates.push(arr[i]);
    }
  }
  return duplicates;
}

// ✅ O(n) - hash map
function findDuplicates(arr) {
  const seen = new Set();
  const duplicates = new Set();
  for (const item of arr) {
    if (seen.has(item)) duplicates.add(item);
    seen.add(item);
  }
  return [...duplicates];
}

Step 4: Measure Again

After applying optimizations, re-run profiling and compare:

Comparison Checklist:
- [ ] Run same profiling tools as baseline
- [ ] Compare metrics before vs after
- [ ] Verify no regressions in other areas
- [ ] Document improvement percentages

Performance Targets

Web Vitals

MetricGoodNeeds WorkPoor
LCP< 2.5s2.5-4s> 4s
INP< 200ms200-500ms> 500ms
CLS< 0.10.1-0.25> 0.25
TTFB< 800ms800ms-1.8s> 1.8s

API Performance

MetricTarget
P50 Latency< 100ms
P95 Latency< 500ms
P99 Latency< 1s
Error Rate< 0.1%

Validation

After optimization, validate results:

Performance Validation:
- [ ] Metrics improved from baseline
- [ ] No functionality regressions
- [ ] No new errors introduced
- [ ] Changes are sustainable (not one-time fixes)
- [ ] Performance gains documented

If targets not met, return to Step 2 and identify remaining bottlenecks.

When not to use it

  • When profiling has not yet been performed
  • For tasks where correctness takes priority over speed

Prerequisites

Profiling tools (cProfile, lighthouse, or Node profiler)

Limitations

  • Requires access to profiling tools
  • Data collection can be time-intensive
  • Does not directly perform the optimizations

How it compares

It prohibits guessing by requiring data-backed validation before and after changes.

Compared to similar skills

optimizing-performance side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
optimizing-performance (this skill)12moReviewIntermediate
caching-strategies16moNo flagsIntermediate
processing-api-batches126dReviewAdvanced
redis-inspect66moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

More by CloudAI-X

View all by CloudAI-X

convex-backend

CloudAI-X

Convex backend development guidelines. Use when writing Convex functions, schemas, queries, mutations, actions, or any backend code in a Convex project. Triggers on tasks involving Convex database operations, real-time subscriptions, file storage, or serverless functions.

827

threejs-animation

CloudAI-X

Three.js animation - keyframe animation, skeletal animation, morph targets, animation mixing. Use when animating objects, playing GLTF animations, creating procedural motion, or blending animations.

57

designing-architecture

CloudAI-X

Designs software architecture and selects appropriate patterns for projects. Use when designing systems, choosing architecture patterns, structuring projects, making technical decisions, or when asked about microservices, monoliths, or architectural approaches.

48

parallel-execution

CloudAI-X

Patterns for parallel subagent execution using Task tool with run_in_background. Use when coordinating multiple independent tasks, spawning dynamic subagents, or implementing features that can be parallelized.

417

threejs-shaders

CloudAI-X

Three.js shaders - GLSL, ShaderMaterial, uniforms, custom effects. Use when creating custom visual effects, modifying vertices, writing fragment shaders, or extending built-in materials.

430

analyzing-projects

CloudAI-X

Analyzes codebases to understand structure, tech stack, patterns, and conventions. Use when onboarding to a new project, exploring unfamiliar code, or when asked "how does this work?" or "what's the architecture?"

327

You might also like

caching-strategies

dadbodgeoff

Implement multi-layer caching with Redis, in-memory, and HTTP caching. Covers cache invalidation, stampede prevention, and cache-aside patterns.

18

processing-api-batches

jeremylongshore

Optimize bulk API requests with batching, throttling, and parallel execution. Use when processing bulk API operations efficiently. Trigger with phrases like "process bulk requests", "batch API calls", or "handle batch operations".

10

redis-inspect

civitai

Inspect Redis cache keys, values, and TTLs for debugging. Supports both main cache and system cache. Use for debugging cache issues, checking cached values, and monitoring cache state. Read-only by default.

646

sentry-rate-limits

jeremylongshore

Manage Sentry rate limits and quota optimization. Use when hitting rate limits, optimizing event volume, or managing Sentry costs. Trigger with phrases like "sentry rate limit", "sentry quota", "reduce sentry events", "sentry 429".

120

fireflies-debug-bundle

jeremylongshore

Collect Fireflies.ai debug evidence for support tickets and troubleshooting. Use when encountering persistent issues, preparing support tickets, or collecting diagnostic information for Fireflies.ai problems. Trigger with phrases like "fireflies debug", "fireflies support bundle", "collect fireflies logs", "fireflies diagnostic".

13

sentry-debug-bundle

jeremylongshore

Execute collect debug information for Sentry support tickets. Use when preparing support requests, debugging complex issues, or gathering diagnostic information. Trigger with phrases like "sentry debug info", "sentry support ticket", "gather sentry diagnostics", "sentry debug bundle".

13

Search skills

Search the agent skills registry