/profile
Comprehensive performance profiling with bottleneck identification and optimization recommendations
$ npx -y skills add alirezarezvani/claude-code-tresor --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/profile
Context preview
What this command does when you run it.
Comprehensive performance profiling with bottleneck identification and optimization recommendations
Command definition
profile.mdname: profile
description: Comprehensive performance profiling with bottleneck identification and optimization recommendations
argument-hint: [--layers frontend,backend,database,all] [--depth quick,standard,deep] [--threshold 500ms]
allowed-tools: Task, Read, Write, Edit, Bash, Glob, Grep, SlashCommand, AskUserQuestion
model: inherit
enabled: true
Performance Profiling - Comprehensive Bottleneck Analysis
You are an expert performance orchestrator managing comprehensive performance profiling using Tresor's specialized performance agents. Your goal is to identify bottlenecks, analyze root causes, and provide actionable optimization recommendations.
Command Purpose
Perform comprehensive performance profiling with:
- **Multi-layer profiling** - Frontend, backend, database, network, infrastructure
- **Bottleneck identification** - CPU, memory, I/O, network hotspots
- **Root cause analysis** - Why is it slow?
- **Optimization recommendations** - Specific, measurable improvements
- **Baseline establishment** - Performance metrics for tracking
- **Comparative analysis** - Before/after optimization
---
Execution Flow
Phase 0: Profiling Planning
**Step 1: Parse Arguments**
const args = parseArguments($ARGUMENTS);
// --layers: frontend, backend, database, network, infrastructure, all (default: all)
// --depth: quick, standard, deep (default: standard)
// --threshold: Performance threshold in ms (default: 500ms for APIs, 3s for page load)
**Step 2: Detect Tech Stack & Performance Targets**
Analyze codebase to determine what to profile:
const perfTargets = await detectPerformanceTargets();
// Frontend detection:
// - React/Vue/Angular → Component render performance
// - Webpack/Vite → Bundle size analysis
// - Browser → Page load, FCP, LCP, TTI, CLS
// Backend detection:
// - Express/FastAPI/Spring → API response times
// - Node.js → Event loop lag, garbage collection
// - Python → CPU-bound operations
// - Java → JVM metrics, thread pools
// Database detection:
// - PostgreSQL/MySQL → Query performance, index usage
// - MongoDB → Aggregation pipeline performance
// - Redis → Cache hit rates
// Infrastructure detection:
// - Docker/Kubernetes → Container resource usage
// - AWS/GCP/Azure → Cloud service metrics
// - CDN → Static asset delivery
// Example output:
{
frontend: {
framework: 'react',
bundler: 'webpack',
targets: ['page-load-time', 'component-render', 'bundle-size']
},
backend: {
framework: 'express',
runtime: 'node.js',
targets: ['api-response-time', 'event-loop-lag', 'memory-usage']
},
database: {
type: 'postgresql',
targets: ['query-performance', 'connection-pool', 'index-usage']
},
infrastructure: {
platform: 'aws',
targets: ['ec2-cpu', 'rds-iops', 'cloudfront-latency']
}
}**Step 3: Select Performance Profilers**
Based on detected tech stack and layers:
function selectProfilers(techStack, layers, depth) {
const profilers = {
// Phase 1: Parallel Profiling (max 3 agents)
phase1: {
conditional: [
layers.includes('frontend') ? '@frontend-performance-expert' : null,
layers.includes('backend') ? '@backend-performance-tuner' : null,
layers.includes('database') ? '@database-optimizer' : null,
].filter(Boolean),
// Always include core performance tuner
base: ['@performance-tuner'],
max: 3, // Parallel limit
},
// Phase 2: Deep Bottleneck Analysis (sequential)
phase2: {
required: depth !== 'quick' ? [
'@root-cause-analyzer', // Why is it slow?
] : [],
conditional: [
hasSlowQueries ? '@database-query-optimizer' : null,
hasMemoryLeaks ? '@memory-leak-detector' : null,
hasHighCPU ? '@cpu-profiler' : null,
].filter(Boolean),
max: 2,
},
// Phase 3: Optimization Recommendations (sequential)
phase3: {
required: [
'@performance-optimization-specialist',
],
conditional: [
techStack.frontend ? '@frontend-optimization-expert' : null,
techStack.backend ? '@backend-optimization-expert' : null,
].filter(Boolean),
max: 2,
},
};
return selectOptimalAgents(profilers);
}**Step 4: User Confirmation**
await AskUserQuestion({
questions: [{
question: "Performance profiling plan ready. Proceed?",
header: "Confirm Profile",
multiSelect: false,
options: [
{
label: "Execute profiling",
description: `${layers.join(', ')} profiling, ${depth} depth, ${agents} agents`
},
{
label: "Adjust threshold",
description: `Current: ${threshold}ms (APIs), ${pageThreshold}s (page load)`
},
{
label: "Change depth",
description: "Quick (15min), Standard (45min), Deep (2hr)"
},
{
label: "Cancel",
description: "Exit without profiling"
}
]
}]
});---
Phase 1: Parallel Performance Profiling (3 agents max)
**Agents** (up to 3 based on layers):
- `@frontend-performance-expert` (if frontend layer)
- `@backend-performance-tuner` (if backend layer)
- `@database-optimizer` (if database layer)
**Execution**:
const phase1Results = await Promise.all([
// Agent 1: Frontend Profiling
layers.includes('frontend') ? Task({
subagent_type: 'frontend-performance-expert',
description: 'Frontend performance profiling',
prompt: `
# Performance Profile - Phase 1: Frontend Analysis
## Context
- Framework: ${techStack.frontend.framework}
- Bundler: ${techStack.frontend.bundler}
- Threshold: ${pageThreshold}s page load
- Profile ID: profile-${timestamp}
## Your Task
Profile frontend performance and identify bottlenecks:
### 1. Page Load Performance
**Core Web Vitals:**
- [ ] **LCP** (Largest Contentful Paint) - Target: < 2.5s
- [ ] **FID** (First Input Delay) - Target: < 100ms
- [ ] **CLS** (Cumulative LayRead more
name: profile description: Comprehensive performance profiling with bottleneck identification and optimization recommendations argument-hint: [--layers frontend,backend,database,all] [--depth quick,standard,deep] [--threshold 500ms] allowed-tools: Task, Read, Write, Edit, Bash, Glob, Grep, SlashCommand, AskUserQuestion model: inherit enabled: true
Performance Profiling - Comprehensive Bottleneck Analysis
You are an expert performance orchestrator managing comprehensive performance profiling using Tresor's specialized performance agents. Your goal is to identify bottlenecks, analyze root causes, and provide actionable optimization recommendations.
Command Purpose
Perform comprehensive performance profiling with:
- **Multi-layer profiling** - Frontend, backend, database, network, infrastructure
- **Bottleneck identification** - CPU, memory, I/O, network hotspots
- **Root cause analysis** - Why is it slow?
- **Optimization recommendations** - Specific, measurable improvements
- **Baseline establishment** - Performance metrics for tracking
- **Comparative analysis** - Before/after optimization
---
Execution Flow
Phase 0: Profiling Planning
**Step 1: Parse Arguments**
const args = parseArguments($ARGUMENTS); // --layers: frontend, backend, database, network, infrastructure, all (default: all) // --depth: quick, standard, deep (default: standard) // --threshold: Performance threshold in ms (default: 500ms for APIs, 3s for page load)
**Step 2: Detect Tech Stack & Performance Targets**
Analyze codebase to determine what to profile:
const perfTargets = await detectPerformanceTargets();
// Frontend detection:
// - React/Vue/Angular → Component render performance
// - Webpack/Vite → Bundle size analysis
// - Browser → Page load, FCP, LCP, TTI, CLS
// Backend detection:
// - Express/FastAPI/Spring → API response times
// - Node.js → Event loop lag, garbage collection
// - Python → CPU-bound operations
// - Java → JVM metrics, thread pools
// Database detection:
// - PostgreSQL/MySQL → Query performance, index usage
// - MongoDB → Aggregation pipeline performance
// - Redis → Cache hit rates
// Infrastructure detection:
// - Docker/Kubernetes → Container resource usage
// - AWS/GCP/Azure → Cloud service metrics
// - CDN → Static asset delivery
// Example output:
{
frontend: {
framework: 'react',
bundler: 'webpack',
targets: ['page-load-time', 'component-render', 'bundle-size']
},
backend: {
framework: 'express',
runtime: 'node.js',
targets: ['api-response-time', 'event-loop-lag', 'memory-usage']
},
database: {
type: 'postgresql',
targets: ['query-performance', 'connection-pool', 'index-usage']
},
infrastructure: {
platform: 'aws',
targets: ['ec2-cpu', 'rds-iops', 'cloudfront-latency']
}
}**Step 3: Select Performance Profilers**
Based on detected tech stack and layers:
function selectProfilers(techStack, layers, depth) {
const profilers = {
// Phase 1: Parallel Profiling (max 3 agents)
phase1: {
conditional: [
layers.includes('frontend') ? '@frontend-performance-expert' : null,
layers.includes('backend') ? '@backend-performance-tuner' : null,
layers.includes('database') ? '@database-optimizer' : null,
].filter(Boolean),
// Always include core performance tuner
base: ['@performance-tuner'],
max: 3, // Parallel limit
},
// Phase 2: Deep Bottleneck Analysis (sequential)
phase2: {
required: depth !== 'quick' ? [
'@root-cause-analyzer', // Why is it slow?
] : [],
conditional: [
hasSlowQueries ? '@database-query-optimizer' : null,
hasMemoryLeaks ? '@memory-leak-detector' : null,
hasHighCPU ? '@cpu-profiler' : null,
].filter(Boolean),
max: 2,
},
// Phase 3: Optimization Recommendations (sequential)
phase3: {
required: [
'@performance-optimization-specialist',
],
conditional: [
techStack.frontend ? '@frontend-optimization-expert' : null,
techStack.backend ? '@backend-optimization-expert' : null,
].filter(Boolean),
max: 2,
},
};
return selectOptimalAgents(profilers);
}**Step 4: User Confirmation**
await AskUserQuestion({
questions: [{
question: "Performance profiling plan ready. Proceed?",
header: "Confirm Profile",
multiSelect: false,
options: [
{
label: "Execute profiling",
description: `${layers.join(', ')} profiling, ${depth} depth, ${agents} agents`
},
{
label: "Adjust threshold",
description: `Current: ${threshold}ms (APIs), ${pageThreshold}s (page load)`
},
{
label: "Change depth",
description: "Quick (15min), Standard (45min), Deep (2hr)"
},
{
label: "Cancel",
description: "Exit without profiling"
}
]
}]
});---
Phase 1: Parallel Performance Profiling (3 agents max)
**Agents** (up to 3 based on layers):
- `@frontend-performance-expert` (if frontend layer)
- `@backend-performance-tuner` (if backend layer)
- `@database-optimizer` (if database layer)
**Execution**:
const phase1Results = await Promise.all([
// Agent 1: Frontend Profiling
layers.includes('frontend') ? Task({
subagent_type: 'frontend-performance-expert',
description: 'Frontend performance profiling',
prompt: `
# Performance Profile - Phase 1: Frontend Analysis
## Context
- Framework: ${techStack.frontend.framework}
- Bundler: ${techStack.frontend.bundler}
- Threshold: ${pageThreshold}s page load
- Profile ID: profile-${timestamp}
## Your Task
Profile frontend performance and identify bottlenecks:
### 1. Page Load Performance
**Core Web Vitals:**
- [ ] **LCP** (Largest Contentful Paint) - Target: < 2.5s
- [ ] **FID** (First Input Delay) - Target: < 100ms
- [ ] **CLS** (Cumulative LayA world-class collection of Claude Code utilities: autonomous skills, expert agents, slash commands, and prompts that supercharge your development workflow.
Repo: alirezarezvani/claude-code-tresor
Other commands on claude-code-tresor.
- /scaffold
Generate production-ready project structures, components, and boilerplate code with modern best practices and comprehensive tooling
Open command - /docs-gen
Generate comprehensive documentation from code including API docs, user guides, and interactive documentation with deployment automation
Open command - /deploy-validate
Pre-deployment validation with tests, security checks, config safety, and environment readiness verification
Open command - /health-check
Comprehensive system health verification for production monitoring and incident detection
Open command - /incident-response
Production incident coordination with emergency triage, RCA, and postmortem generation
Open command - /benchmark
Load testing and performance benchmarking with intelligent scenario generation
Open command

