From aj-geddes-useful-ai-prompts-4
Profile application performance, identify bottlenecks, and optimize hot paths using CPU profiling, flame graphs, and benchmarking. Use when investigating performance issues or optimizing critical code paths.
How this skill is triggered — by the user, by Claude, or both
Slash command
/aj-geddes-useful-ai-prompts-4:profiling-optimizationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- [Overview](#overview)
Profile code execution to identify performance bottlenecks and optimize critical paths using data-driven approaches.
Minimal working example:
import { performance, PerformanceObserver } from "perf_hooks";
class Profiler {
private marks = new Map<string, number>();
mark(name: string): void {
this.marks.set(name, performance.now());
}
measure(name: string, startMark: string): number {
const start = this.marks.get(startMark);
if (!start) throw new Error(`Mark ${startMark} not found`);
const duration = performance.now() - start;
console.log(`${name}: ${duration.toFixed(2)}ms`);
return duration;
}
async profile<T>(name: string, fn: () => Promise<T>): Promise<T> {
const start = performance.now();
try {
return await fn();
} finally {
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Node.js Profiling | Node.js Profiling |
| Chrome DevTools CPU Profile | Chrome DevTools CPU Profile |
| Python cProfile | Python cProfile |
| Benchmarking | Benchmarking |
| Database Query Profiling | Database Query Profiling |
| Flame Graph Generation | Flame Graph Generation |
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin aj-geddes-useful-ai-prompts-4Profiles CPU usage to identify hot spots and bottlenecks using browser DevTools, flame graphs, and React Profiler for optimizing code paths.
Orchestrates performance profiling and optimization across languages. Diagnoses symptoms, dispatches profiling agents, and manages before/after comparisons for latency, memory, CPU, and bundle issues.
Profiles apps to identify CPU/memory bottlenecks using runtime tools: clinic.js/0x for Node.js, py-spy/cProfile for Python, Chrome DevTools/Lighthouse for frontend. For slow apps, leaks, high CPU.