ddtcorex/maestro-skills/magento2-dev-core
- community
- ext:[{"type":"config","description":"Configuration overrides"}]
Checking that the SKILL.md file is still in the repository.
This skill should be used when the user is creating new Magento 2 modules or customizations, implementing features following Magento architecture, working with Dependency Injection, Repositories, or Plugins, writing secure Magento code, or building backend logic, CLI commands, or cron jobs. Foundation skill for professional Magento 2 development. This is the CORE skill that other Magento 2 skills depend on. Always load this first.
Install
npx vskill@latest install ddtcorex/maestro-skills/magento2-dev-coreSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Magento 2 Developer Core
This skill provides the foundational patterns all Magento 2 developers must follow. It covers architectural decisions, security, and best practices that apply to every part of a Magento project.
Related Skills
This is the foundation the other Magento 2 skills build on: magento2-frontend-dev and magento2-hyva-dev cover the two mutually exclusive theme stacks (check the theme's theme.xml parent to see which one the project actually uses — Luma vs Hyvä), magento2-backend-dev covers APIs/CLI/cron, and magento2-linter, magento2-security-scan, magento2-performance-audit verify the patterns below — magento2-code-review orchestrates all three (plus this skill's own anti-pattern checks) into one report scoped to a PR/module/theme/project. In a Govard environment, pair this with govard-magento for the container/CLI side.
Core Architectural Standards
Note: For framework-agnostic PHP (PSR-12/Composer/PDO) seephp-dev-core. This skill covers Magento-specific DI/Repository/Plugin.
Dependency Injection (DI)
DO: Use Constructor Injection for all dependencies.
NEVER: Use ObjectManager::getInstance() (Service Locator anti-pattern).
Service Contracts
Always prefer interfaces in Api/ folders over concrete classes:
Repositories
Always use repositories for data operations. Never call load(), save(), or delete() directly on models.
Plugins (Interceptors)
Prefer before and after plugins over around plugins:
| Plugin Type | Use Case | |
|---|---|---|
before | Modify arguments before method execution | |
after | Modify return value after method execution | |
around | Avoid unless necessary - blocks original method execution |
Plugins only intercept public methods, must be stateless, and should not target a module's own classes or data objects. Register them in di.xml with an explicit sortOrder when order matters. Observer order is not guaranteed by contrast — if the sequence matters, use a plugin instead of an observer. Before adding a new plugin or observer, check for existing ones on the same target class/event — magento2-code-review's plugin/observer conflict check (references/plugin-observer-conflict-check.md in that skill) covers the grep procedure.
Declarative Schema
Use db_schema.xml for all database changes. Never modify database directly:
Coding Standards
PHPCS (Magento2 Ruleset)
| Rule | Example | |
|---|---|---|
| Class naming | PascalCase - ProductRepository | |
| Method naming | camelCase - getProductById() | |
| Property naming | snake_case - $product_id, $_cacheIdPrefix | |
| Visibility | Always explicit - public, protected, or private | |
| Indentation | 4 spaces (no tabs) | |
| Line endings | LF (Unix) |
PHPStan Requirements
Always run PHPStan at level 6+ using bitexpert/phpstan-magento for Magento's magic classes.
Strict Typing
Always include at the top of new PHP files:
Security Standards
No Superglobals
NEVER use $_GET, $_POST, $_REQUEST, $_SESSION, $_COOKIE directly.
XSS Prevention
Always escape output in templates:
The Magento2.Security.XssTemplate PHPCS sniff treats any method whose name contains html (e.g. getLabelHtml()) as already safe — do not wrap it in escapeHtml() again, that double-escapes the output.
CSRF Protection
Include form key in all forms:
Discouraged Functions
Use Magento wrappers instead of native PHP:
| Native PHP | Use Instead | |
|---|---|---|
serialize/unserialize | SerializerInterface | |
json_encode/decode | \Magento\Framework\Serialize\Serializer\Json | |
curl_* | Magento\Framework\HTTP\ClientInterface | |
date(), time() | \Magento\Framework\Stdlib\DateTime\DateTime | |
md5(), sha1() | EncryptorInterface |
Verification Workflow
Run these checks before completing any backend task:
Usage Patterns
Creating a Module
Otherwise: manually verify registration.php, etc/module.xml sequence, and each etc/*.xml parses.
- Create registration file:
app/code/Vendor/Module/registration.php - Create
etc/module.xmlwith correct sequence - Define
etc/di.xmlfor preferences and plugins - Use
db_schema.xmlfor database schema - Run
bin/magento module:enable Vendor_Module
CLI Commands
Cron Jobs
Configuration File Reference
Quick lookup for what each etc/ XML file controls:
| File | Purpose | |
|---|---|---|
di.xml | Dependency injection: preferences, plugins, virtual types | |
events.xml | Observer registration | |
crontab.xml / cron_groups.xml | Cron jobs / cron group tuning | |
acl.xml | Admin permission tree | |
routes.xml | Frontend/adminhtml controller routing | |
webapi.xml | REST route declarations | |
system.xml | Admin configuration fields | |
config.xml | Default config values | |
indexer.xml + mview.xml | Indexer declaration + its change tracker (enables schedule mode) | |
extension_attributes.xml | Extend a core entity without a preference | |
view.xml | Theme image/gallery sizing, layout config | |
queue.xml / communication.xml | Message queue publishers, consumers, topics | |
widget.xml | CMS widget declaration | |
email_templates.xml | Transactional email template registration |
Rule of thumb: stale data is an indexer problem (check indexer:status); stale output is a cache problem (cache:clean/cache:flush). Diagnose in that order rather than assuming a cache bug.
Anti-Pattern Severity (for code review)
Full severity scale and stable finding codes (shared with magento2-linter, magento2-security-scan, magento2-performance-audit, and magento2-code-review): references/severity-and-codes.md. The architecture anti-patterns this skill defines are catalogued there under the M2-ARCH-xxx namespace — map a new finding to an existing code before minting a new one.
Testing Conventions
- Unit tests (
Test/Unit/): typed mocks only, neverObjectManager::getInstance(), never test private methods via reflection — if a private method needs its own test, it belongs in its own class. - Integration tests (
Test/Integration/): useBootstrap::getObjectManager(), load data with@magentoDataFixturefixture files rather than creating entities inline, and annotate with@magentoDbIsolationso tests don't leak state between each other. - Functional tests: MFTF (Magento Functional Testing Framework) for full user-journey coverage.
References
For detailed patterns, see:
references/coding-standards.md- Extended PHPCS/PHPStan guidereferences/architecture-patterns.md- Service contracts, repositories, pluginsreferences/security-best-practices.md- Security checklist and patternsreferences/severity-and-codes.md- Shared severity scale and finding codes (used by the whole QA quartet)
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/magento2-dev-core/SKILL.md
Popularity
- Repository stars
- 4
- Repository forks
- 2
- 7-day trend score
- 8
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
configConfiguration overrides
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ddtcorex/maestro-skills/magento2-dev-core)