Skip to main content
skill CX Codex

performance-engineer · zhaono1 — Claude Code skill: how to install

Pinpoints application bottlenecks and guides code optimization. Activates when systems face latency spikes, slow queries, or high memory usage.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add zhaono1/agent-playbook --skill performance-engineer -a claude-code
Open on GitHub

What performance-engineer does

The skill tackles performance issues through a structured sequence: metric definition, execution profiling, bottleneck isolation, and verification against baselines. It utilizes standard command-line tools like curl, query logging, and built-in profilers across Node.js, Python, and Go.

Optimizations target typical failure modes at each layer. For databases, it detects missing indexes and N+1 query patterns. On the API layer, it introduces pagination, field selection, and response compression. It also covers frontend practices like lazy loading and memoization, relying on scripts/profile.py and scripts/perf_report.py to collect data and generate markdown summaries.

Target metrics listed in the skill are sample baselines. The instructions mandate agreeing on actual service SLOs and budget limits before treating threshold numbers as acceptance criteria.

What it helps with

  • Eliminate N+1 database queries and add missing indexes
  • Profile CPU and heap memory allocation in services
  • Implement pagination and gzip compression on API routes
  • Set up batch request handling and event debouncing

Example prompts for the agent

  • The /users route latency is spiking, find the bottleneck and optimize the query.
  • Profile this service and generate a markdown summary with scripts/perf_report.py.
  • Inspect this component to reduce unnecessary re-renders and heavy calculations.

How to install performance-engineer

1Skills CLI (Vercel)

npx skills add zhaono1/agent-playbook --skill performance-engineer -a claude-code

2Manually: put the files in place

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

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

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

Questions about performance-engineer

How to install performance-engineer in Claude Code?

Run npx skills add zhaono1/agent-playbook --skill performance-engineer -a claude-code. The file will be saved to ~/.claude/skills/performance-engineer/SKILL.md.

What does performance-engineer do?

It diagnoses slow response times across backend, database, and frontend layers, offering concrete fixes like caching, query eager loading, and code splitting.

What environment tools does this skill require?

It needs access to Read, Write, Edit, Bash, Grep, and Glob, plus a working Python installation to run the profiling scripts.

Source text

SKILL.md · MIT
---
name: performance-engineer
description: Performance optimization specialist for improving application speed and efficiency. Use when investigating performance issues or optimizing code.
allowed-tools: Read, Write, Edit, Bash, Grep, Glob
metadata:
  hooks:
    after_complete:
      - trigger: self-improving-agent
        mode: background
        reason: "Learn from performance patterns"
      - trigger: session-logger
        mode: auto
        reason: "Log performance optimization"
---

# Performance Engineer

Specialist in analyzing and optimizing application performance, identifying bottlenecks, and implementing efficiency improvements.

## When This Skill Activates

Activates when you:
- Report performance issues
- Need performance optimization
- Mention "slow" or "latency"
- Want to improve efficiency

## Performance Analysis Process

### Phase 1: Identify the Problem

1. **Define metrics**
   - What's the baseline?
   - What's the target?
   - What's acceptable?

2. **Measure current performance**
   ```bash
   # Response time
   curl -w "@curl-format.txt" -o /dev/null -s https://example.com/users

   # Database query time
   # Add timing logs to queries

   # Memory usage
   # Use profiler
   ```

3. **Profile the application**
   ```bash
   # Node.js
   node --prof app.js

   # Python
   python -m cProfile app.py

   # Go
   go test -cpuprofile=cpu.prof
   ```

### Phase 2: Find the Bottleneck

Common bottleneck locations:

| Layer | Common Issues |
|-------|---------------|
| **Database** | N+1 queries, missing indexes, large result sets |
| **API** | Over-fetching, no caching, serial requests |
| **Application** | Inefficient algorithms, excessive logging |
| **Frontend** | Large bundles, re-renders, no lazy loading |
| **Network** | Too many requests, large payloads, no compression |

### Phase 3: Optimize

#### Database Optimization

**N+1 Queries:**
```typescript
// Bad: N+1 queries
const users = await User.findAll();
for (const user of users) {
  user.posts = await Post.findAll({ where: { userId: user.id } });
}

// Good: Eager loading
const users = await User.findAll({
  include: [{ model: Post, as: 'posts' }]
});
```

**Missing Indexes:**
```sql
-- Add index on frequently queried columns
CREATE INDEX idx_user_email ON users(email);
CREATE INDEX idx_post_user_id ON posts(user_id);
```

#### API Optimization

**Pagination:**
```typescript
// Always paginate large result sets
const users = await User.findAll({
  limit: 100,
  offset: page * 100
});
```

**Field Selection:**
```typescript
// Select only needed fields
const users = await User.findAll({
  attributes: ['id', 'name', 'email']
});
```

**Compression:**
```typescript
// Enable gzip compression
app.use(compression());
```

#### Frontend Optimization

**Code Splitting:**
```typescript
// Lazy load routes
const Dashboard = lazy(() => import('./Dashboard'));
```

**Memoization:**
```typescript
// Use useMemo for expensive calculations
const filtered = useMemo(() =>
  items.filter(item => item.active),
  [items]
);
```

**Image Optimization:**
- Use WebP format
- Lazy load images
- Use responsive images
- Compress images

### Phase 4: Verify

1. **Measure again**
2. **Compare to baseline**
3. **Ensure no regressions**
4. **Document the improvement**

## Performance Targets

Derive targets from the service SLO, current baseline, workload shape, cost
budget, and critical user journey. The table below is an example starting point
only; never present it as the system's acceptance criteria without evidence or
owner agreement.

| Metric | Target | Critical Threshold |
|--------|--------|-------------------|
| API Response (p50) | < 100ms | < 500ms |
| API Response (p95) | < 500ms | < 1s |
| API Response (p99) | < 1s | < 2s |
| Database Query | < 50ms | < 200ms |
| Page Load (FMP) | < 2s | < 3s |
| Time to Interactive | < 3s | < 5s |
| Memory Usage | < 512MB | < 1GB |

## Common Optimizations

### Caching Strategy

```typescript
// Cache expensive computations
const cache = new Map();

async function getUserStats(userId: string) {
  if (cache.has(userId)) {
    return cache.get(userId);
  }

  const stats = await calculateUserStats(userId);
  cache.set(userId, stats);

  // Invalidate after 5 minutes
  setTimeout(() => cache.delete(userId), 5 * 60 * 1000);

  return stats;
}
```

### Batch Processing

```typescript
// Bad: Individual requests
for (const id of userIds) {
  await fetchUser(id);
}

// Good: Batch request
await fetchUsers(userIds);
```

### Debouncing/Throttling

```typescript
// Debounce search input
const debouncedSearch = debounce(search, 300);

// Throttle scroll events
const throttledScroll = throttle(handleScroll, 100);
```

## Performance Monitoring

### Key Metrics

- **Response Time**: Time to process request
- **Throughput**: Requests per second
- **Error Rate**: Failed requests percentage
- **Memory Usage**: Heap/RAM used
- **CPU Usage**: Processor utilization

### Monitoring Tools

| Tool | Purpose |
|------|---------|
| Lighthouse | Frontend performance |
| New Relic | APM monitoring |
| Datadog | Infrastructure monitoring |
| Prometheus | Metrics collection |

## Scripts

Profile application:
```bash
python3 scripts/profile.py --name <service-name> --output perf-profile.txt
```

Generate performance report:
```bash
python3 scripts/perf_report.py --name <service-name> --output perf-report.md
```

## References

- `references/optimization.md` - Optimization techniques
- `references/monitoring.md` - Monitoring setup
- `references/checklist.md` - Performance checklist

© zhaono1 · MIT · zhaono1/agent-playbook

Similar skills

All skills for Backend and APIs →

performance-engineer by other authors comes first.

From the same set24

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor