magento-performance

Optimize Magento 2 performance — full page cache (Varnish), Redis, indexer tuning, JavaScript/CSS optimization, database optimization, and profiling. Use when diagnosing slow pages, optimizing load times, or configuring caching.

17 stars

Best use case

magento-performance is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Optimize Magento 2 performance — full page cache (Varnish), Redis, indexer tuning, JavaScript/CSS optimization, database optimization, and profiling. Use when diagnosing slow pages, optimizing load times, or configuring caching.

Teams using magento-performance should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/magento-performance/SKILL.md --create-dirs "https://raw.githubusercontent.com/OrcaQubits/agentic-commerce-skills-plugins/main/dist/antigravity/magento2-commerce/.agent/skills/magento-performance/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/magento-performance/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How magento-performance Compares

Feature / Agentmagento-performanceStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Optimize Magento 2 performance — full page cache (Varnish), Redis, indexer tuning, JavaScript/CSS optimization, database optimization, and profiling. Use when diagnosing slow pages, optimizing load times, or configuring caching.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Magento 2 Performance Optimization

## Before writing code

**Fetch live docs**:
1. Web-search `site:experienceleague.adobe.com commerce performance` for performance best practices
2. Web-search `site:experienceleague.adobe.com commerce configuration cache` for cache configuration
3. Web-search `site:developer.adobe.com commerce php development cache` for cache development guide

## Full Page Cache (FPC)

### Varnish (Recommended for Production)

- Serves cached pages from RAM before hitting the web server
- Dramatically reduces TTFB (time to first byte)
- Magento generates VCL (Varnish Configuration Language) files
- Configure at Stores > Configuration > Advanced > System > Full Page Cache
- Generate VCL: `bin/magento varnish:vcl:generate`

### Built-in FPC (Fallback)

- Filesystem-based cache — slower than Varnish
- Suitable for development only
- No separate service required

### Cache Invalidation

- Automatic on entity save (products, categories, CMS)
- Manual: `bin/magento cache:clean full_page`
- Cache tags track which pages contain which entities
- Hole-punching for dynamic content (customer name, cart count) via private content/sections

## Redis / Valkey

### Cache Backend

Store all Magento caches in Redis for fast reads:
- Configuration cache, layout cache, block HTML cache
- Configure in `app/etc/env.php` under `cache`

### Session Storage

Store PHP sessions in Redis instead of filesystem/database:
- Faster session reads/writes
- Better for load-balanced environments
- Configure in `app/etc/env.php` under `session`

## Indexer Tuning

- **Update by Schedule** (production) — cron-based, uses changelogs
- **Update on Save** (development) — immediate but resource-intensive
- Monitor indexer status: `bin/magento indexer:status`
- Tune cron frequency for indexer jobs

## JavaScript and CSS Optimization

### Production Mode

Static content is pre-deployed and minified:
```bash
bin/magento setup:static-content:deploy --jobs=N
```

### Minification

- JS minification: enabled via admin config
- CSS minification: enabled via admin config
- HTML minification: configurable

### Bundling

- Built-in JS bundling (basic)
- Advanced bundling with Magepack (community tool) for page-specific bundles
- Critical CSS extraction for above-the-fold rendering

### Hyva Performance Gain

If using Hyva themes: ~5 HTTP requests vs ~230, ~0.4MB vs ~3MB — eliminates most JS optimization needs.

## Database Optimization

- Use MySQL 8.0+/MariaDB 10.6+ for latest optimizer improvements
- Tune InnoDB buffer pool size (ideally 70-80% of available RAM on dedicated DB servers) and use MySQL 8.0 optimizer hints where applicable
- Optimize slow queries: enable slow query log, analyze with `EXPLAIN`
- Clean log tables periodically (cron handles this)
- Use persistent database connections in `app/etc/env.php`

## Profiling Tools

- **Magento Profiler**: enable in `app/etc/env.php` or via `bin/magento dev:profiler:enable`
- **New Relic**: APM integration built into Magento
- **Blackfire.io**: PHP profiling
- **MySQL slow query log**: database bottlenecks
- **Varnish stats**: cache hit rates

## Best Practices

- Always use production mode in production
- Varnish + Redis is the standard production stack
- Set all indexers to "Update by Schedule"
- Pre-deploy static content during build (not on production server)
- Monitor cache hit rates — low rates indicate misconfigured invalidation
- Profile before optimizing — measure, don't guess
- Use CDN for static assets
- Enable HTTP/2 on the web server
- Consider Hyva for frontend performance

Fetch the performance documentation for exact configuration paths, VCL generation options, and Redis configuration format before optimizing.

Related Skills

woo-performance

17
from OrcaQubits/agentic-commerce-skills-plugins

Optimize WooCommerce performance — object caching, transients, HPOS, database optimization, Action Scheduler, lazy loading, and query optimization. Use when improving store performance or diagnosing slowness.

spree-performance

17
from OrcaQubits/agentic-commerce-skills-plugins

Profile and optimize a Spree application — N+1 queries with bullet/scout, database indexing strategy for Spree's polymorphic associations, Rails fragment + Russian doll caching, ActiveStorage variant pre-generation, Sidekiq queue tuning, MeiliSearch vs Postgres FTS tradeoffs, Puma worker/thread sizing, CDN strategy for catalog pages, asset precompile time, and load testing. Use when Spree is slow, the database is hot, or you're preparing for a traffic spike (Black Friday, launch).

shopify-performance

17
from OrcaQubits/agentic-commerce-skills-plugins

Optimize Shopify performance — Liquid rendering, asset optimization, CDN strategies, Core Web Vitals, Hydrogen caching, image optimization, preloading, and lazy loading. Use when improving Shopify store speed.

sf-performance

17
from OrcaQubits/agentic-commerce-skills-plugins

Optimize Salesforce Commerce performance — B2C (cartridge caching, CDN configuration, ISML rendering optimization, lazy loading) and B2B (SOQL optimization, LWC lazy loading, Apex bulkification). Both platforms target Core Web Vitals and image optimization.

magento-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Write tests for Magento 2 — PHPUnit unit tests, integration tests, MFTF functional tests, and API tests. Use when implementing test coverage for modules, debugging, or setting up CI/CD test pipelines.

magento-setup

17
from OrcaQubits/agentic-commerce-skills-plugins

Set up a Magento 2 Open Source project — installation, Composer setup, system requirements verification, and initial configuration. Use when starting a new Magento project or setting up a development environment.

magento-service-contracts

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement Magento 2 service contracts — repository interfaces, data interfaces, SearchCriteria, and the repository pattern. Use when building module APIs, data access layers, or integrating with Magento's Web API.

magento-security

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement Magento 2 security — CSP, 2FA, CSRF protection, ACL, admin security configuration, input validation, and security best practices. Use when hardening a Magento installation or reviewing security posture.

magento-plugins-interceptors

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement Magento 2 plugins (interceptors) — before, after, and around methods for modifying class behavior without inheritance. Use when extending core or third-party module functionality.

magento-module-dev

17
from OrcaQubits/agentic-commerce-skills-plugins

Create Magento 2 custom modules — registration, directory structure, models, resource models, collections, declarative schema, and data/schema patches. Use when building new modules or understanding module architecture.

magento-frontend

17
from OrcaQubits/agentic-commerce-skills-plugins

Build Magento 2 frontend — layout XML, blocks, PHTML templates, ViewModels, themes, JavaScript (RequireJS/KnockoutJS), and LESS/CSS. Use when customizing the storefront, building themes, or working with frontend components.

magento-events-cron

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement Magento 2 events, observers, cron jobs, and message queues. Use when building event-driven logic, scheduled tasks, or asynchronous processing.