magento-eav-attributes
Work with Magento 2 EAV (Entity-Attribute-Value) system — create custom attributes, attribute sets, manage EAV tables, and understand the EAV data model. Use when adding product/category/customer attributes or working with the attribute system.
Best use case
magento-eav-attributes is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Work with Magento 2 EAV (Entity-Attribute-Value) system — create custom attributes, attribute sets, manage EAV tables, and understand the EAV data model. Use when adding product/category/customer attributes or working with the attribute system.
Teams using magento-eav-attributes 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
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/magento-eav-attributes/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How magento-eav-attributes Compares
| Feature / Agent | magento-eav-attributes | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Work with Magento 2 EAV (Entity-Attribute-Value) system — create custom attributes, attribute sets, manage EAV tables, and understand the EAV data model. Use when adding product/category/customer attributes or working with the attribute system.
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 EAV & Attributes ## Before writing code **Fetch live docs**: 1. Web-search `site:developer.adobe.com commerce php development components attributes` for attribute development guide 2. Web-search `site:developer.adobe.com commerce php tutorials backend custom-attributes` for attribute creation tutorial 3. Web-search `magento 2 EAV attribute data patch` for current patterns using data patches ## Conceptual Architecture ### What EAV Is Entity-Attribute-Value is Magento's flexible storage pattern. Instead of one column per attribute, values are stored in separate typed tables. This allows merchants to add unlimited attributes without schema changes. ### EAV Entities Four entity types use EAV: - **Products** (`catalog_product_entity`) - **Categories** (`catalog_category_entity`) - **Customers** (`customer_entity`) - **Customer Addresses** (`customer_address_entity`) ### EAV Table Structure Each entity has typed value tables: - `*_entity` — base entity table (entity_id, sku, type_id, etc.) - `*_entity_varchar` — short text values - `*_entity_int` — integer values (including boolean, select) - `*_entity_decimal` — decimal/price values - `*_entity_datetime` — date/time values - `*_entity_text` — long text values ### Attribute Properties Key properties when creating attributes: - **type** — backend storage type (varchar, int, decimal, datetime, text, static) - **input** — frontend input type (text, textarea, select, multiselect, boolean, date, price, media_image, etc.) - **label** — human-readable name - **required** — is this attribute mandatory? - **source** — source model for select/multiselect options - **backend** — backend model for validation/processing - **frontend** — frontend model for display formatting - **global** — scope: store view, website, or global - **visible** — shown in admin forms - **searchable** — indexed for catalog search - **filterable** — available as layered navigation filter - **comparable** — shown in product comparison - **used_in_product_listing** — available in category listing pages ### Attribute Sets and Groups - **Attribute Set** — a named collection of attributes (e.g., "Default", "Clothing", "Electronics") - **Attribute Group** — organizes attributes within a set into tabs (e.g., "General", "Prices", "Images") - Every product is assigned one attribute set - The Default attribute set contains core attributes ### Creating Attributes via Data Patch The modern approach uses Data Patches with `EavSetupFactory`: 1. Create a data patch class in `Setup/Patch/Data/` 2. Inject `EavSetupFactory` (or `CategorySetupFactory` for categories) 3. Call `$eavSetup->addAttribute()` with entity type, code, and properties 4. Assign to attribute set/group ### Source Models For select/multiselect attributes, source models provide options: - Built-in: `Magento\Eav\Model\Entity\Attribute\Source\Boolean`, `Table` - Custom: extend `AbstractSource`, implement `getAllOptions()` ### Static Attributes Attributes with type `static` are stored as columns directly on the entity table rather than in EAV value tables. Used for frequently queried fields (e.g., `sku`, `type_id`, `created_at`). ### Best Practices - Use data patches (not install/upgrade scripts) for attribute creation - Choose the correct backend type — `int` for select/boolean, `decimal` for prices - Set `searchable`, `filterable`, `comparable` thoughtfully — each adds indexing overhead - Use `static` type sparingly — it modifies the entity table schema - Test attribute creation on a clean install and with `setup:upgrade` Fetch the attribute development docs for exact `addAttribute()` parameters, source model patterns, and current entity type constants before implementing.
Related Skills
saleor-attributes
Work with Saleor's typed attribute system — attribute types, product types, page types, variant selection attributes, and attribute-based filtering. Use when defining product schemas.
magento-testing
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
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
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
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
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-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.
magento-module-dev
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
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
Implement Magento 2 events, observers, cron jobs, and message queues. Use when building event-driven logic, scheduled tasks, or asynchronous processing.
magento-di
Configure Magento 2 dependency injection — di.xml, types, virtual types, preferences, argument replacement, and Object Manager. Use when wiring dependencies, creating class variations, or configuring module integrations.
magento-deploy
Deploy Magento 2 — deployment modes, static content deployment, DI compilation, CLI commands, zero-downtime strategies, and CI/CD pipeline setup. Use when preparing for production deployment or building deployment automation.