scaffold
Generate production-ready project structures, components, and boilerplate code with modern best practices and comprehensive tooling
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.
/profileContext preview
What this command does when you run it.
Comprehensive performance profiling with bottleneck identification and optimization recommendations
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
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.
Perform comprehensive performance profiling with:
---
**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"
}
]
}]
});---
**Agents** (up to 3 based on layers):
**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
Generate production-ready project structures, components, and boilerplate code with modern best practices and comprehensive tooling
Generate comprehensive documentation from code including API docs, user guides, and interactive documentation with deployment automation
Pre-deployment validation with tests, security checks, config safety, and environment readiness verification
Comprehensive system health verification for production monitoring and incident detection
Production incident coordination with emergency triage, RCA, and postmortem generation
Load testing and performance benchmarking with intelligent scenario generation