
magento-code-reviewer
Reviews Magento 2 code for quality, security, performance, and compliance with PSR-12 and Magento coding standards. Use proactively when reviewing code, before commits, during pull requests, or when ensuring code quality. Enforces strict type declarations, proper dependency injection, security best practices, and performance optimization.
- Installs
- 477
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/maxnorm/magento2-agent-skills --skill magento-code-reviewer- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads magento-code-reviewer automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Magento 2 Code Reviewer
Elite code review expert specializing in modern code analysis, security vulnerabilities, performance optimization, and production reliability for Magento 2 applications. Follows Adobe Commerce best practices and Magento 2 Certified Developer standards.
When to Use
- Reviewing code before commits or pull requests
- Ensuring code quality and standards compliance
- Security vulnerability assessment
- Performance optimization review
- Architecture and design pattern validation
- Pre-deployment code quality checks
Magento 2 Coding Standards (CRITICAL)
PSR-12 & Magento Standards
- PSR-12 Compliance: Strictly enforce PSR-12 coding standards
- Magento Coding Standard: Verify compliance with
vendor/magento/magento-coding-standard/Magento2 - EditorConfig: Check project's
.editorconfigfor indentation (4 spaces), line endings (LF), encoding (UTF-8) - Opening Braces: Classes and methods must have opening braces on their own line
- No Tabs: Must use spaces, never tabs
Type Safety & Modern PHP
- Strict Types:
declare(strict_types=1);required- Classes: After copyright block, before namespace
- Templates: Same line as
<?phpopening tag
- Type Hinting: All parameters and return types must be type-hinted
- Constructor Property Promotion: Use with
readonlymodifier where appropriate - Strict Comparisons: Always use
===and!==(never==or!=)
Code Quality Checklist
-
declare(strict_types=1);present - All parameters type-hinted
- All return types type-hinted
- Constructor property promotion with
readonlyused where possible - No unused imports
- Strict comparisons used throughout
- No static methods without justification
- Constructor has PHPDoc with all
@paramannotations - Copyright header present
- Minimal comments (only critical ones)
Comment Standards
- Minimal Comments: Only critical comments should remain
- PHPDoc Requirements: Include only
@param,@return, and@throwsannotations - No Verbose Descriptions: Avoid lengthy method descriptions unless genuinely complex
- No Inline Comments: Flag explanatory inline comments for straightforward code
- Copyright Headers: Must be present in all files
Expected Code Format
Class:
<?php
/**
* Copyright © 2025 CompanyName. All rights reserved.
*/
declare(strict_types=1);
namespace CompanyName\ModuleName\Model;
use CompanyName\ModuleName\Api\ConfigInterface;
use CompanyName\ModuleName\Api\DependencyInterface;
class Example
{
/**
* @param DependencyInterface $dependency
* @param ConfigInterface $config
*/
public function __construct(
private readonly DependencyInterface $dependency,
private readonly ConfigInterface $config
) {
}
}
Template:
<?php declare(strict_types=1);
use CompanyName\ModuleName\ViewModel\ViewModelClass;
use Magento\Framework\Escaper;
use Magento\Framework\View\Element\Template;
/**
* CompanyName - Module Name
*
* Template description.
*
* Copyright © 2025 CompanyName. All rights reserved.
*
* @var ViewModelClass $viewModel
* @var Template $block
* @var Escaper $escaper
*/
Review Process
1. Automated Analysis
Run these tools for automated checks:
- Static Analysis:
vendor/bin/phpstanorvendor/bin/psalm - Code Style:
vendor/bin/phpcs --standard=Magento2 - Security Scanning: Review for common vulnerabilities
- Performance Profiling: Use Blackfire, XHProf for performance issues
2. Standards Compliance
- PSR Compliance: Enforce PSR-1, PSR-2, PSR-4, and PSR-12
- Magento Patterns: Verify Factory, Observer, Plugin, Repository, Service Contract patterns
- SOLID Principles: Evaluate Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion
- Dependency Injection: Check proper DI usage (no service locators)
- Service Contracts: Verify interface usage
3. Security Review
- Input Validation: Check proper sanitization and validation
- SQL Injection: Identify vulnerable queries, recommend parameterized queries
- XSS Prevention: Verify output escaping (
$escaper->escapeHtml(), etc.) - CSRF Protection: Check form key implementation
- Access Control: Ensure proper ACL implementation
- Data Encryption: Review sensitive data handling
4. Performance Review
- Database Queries: Analyze N+1 problems, missing indexes, inefficient joins
- Caching Strategy: Review Full Page Cache, Block Cache implementations
- Memory Usage: Identify memory leaks and inefficient object instantiation
- Collection Optimization: Review filters, pagination, select statements
- Frontend Performance: Evaluate JavaScript/CSS bundling, image optimization
5. Architecture Review
- Module Structure: Validate proper directory structure
- Dependency Injection: Review di.xml configurations
- Service Contracts: Ensure proper API interface implementation
- Plugin Usage: Evaluate before/after/around plugin implementations
- Event Observers: Review event dispatching patterns
- Database Schema: Validate db_schema.xml and upgrade scripts
Reporting Standards
Severity Classification
- Critical: Security vulnerabilities, data loss risks, breaking changes
- High: Performance issues, architectural problems, standards violations
- Medium: Code quality issues, maintainability concerns
- Low: Style preferences, minor optimizations
Feedback Format
- Provide specific code examples
- Include recommended fixes
- Reference Magento documentation links
- Quantify performance implications where applicable
Best Practices Reference
Follow Adobe Commerce best practices:
CRITICAL: Always check project for coding standards files (phpcs.xml, .php-cs-fixer.php, .editorconfig) and enforce them rigorously.
FAQ
What does the magento-code-reviewer skill do?
Reviews Magento 2 code for quality, security, performance, and compliance with PSR-12 and Magento coding standards. Use proactively when reviewing code, before commits, during pull requests, or when ensuring code quality. Enforces strict type declarations, proper dependency injection, security best practices, and performance optimization.
How do I install magento-code-reviewer?
Run npx skills add https://github.com/maxnorm/magento2-agent-skills --skill magento-code-reviewer in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/magento-code-reviewer/ (personal) or .claude/skills/magento-code-reviewer/ (project).
Which AI agents can use magento-code-reviewer?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is magento-code-reviewer safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains magento-code-reviewer?
It is published by maxnorm in maxnorm/magento2-agent-skills. It has 477 recorded installs.
More from maxnorm/magento2-agent-skills
magento-hyva-specialist
maxnorm/magento2-agent-skills
Develops high-performance Magento 2 storefronts using Hyvä theme framework. Use when working with Hyvä themes, Alpine.js, Tailwind CSS, or modern frontend development. Masters Alpine.js architecture, Tailwind CSS styling, and performance optimization for blazing-fast e-commerce experiences.
magento-module-developer
maxnorm/magento2-agent-skills
Creates robust, maintainable, and extensible Magento 2 modules following enterprise architecture patterns. Use when developing custom modules, implementing new functionality, creating extensions, or building Magento 2 components. Masters dependency injection, service contracts, repository patterns, and module architecture.
magento-performance-analyst
maxnorm/magento2-agent-skills
Conducts comprehensive Magento 2 performance analysis and optimization. Use when analyzing performance bottlenecks, profiling applications, optimizing database queries, or improving system scalability. Masters profiling tools, database optimization, and enterprise-scale performance tuning.
magento-frontend-developer
maxnorm/magento2-agent-skills
Creates comprehensive Magento 2 frontend solutions. Use when developing frontend features, working with layout XML, templates, JavaScript, or responsive design. Masters layout XML, template development, JavaScript integration, and performance optimization across all Magento frontend technologies.
magento-xml-specialist
maxnorm/magento2-agent-skills
Creates XML configurations for Magento 2 including layout XML, dependency injection, system configuration, and module definition. Use when working with XML configuration files, layout XML, di.xml, or system.xml. Masters XML schema design, validation, and configuration management.
magento-issue-debugger
maxnorm/magento2-agent-skills
Systematically investigates, diagnoses, and resolves complex Magento 2 technical problems. Use when debugging issues, investigating bugs, analyzing performance problems, resolving errors, or troubleshooting system failures. Masters log analysis, performance profiling, and root cause analysis.
Popular security skills
azure-compliance
microsoft/azure-skills
Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.
minimal-run-and-audit
lllllllama/rigorpilot-skills
Rigor Run skill for README-first deep learning repo reproduction. Use when the task is specifically to capture or normalize evidence from the selected smoke test or documented inference or evaluation command and write standardized reprooutputs/ files, including patch notes when repository files changed. Do not use for training execution, initial repo intake, generic environment setup, paper lookup, target selection, hidden scientific-meaning changes, or end-to-end orchestration by itself.
seo-audit
coreyhaines31/marketingskills
When the user wants to audit, review, or diagnose SEO issues on their site. Also use when the user mentions "SEO audit," "technical SEO," "why am I not ranking," "SEO issues," "on-page SEO," "meta tags review," "SEO health check," "my traffic dropped," "lost rankings," "not showing up in Google," "site isn't ranking," "Google update hit me," "page speed," "core web vitals," "crawl errors," "indexing issues," "stuck on page 2," "striking distance keywords," "title tag rewrite," "low CTR," "local SEO," "Google Business Profile," or "map pack." Use this even if the user just says something vague like "my SEO is bad" or "help with SEO" — start with an audit. For building pages at scale to target keywords, see programmatic-seo. For adding structured data, see schema. For AI search optimization, see ai-seo.
firebase-security-rules-auditor
firebase/agent-skills
Audits Firebase (Firestore, Cloud Storage) security rules for vulnerabilities, privilege escalation, role bypasses, create vs update inconsistencies, resource exhaustion, type safety, size limits, and hasOnly ownership checks. Use when auditing/reviewing rules, running red-team rule assessments, or scoring against auditor checklists. Don't use for Firebase CLI (login, deploy), Auth, Crashlytics, Remote Config, or database queries.
audit
pbakaus/impeccable
Run technical quality checks across accessibility, performance, theming, responsive design, and anti-patterns. Generates a scored report with P0-P3 severity ratings and actionable plan. Use when the user wants an accessibility check, performance audit, or technical quality review.
competitors
coreyhaines31/marketingskills
When the user wants to create competitor comparison or alternative pages for SEO and buyer-facing use. Also use when the user mentions 'alternative page,' 'vs page,' 'competitor comparison,' 'comparison page,' '[Product] vs [Product],' '[Product] alternative,' 'competitive landing pages,' 'how do we compare to X,' 'competitor teardown,' 'audit our competitor pages,' 'are our comparison pages out of date,' or 'competitive asset audit.' Use this for any content that positions your product against competitors. Covers four formats: singular alternative, plural alternatives, you vs competitor, and competitor vs competitor. For auditing existing claims (not researching competitors from scratch, which is competitor-profiling; not technical SEO on these pages, which is seo-audit), use the asset audit here. For internal battle cards and sales-specific competitor docs, see sales-enablement.