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.
Automatically diagnoses performance issues when you mention slow pages, optimization needs, or performance problems. Analyzes code for N+1 queries, missing indexes, unoptimized assets, and caching issues.
/plugin marketplace add kanopi/cms-cultivator/plugin install cms-cultivator@claude-toolboxThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Automatically analyze and suggest performance improvements for specific code.
Activate this skill when the user:
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
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.