magento-modulelisted
Install: claude install-skill staksoft/magento-claude-skills
# Magento 2 / Mage-OS Module Development
Expertise for writing Magento 2 modules that compile, pass `phpcs --standard=Magento2`, and
follow current (2.4.x / Mage-OS) conventions. Magento has accumulated a decade of outdated
tutorials; this skill exists because the *obvious* approach found in old blog posts is often
wrong today. When in doubt, prefer the conventions here over patterns seen in older code.
## Non-negotiable conventions (why they matter)
These are the mistakes that get extensions rejected from the marketplace and break upgrades:
- **Never use `ObjectManager::getInstance()` in your own code.** Constructor injection only.
ObjectManager hides dependencies, breaks compilation analysis, and fails code review.
(Exceptions: factories/proxies *generated* by Magento may use it internally — that's fine.)
- **Declarative schema (`db_schema.xml`), never `InstallSchema`/`UpgradeSchema` scripts.**
Install scripts have been deprecated since 2.3 and make schema state unauditable.
- **Plugins over preferences.** A preference (class rewrite) conflicts with every other
module that rewrites the same class. A plugin composes. See the decision tree before
choosing any extension mechanism.
- **View models, not block classes, for template logic.** Custom blocks are legacy; a view
model is a plain class injected into a template via layout XML.
- **Escape all template output** with `$escaper->escapeHtml()` / `escapeHtmlAttr()` /
`escapeUrl()`. Unescaped `echo` in `.phtml