From cms-cultivator
Automatically analyzes performance issues and suggests optimizations for web pages, database queries, and API calls. Focuses on Core Web Vitals, N+1 problems, and caching.
How this skill is triggered — by the user, by Claude, or both
Slash command
/cms-cultivator:performance-analyzerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Automatically analyze and suggest performance improvements for specific code.
Automatically analyze and suggest performance improvements for specific code.
Fast code is user-friendly code. Every millisecond counts.
Activate this skill when the user:
Before analyzing performance, determine:
Measure first:
Don't optimize without data - Profile to find real bottlenecks
Core Web Vitals targets:
General targets:
Prioritize fixes by impact:
Common patterns:
User reports performance issue
↓
Measure baseline (Lighthouse, profiler)
↓
Identify bottleneck (queries/assets/processing)
↓
Assess impact (all users vs. edge case)
↓
Recommend specific optimizations
↓
Provide before/after metrics
What to check:
Example Response:
## Query Performance Issue: N+1 Problem
**Current Code:**
```php
$users = User::loadMultiple();
foreach ($users as $user) {
$profile = $user->get('field_profile')->entity; // N+1!
}
Problem: Loading 100 users triggers 101 queries (1 + 100)
Solution: Use EntityQuery with eager loading
$query = \Drupal::entityQuery('user')
->accessCheck(TRUE);
$uids = $query->execute();
$users = User::loadMultiple($uids);
// Preload profiles in one query
$profile_ids = [];
foreach ($users as $user) {
$profile_ids[] = $user->get('field_profile')->target_id;
}
$profiles = Profile::loadMultiple($profile_ids);
Impact: Reduces queries from 101 to 2 (~98% improvement)
### 2. Asset Optimization
**What to check:**
- Large unoptimized images
- Unminified CSS/JS
- Blocking resources
- Missing lazy loading
- No CDN usage
### 3. Caching Analysis
**What to check:**
- Missing cache tags
- Cache invalidation issues
- No page cache
- Expensive uncached operations
### 4. Core Web Vitals
**Quick checks:**
- **LCP** (Largest Contentful Paint): Target < 2.5s
- **INP** (Interaction to Next Paint): Target < 200ms
- **CLS** (Cumulative Layout Shift): Target < 0.1
## Response Format
```markdown
## Performance Analysis
**Component**: [What was analyzed]
**Issue**: [Performance problem]
**Impact**: [How it affects users]
### Current Performance
- Metric: [value]
- Grade: [A-F]
### Optimization Recommendations
1. **[Recommendation]** (Priority: High)
- Current: [problem]
- Improved: [solution]
- Expected gain: [percentage/time]
2. **[Next recommendation]**
...
### Code Example
[Provide optimized code]
Problem: Lazy loading causing N+1
// Bad
foreach ($nodes as $node) {
$author = $node->getOwner()->getDisplayName(); // N+1
}
// Good
$nodes = \Drupal::entityTypeManager()
->getStorage('node')
->loadMultiple($nids);
User::loadMultiple(array_column($nodes, 'uid')); // Preload
Problem: Inefficient WP_Query
// Bad
$posts = new WP_Query(['posts_per_page' => -1]); // Loads everything
// Good
$posts = new WP_Query([
'posts_per_page' => 20,
'fields' => 'ids', // Only IDs
'no_found_rows' => true, // Skip counting
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
]);
This Skill: Focused code-level analysis
/audit-perf Command: Comprehensive site audit
💡 Database: Index foreign keys, avoid SELECT * 💡 Caching: Cache expensive operations, use cache tags 💡 Assets: Optimize images, minify CSS/JS, lazy load 💡 Queries: Limit results, use eager loading, avoid N+1
npx claudepluginhub kanopi/claude-toolbox --plugin cms-cultivatorDiagnoses frontend and backend performance bottlenecks including bundle size, N+1 queries, memory leaks, and Core Web Vitals. Prioritizes fixes by impact.
Performs static code analysis for performance bottlenecks, optimization opportunities, scalability issues, including N+1 queries, memory leaks, caching, and Core Web Vitals. Generates prioritized report with code fixes.
Measures and fixes performance bottlenecks in code, databases, and APIs using profiling, query analysis, and caching. Applies when users mention slowness or high response times.