Skip to main content
skill CX Codex

optimizing-performance — Claude Code skill: how to install

optimizing-performance guides performance profiling and tuning across frontend, backend, and database layers. It enforces measuring baselines before touching code and verifying against latency targets.

MIT ★ 1,424 updated 2026-10-06

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add CloudAI-X/claude-workflow-v2
/plugin install project-starter@claude-workflow
Open on GitHub

What optimizing-performance does

The skill enforces a structured five-step workflow: record a baseline, isolate the bottleneck, apply targeted fixes, and measure again. It checks results against explicit latency thresholds, including TTFB under 800ms, LCP below 2.5s, and API P95 latency below 500ms with error rates under 0.1%.

It supplies practical patterns across the entire stack. For frontend code, it targets bundle size with dynamic React.lazy imports, adds memoization, and adjusts images with WebP and lazy loading. On the backend, it eliminates N+1 SQL queries via joins or pagination, sets up multi-tier caching with in-memory storage and Redis, and moves blocking operations into background queues.

Blind optimization is strictly forbidden here. Profiling with tools like Node.js profiler, Python cProfile, or Lighthouse must happen before editing files. If you are doing correctness-focused work without performance concerns, skip this skill entirely.

What it helps with

  • Diagnose high CPU and memory bottlenecks using profilers
  • Fix N+1 database queries using joins and pagination
  • Cut client bundle size through dynamic imports
  • Configure multi-tier caching with in-memory stores and Redis
  • Reduce LCP and TTFB metrics to hit target Web Vitals

Example prompts for the agent

  • Analyze frontend bundle size and help me reduce initial load time
  • Fix N+1 database queries on the orders endpoint using joins
  • Profile high CPU usage in this Node.js service and identify bottlenecks

How to install optimizing-performance

1Plugin marketplace

/plugin marketplace add CloudAI-X/claude-workflow-v2
/plugin install project-starter@claude-workflow

This installs the whole project-starter plugin with all its skills

2Skills CLI (Vercel)

npx skills add CloudAI-X/claude-workflow-v2 --skill optimizing-performance -a claude-code

3Manually: put the files in place

~/.claude/skills/optimizing-performance/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/optimizing-performance/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about optimizing-performance

How do I install optimizing-performance in Claude Code?

Run npx skills add CloudAI-X/claude-workflow-v2 --skill optimizing-performance -a claude-code.

What does optimizing-performance do?

It guides performance workflows by taking baseline profiling measurements, locating CPU or query bottlenecks, and applying targeted caching and code-splitting recipes.

Which profiling tools does optimizing-performance use?

It uses Node.js profiler commands, Python cProfile, and Lighthouse reports to measure and compare execution metrics before and after edits.

Source text

SKILL.md · MIT
---
name: optimizing-performance
description: 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.
---

# 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

```bash
# 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

| Category | Symptoms                         | Tools                           |
| -------- | -------------------------------- | ------------------------------- |
| CPU      | High CPU usage, slow computation | Profiler, flame graphs          |
| Memory   | High RAM, GC pauses, OOM         | Heap snapshots, memory profiler |
| I/O      | Slow disk/network, waiting       | strace, network inspector       |
| Database | Slow queries, lock contention    | Query analyzer, EXPLAIN         |

## Step 3: Apply Optimizations

### Frontend Optimizations

**Bundle Size:**

```javascript
// ❌ 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:**

```javascript
// ❌ 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:**

```html
<!-- ❌ 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"
  width="600"
  height="400"
  alt="Description"
  loading="lazy"
  decoding="async"
/>
```

### Backend Optimizations

**Database Queries:**

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

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

-- ✅ Or use pagination
SELECT id, name FROM users WHERE id > :last_id ORDER BY id LIMIT 100;
```

**Caching Strategy:**

```javascript
// 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) {
    user = JSON.parse(user);
    memoryCache.set(`user:${id}`, user, 60);
    return 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:**

```javascript
// ❌ 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.status(202).send({ jobId, status: "processing" });
});
```

### Algorithm Optimizations

```javascript
// ❌ 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

| Metric | Good    | Needs Work | Poor    |
| ------ | ------- | ---------- | ------- |
| LCP    | < 2.5s  | 2.5-4s     | > 4s    |
| INP    | < 200ms | 200-500ms  | > 500ms |
| CLS    | < 0.1   | 0.1-0.25   | > 0.25  |
| TTFB   | < 800ms | 800ms-1.8s | > 1.8s  |

### API Performance

| Metric      | Target  |
| ----------- | ------- |
| 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.

© CloudAI-X · MIT · CloudAI-X/claude-workflow-v2

Similar skills

All skills for Frontend and UI →

From the same set46

The whole set →
parallel-analyze parallel-analyze starts four subagents at once: architecture, security, performance, testing. Their findings land in one report, ranked by priority. CX Codex +1 ★ 1,424repo stars managing-git managing-git guides Claude Code through Git workflows, branch naming conventions, Conventional Commits formatting, and pull request review checklists. CX Codex +1 ★ 1,424repo stars code-reviewer code-reviewer — a Claude subagent that reads the changed files first, then reports findings by severity: correctness, security, performance, tests. CX Codex ★ 1,424repo stars designing-architecture designing-architecture — a skill that guides you through selecting an architecture pattern, evaluating project size and team capacity, and structuring your codebase. CX Codex +1 ★ 1,424repo stars designing-tests designing-tests is a skill for planning test coverage, choosing test types, and investigating failures during test additions or testing-workflow setup. CX Codex +1 ★ 1,424repo stars debugger debugger finds root causes for test failures, memory leaks, and crashes. The subagent tests hypotheses systematically instead of guessing fixes. CX Codex ★ 1,424repo stars docs-writer The docs-writer subagent reads the implementation before creating or updating docs. Use it for README files, API references, guides, and documentation changes tied to code updates. CX Codex ★ 1,424repo stars parallel-execution parallel-execution — a skill for launching several independent tasks simultaneously using the Agent tool. Speeds up work by a factor of N when tasks don't depend on each other. CX Codex +1 ★ 1,424repo stars

Project sponsors

Companies that keep this analytics open