MCPInstall

perf

Performance profiling and optimization. Use for benchmarking code, analyzing performance, running Lighthouse audits, and finding hotspots.

Installs
40
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/johnlindquist/claude --skill perf
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads perf automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Performance Profiler

Profile, benchmark, and optimize code performance.

Prerequisites

# Node.js for profiling
node --version

# Lighthouse for web perf
npm install -g lighthouse

# Gemini for analysis
pip install google-generativeai
export GEMINI_API_KEY=your_api_key

Benchmarking

Quick Benchmark

# Time a Node.js script
time node script.js

# With memory
/usr/bin/time -l node script.js  # macOS
/usr/bin/time -v node script.js  # Linux

Node.js Performance Hooks

// benchmark.js
const { performance, PerformanceObserver } = require('perf_hooks');

const obs = new PerformanceObserver((list) => {
  console.log(list.getEntries()[0].duration);
});
obs.observe({ entryTypes: ['measure'] });

performance.mark('start');
// Code to benchmark
yourFunction();
performance.mark('end');
performance.measure('duration', 'start', 'end');

Console Timing

console.time('operation');
// Code to time
console.timeEnd('operation');  // Prints: operation: 123.456ms

Node.js Profiling

V8 Profiler

# Generate profile
node --prof script.js

# Process the log
node --prof-process isolate-*.log > profile.txt

Inspect Mode

# Start with inspector
node --inspect script.js

# Break on start
node --inspect-brk script.js

# Open Chrome DevTools
open chrome://inspect

Memory Profiling

# Heap snapshot
node --heapsnapshot-signal=SIGUSR2 script.js
# Then: kill -USR2 <pid>

# Expose GC for testing
node --expose-gc script.js

Lighthouse Audits

Basic Audit

# Full audit
lighthouse https://example.com

# Output to JSON
lighthouse https://example.com --output=json --output-path=report.json

# Output to HTML
lighthouse https://example.com --output=html --output-path=report.html

# Specific categories
lighthouse https://example.com --only-categories=performance

# Mobile vs Desktop
lighthouse https://example.com --preset=desktop
lighthouse https://example.com --preset=mobile  # default

Performance Only

lighthouse https://example.com \
  --only-categories=performance \
  --output=json \
  --output-path=perf-report.json

Chrome Flags

# Headless
lighthouse https://example.com --chrome-flags="--headless"

# Custom viewport
lighthouse https://example.com --chrome-flags="--window-size=1920,1080"

AI Performance Analysis

Analyze Code for Performance

CODE=$(cat slow-function.ts)

gemini -m pro -o text -e "" "Analyze this code for performance issues:

$CODE

Identify:
1. Time complexity issues
2. Memory leaks or bloat
3. Unnecessary operations
4. Opportunities for optimization
5. Caching opportunities

Provide specific recommendations with code examples."

Analyze Profile Output

PROFILE=$(cat profile.txt)

gemini -m pro -o text -e "" "Analyze this Node.js profile:

$PROFILE

Identify:
1. Hot functions (most time spent)
2. Potential bottlenecks
3. Optimization opportunities
4. Priority of fixes"

Finding Hotspots

CPU Hotspots

# Record CPU profile
node --cpu-prof script.js

# Analyze generated .cpuprofile
# Open in Chrome DevTools or use:
npx speedscope *.cpuprofile

Memory Hotspots

# Find large objects
node --heapsnapshot-signal=SIGUSR2 app.js

# Use clinic.js
npx clinic doctor -- node script.js
npx clinic flame -- node script.js
npx clinic bubbleprof -- node script.js

Bundle Analysis

# Webpack
npx webpack-bundle-analyzer stats.json

# Vite
npx vite build --report

# Generic
du -sh dist/*
ls -lhS dist/*.js

Common Patterns

Anti-Patterns to Check

gemini -m pro -o text -e "" "Check this code for common performance anti-patterns:

$(cat src/*.ts)

Look for:
- Synchronous I/O in hot paths
- Repeated DOM queries
- Unnecessary re-renders
- N+1 query patterns
- Memory leaks in closures
- Blocking the event loop"

Optimization Checklist

gemini -m pro -o text -e "" "Create a performance optimization checklist for:

Application type: [web app / API / CLI]
Stack: [your stack]
Current issues: [symptoms]

Include priority order and estimated impact."

Comparison Benchmarks

Before/After

#!/bin/bash
# benchmark-compare.sh

echo "=== Before optimization ==="
git checkout main
npm install
time npm run benchmark

echo "=== After optimization ==="
git checkout optimization-branch
npm install
time npm run benchmark

A/B Script

#!/bin/bash
# Run same benchmark multiple times
for i in {1..10}; do
  echo "Run $i:"
  node benchmark.js
done | tee results.txt

# Calculate average
grep "time:" results.txt | awk '{sum+=$2; n++} END {print "Average:", sum/n}'

Best Practices

  1. Measure first - Don't optimize without data
  2. Profile production - Dev performance differs
  3. Automate benchmarks - Track over time
  4. Focus on hot paths - 80/20 rule
  5. Test on target devices - Especially mobile
  6. Monitor after deploy - Verify improvements
  7. Document baselines - Know what "good" looks like

FAQ

What does the perf skill do?

Performance profiling and optimization. Use for benchmarking code, analyzing performance, running Lighthouse audits, and finding hotspots.

How do I install perf?

Run npx skills add https://github.com/johnlindquist/claude --skill perf in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/perf/ (personal) or .claude/skills/perf/ (project).

Which AI agents can use perf?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is perf safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains perf?

It is published by johnlindquist in johnlindquist/claude. It has 40 recorded installs.

More from johnlindquist/claude

View all →

gemini-image

johnlindquist/claude

Analyze images using Gemini's vision capabilities. Use for image analysis, text extraction from screenshots, and visual content understanding.

Media & Creative1.2K installs

memory

johnlindquist/claude

Open the skill to read its SKILL.md instructions.

362 installs

raycast-extension

johnlindquist/claude

Open the skill to read its SKILL.md instructions.

321 installs

brainstorm

johnlindquist/claude

Open the skill to read its SKILL.md instructions.

deepwiki

johnlindquist/claude

Open the skill to read its SKILL.md instructions.

269 installs

think

johnlindquist/claude

Open the skill to read its SKILL.md instructions.

258 installs

Popular code quality & workflow skills

View category →

grill-me

mattpocock/skills

A relentless interview to sharpen a plan or design.

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

handoff

mattpocock/skills

Compact the current conversation into a handoff document for another agent to pick up.

domain-modeling

mattpocock/skills

Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

codebase-design

mattpocock/skills

Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

diagnosing-bugs

mattpocock/skills

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.