Comprehensive performance analysis and Core Web Vitals optimization using performance specialist
Performs comprehensive performance audits and Core Web Vitals optimization for Drupal and WordPress sites.
/plugin marketplace add kanopi/cms-cultivator/plugin install cms-cultivator@claude-toolbox[focus-area]Spawn the performance-specialist agent using:
Task(cms-cultivator:performance-specialist:performance-specialist,
prompt="Analyze performance and optimize Core Web Vitals (LCP, INP, CLS). Focus area: [use argument if provided, otherwise 'complete analysis']. Check database queries, caching strategies, asset optimization, and rendering for both Drupal and WordPress projects.")
Full Audit:
/audit-perf - Complete performance analysis across all areasFocus Areas:
/audit-perf queries - Database query optimization/audit-perf n+1 - N+1 query detection and fixes/audit-perf assets - Asset optimization (images, fonts, CSS, JS)/audit-perf bundles - JavaScript bundle analysis/audit-perf caching - Caching strategy reviewCore Web Vitals:
/audit-perf vitals - Check all Core Web Vitals (LCP, INP/FID, CLS)/audit-perf lcp - Largest Contentful Paint optimization/audit-perf inp - Interaction to Next Paint optimization/audit-perf fid - First Input Delay optimization (legacy)/audit-perf cls - Cumulative Layout Shift fixesReporting:
/audit-perf lighthouse - Generate Lighthouse performance report/audit-perf report - Generate stakeholder-friendly performance reportQuick Code Analysis:
For quick performance analysis of specific queries or functions during conversation, the performance-analyzer Agent Skill auto-activates when you mention "slow" or "optimize". See: skills/performance-analyzer/SKILL.md
This command spawns the performance-specialist agent, which uses the performance-analyzer skill and performs comprehensive performance audits focused on Core Web Vitals.
Analyze Core Web Vitals:
Optimize database performance:
Analyze asset performance:
Review caching strategy:
Platform-specific analysis:
Generate actionable reports:
What it measures: Time until the largest content element (image, text block) renders.
Common issues:
Optimizations:
What it measures: Responsiveness to user interactions throughout page life.
Common issues:
Optimizations:
What it measures: Visual stability - unexpected layout shifts during loading.
Common issues:
Optimizations:
What gets checked:
CMS-specific:
Images:
CSS:
JavaScript:
Fonts:
Browser Caching:
Application Caching:
CDN:
# Performance Audit Report
**Performance Score**: [0-100]
**Core Web Vitals**:
- LCP: [X]s ([Pass/Needs Improvement/Poor])
- INP: [X]ms ([Pass/Needs Improvement/Poor])
- CLS: [X] ([Pass/Needs Improvement/Poor])
## Critical Issues (High Impact)
[Issues severely impacting performance - fix immediately]
## High Priority Optimizations
[Significant improvements - address soon]
## Medium Priority Optimizations
[Moderate impact - plan for future]
## Performance Budget
[Recommended targets for page weight, requests, Core Web Vitals]
## Priority Actions
[Ordered list with effort estimates and expected impact]
When using focused checks (/audit-perf queries, /audit-perf assets, etc.), the performance specialist provides detailed analysis for that specific area only.
Focused report on LCP, INP, and CLS with specific optimizations for each metric.
Comprehensive Lighthouse audit with all metrics, opportunities, and diagnostics.
Executive-friendly report with business impact (conversion rates, revenue), competitor comparison, ROI analysis, and phased remediation roadmap.
Cache System:
// Proper cache configuration
$build['#cache'] = [
'tags' => ['node:' . $node->id()],
'contexts' => ['user.roles', 'url.query_args'],
'max-age' => 3600,
];
Query Optimization:
// Efficient EntityQuery
$query = \Drupal::entityQuery('node')
->condition('type', 'article')
->range(0, 10)
->sort('created', 'DESC');
Lazy Builders (for expensive operations):
$build['expensive'] = [
'#lazy_builder' => ['my_module.lazy_builder:build', [$id]],
'#create_placeholder' => TRUE,
];
Common Drupal Issues:
Transient Caching:
$data = get_transient('my_expensive_data');
if (false === $data) {
$data = expensive_function();
set_transient('my_expensive_data', $data, HOUR_IN_SECONDS);
}
WP_Query Optimization:
$query = new WP_Query([
'post_type' => 'post',
'posts_per_page' => 10,
'no_found_rows' => true, // Skip pagination count
'update_post_term_cache' => false, // Skip if not needed
]);
Asset Loading (defer/async):
wp_enqueue_script(
'my-script',
get_template_directory_uri() . '/js/script.js',
['jquery'],
'1.0',
['strategy' => 'defer', 'in_footer' => true]
);
Common WordPress Issues:
posts_per_page => -1 (loads all)# Check code quality
ddev composer phpstan # Static analysis
ddev composer rector-check # Code modernization
# Check dependencies
ddev composer audit
ddev exec npm audit
# Install tools
ddev exec npm install --save-dev lighthouse @lhci/cli webpack-bundle-analyzer
# Run Lighthouse
ddev exec npx lighthouse [url] --output html --output-path ./report.html
# Run Lighthouse CI
ddev exec npx lhci autorun
# Analyze bundles
ddev exec npx webpack-bundle-analyzer
# Custom performance tests
ddev composer test-performance
Automated Tools:
Monitoring Tools:
Analysis Tools:
Testing Conditions:
The performance specialist recommends budgets based on industry standards:
| Metric | Budget | Impact |
|---|---|---|
| LCP | < 2.5s | Pass Core Web Vitals |
| INP | < 200ms | Pass Core Web Vitals |
| CLS | < 0.1 | Pass Core Web Vitals |
| Total JS | < 200KB | Faster page load |
| Total CSS | < 100KB | Reduced render blocking |
| Images | < 1MB | Faster LCP |
| Requests | < 50 | Reduced connection overhead |
Research shows:
/pr-create - PR creation includes performance checks/pr-review - PR reviews include performance analysis/audit-live-site - Comprehensive audits include performanceperformance-specialist - Core Web Vitals specialist with expertise in database optimization, caching strategies, and CMS-specific performance patterns for Drupal and WordPress.
Before (manual perf review):
With performance-specialist: