This skill automates comprehensive code quality checks for Magento 2 projects.
What This Skill Does
-
PSR-12 Compliance Check
- Validates strict PSR-12 adherence
- Checks opening braces placement
- Validates spacing and indentation
- Verifies proper use statement ordering
-
PHPStan Static Analysis
- Type checking at maximum level
- Identifies potential bugs and errors
- Validates method signatures and return types
- Checks for undefined variables and methods
-
PHP_CodeSniffer (Magento2 Standard)
- Enforces Magento2 coding standards
- Validates dependency injection patterns
- Checks service contract usage
- Verifies plugin and observer implementation
-
PHP Mess Detector
- Identifies code complexity issues
- Detects unused code and parameters
- Highlights potential design problems
- Suggests refactoring opportunities
Usage
When invoked, this skill will:
- Run
vendor/bin/php-cs-fixer fix --dry-run --diffto check PSR-12 compliance - Execute
vendor/bin/phpstan analyse -c phpstan.neonfor static analysis - Run
vendor/bin/phpcs --standard=Magento2 app/code/for Magento standards - Execute
vendor/bin/phpmd app/code/ text cleancode,codesize,design,naming,unusedcode
Output
The skill provides:
- List of violations with file paths and line numbers
- Severity classification (Critical, High, Medium, Low)
- Specific recommendations for fixes
- Code examples of proper implementations
When to Use
- Before code review submissions
- After implementing new features or modules
- During pull request validation
- Before production deployments
- As part of CI/CD pipeline validation