dist/codex/magento2-commerce/skills/magento-frontend/SKILL.md
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.
npx skillsauth add orcaqubits/agentic-commerce-claude-plugins magento-frontendInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Fetch live docs:
site:developer.adobe.com commerce frontend-core for frontend development guidehttps://developer.adobe.com/commerce/frontend-core/guide/css/preprocess for CSS/LESS docssite:developer.adobe.com commerce frontend-core guide layouts for layout XML referencesite:developer.adobe.com commerce frontend-core guide templates for template guideLayout files map to route handles and define the page structure:
<route>_<controller>_<action>.xml (e.g., catalog_product_view.xml)default.xml — applies to all pages<referenceContainer> — modify an existing container<referenceBlock> — modify an existing block<block> — add a new block with class, template, name<move> — relocate a block/container<referenceBlock name="block_name" remove="true"/> — remove a block (or use <referenceContainer> for containers). Note: there is no standalone <remove> element for blocks; the remove="true" attribute is set on <referenceBlock> or <referenceContainer>.<update> — include another layout handle<arguments> — pass data to blocksview/frontend/layout/ or view/adminhtml/layout/Magento_Module/layout/Magento\Framework\View\Element\Template$block->someMethod() in PHTML templatesview/frontend/templates/ or theme overrides.phtml extension$block, escape output: $escaper->escapeHtml()MVVM pattern — inject ViewModels into blocks via layout XML arguments:
Magento\Framework\View\Element\Block\ArgumentInterface$viewModel = $block->getData('view_model');requirejs-config.js — maps module aliases, mixins, shimsview/frontend/web/ or view/frontend/requirejs-config.jsko.bindingHandlersview/frontend/web/template/ (.html files)Extend existing JS modules without overriding:
requirejs-config.js under config.mixinsCustom widgets extend $.widget:
data-mage-init attribute or <script type="text/x-magento-init">app/design/frontend/VendorName/theme-name/
├── etc/view.xml # Image sizes, responsive breakpoints
├── registration.php # Theme registration
├── theme.xml # Theme name, parent
├── composer.json
├── Magento_Module/ # Module overrides
│ ├── layout/ # Layout XML overrides
│ └── templates/ # Template overrides
├── web/
│ ├── css/source/ # LESS source files
│ ├── images/
│ └── js/
└── media/preview.jpg
Themes declare a parent in theme.xml. Fallback chain: current theme → parent theme → module views → framework. Override files by placing them in the same relative path.
Open source since late 2025. Replaces KnockoutJS + RequireJS + jQuery with Alpine.js + Tailwind CSS. Dramatically faster: ~5 requests vs ~230, ~0.4MB vs ~3MB page weight.
@magento_import directive for theme fallback_variables.less, overridden per theme$escaper->escapeHtml(), escapeUrl(), escapeJs() for XSS preventionFetch the frontend development guide for exact layout XML schema, template escaping methods, and RequireJS configuration patterns before implementing.
development
Build with Spree's headless Next.js storefront — the official `spree/storefront` repo (Next.js 16 App Router with Server Actions and Turbopack, React 19 Server Components, Tailwind CSS 4, TypeScript 5, `@spree/sdk`, Sentry), server-only auth (httpOnly JWT cookies + publishable key), MeiliSearch faceted catalog, one-page checkout with Apple/Google Pay/Klarna/Affirm/SEPA, multi-region market routing, GA4 + JSON-LD SEO, and Vercel/Docker deployment. Use when forking or customizing the storefront, or evaluating headless adoption.
tools
Build Spree extensions as Rails engines — gem scaffolding, `bin/rails g spree:extension`, mounting routes/migrations/assets, the modern `prepend` decorator pattern (`*_decorator.rb` with `self.prepended(base)`), generators (`spree:model_decorator`, `spree:controller_decorator`), the four customization surfaces in preference order (Events > Webhooks > Dependencies > Decorators), Spree::Dependencies for swapping service objects, gem release/versioning, and the deprecated Deface engine. Use when building a reusable Spree extension or adding non-trivial customization to an app.
development
Build with Spree's event bus and Webhooks 2.0 — `Spree::Events` publication, `Spree::Subscriber` DSL with `subscribes_to` and `on`, wildcard matching, lifecycle events (`{model}.created/.updated/.deleted` via `publishes_lifecycle_events`), the canonical event catalog (order.*, payment.*, shipment.*, product.*), Webhooks 2.0 endpoints, HMAC-SHA256 signing (`X-Spree-Webhook-Signature`), exponential-backoff retries, and Sidekiq job orchestration. Use when wiring event-driven business logic, building webhook consumers, or replacing ActiveSupport callback chains.
tools
Cross-cutting Spree development patterns — the customization preference hierarchy (Events > Webhooks > Dependencies > Decorators), `Spree::Dependencies` service-object swapping, the `_decorator.rb` + `prepend` + `self.prepended` idiom, idempotent subscribers and webhook receivers, multi-store scoping discipline, prefixed IDs, calculator polymorphism (shipping/promotion/tax share the base), service-object composition with `dry-monads` or simple results, why to avoid `class_eval` reopening and Deface, and Spree-on-Rails idioms (Hotwire/Turbo Stimulus, ActiveStorage, Action Cable, Sidekiq). Use when designing the architecture of a Spree extension or solving cross-cutting concerns.