Automatically analyze performance issues when user mentions slow pages, performance problems, or optimization needs. Performs focused performance checks on specific code, queries, or components. Invoke when user says "this is slow", "performance issue", "optimize", or asks about speed.
From cms-cultivatornpx claudepluginhub kanopi/claude-toolbox --plugin cms-cultivatorThis skill uses the workspace's default tool permissions.
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
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.