magento-code-reviewer
FreeNo executable scriptsNot checkedReviews Magento 2 code for quality, security, performance, and compliance with PSR-12 and Magento coding standards. Use proactively when reviewing code…
by maxnorm★ 34 GitHub starsAbout this skill
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
Install magento-code-reviewer in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
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 the magento-code-reviewer skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the magento-code-reviewer skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic