Audits PSR compliance in PHP projects: checks PSR-1/PSR-12 coding style, PSR-4 autoloading, and PSR interface implementations. Supports quick/standard/deep levels with severity-ranked issues and fixes.
From accnpx claudepluginhub dykyi-roman/awesome-claude-code --plugin acc<path> [level] [-- meta-instructions]opusPerform a comprehensive PSR compliance audit with actionable improvement recommendations.
Parse $ARGUMENTS to extract path, level, and optional meta-instructions:
Format: <path> [level] [-- <meta-instructions>]
Arguments:
- path: Target directory or file (required, default: current directory)
- level: Audit depth - quick|standard|deep (optional, default: standard)
- -- meta-instructions: Additional focus areas or filters (optional)
Examples:
- /acc:audit-psr ./src
- /acc:audit-psr ./src deep
- /acc:audit-psr ./src quick
- /acc:audit-psr ./src -- focus on PSR-12 only
- /acc:audit-psr ./src deep -- focus on interfaces
- /acc:audit-psr ./src -- level:deep (backward compatible)
Parsing rules:
$ARGUMENTS by -- (space-dash-dash-space)quick|standard|deep)level:quick|standard|deep in meta-instructions (backward compatibility)standard)Verify the path exists:
$ARGUMENTS is empty, audit current directoryVerify it's a PHP project:
composer.json or *.php filesCheck PSR tooling:
.php-cs-fixer.php, phpcs.xml, phpstan.neoncomposer.json (psr/log, psr/cache, psr/http-message, etc.)Level is an optional positional parameter. Default: standard.
| Level | Scope | What's Checked |
|---|---|---|
quick | Structure only | declare(strict_types=1), namespace conventions, basic naming |
standard | Full analysis | PSR-1/12 coding style, PSR-4 autoloading, interface detection, file:line references |
deep | Standard + quality | Standard + PSR interface implementation quality, method signatures, return types, docblock compliance |
| Level | Symbol | Criteria |
|---|---|---|
| Critical | π΄ | Missing strict_types, wrong namespace-to-path mapping, broken autoloading |
| High | π | PSR-12 violations (indentation, line length, brace placement) |
| Medium | π‘ | Naming convention issues, missing type declarations |
| Low | π’ | Style suggestions, optional improvements |
| Instruction | Effect |
|---|---|
focus on PSR-12 | Deep PSR-12 coding style analysis |
focus on interfaces | Analyze PSR interface implementations in depth |
skip autoloading | Exclude PSR-4 autoloading checks |
PSR-12 only | Only check PSR-12 coding style |
level:quick | Quick audit (same as positional quick) |
level:standard | Standard audit (same as positional standard) |
level:deep | Deep audit (same as positional deep) |
detailed report | Maximum detail in report |
Π½Π° ΡΡΡΡΠΊΠΎΠΌ | Report in Russian |
Use the acc:psr-auditor agent to perform a comprehensive PSR compliance audit:
Task tool with subagent_type="acc:psr-auditor"
prompt: "Perform PSR compliance audit on [PATH]. Audit level: [LEVEL]. [META-INSTRUCTIONS if provided]
Use TaskCreate/TaskUpdate for progress visibility. Create tasks for each audit phase.
Analyze:
1. PSR-1/PSR-12 Coding Style β strict_types, naming (PascalCase classes, camelCase methods, UPPER_CASE constants), indentation, line length, brace placement
2. PSR-4 Autoloading β composer autoload config, namespace-to-path mapping, file naming
3. PSR Interface Implementations β detect PSR-3, PSR-6, PSR-7, PSR-11, PSR-13, PSR-14, PSR-15, PSR-16, PSR-17, PSR-18, PSR-20 usage and quality
For each violation provide:
- Severity (π΄/π /π‘/π’)
- File:line location
- What's wrong and how to fix it
Generate a detailed report with skill recommendations."
If no path is provided, audit the current project root.
declare(strict_types=1) usage# PSR Compliance Audit Report
**Project:** [NAME] | **Date:** [DATE] | **Level:** [quick|standard|deep]
## 1. Executive Summary
| Category | Score | π΄ | π | π‘ | π’ |
|----------|-------|-----|-----|-----|-----|
| PSR-1 Basic | X/100 | N | N | N | N |
| PSR-12 Style | X/100 | N | N | N | N |
| PSR-4 Autoloading | X/100 | N | N | N | N |
| PSR Interfaces | X/100 | N | N | N | N |
**Overall Score:** X/100 | **Risk Level:** LOW/MEDIUM/HIGH/CRITICAL
## 2. PSR-1/PSR-12 Compliance
### π΄ Critical Issues
- **Location:** `file.php:line` β Missing `declare(strict_types=1)` β Add declaration
### π High Priority
- **Location:** `file.php:line` β Wrong brace placement β Move to next line
### π‘ Medium
- **Location:** `file.php:line` β Method naming β Rename to camelCase
## 3. PSR-4 Autoloading
| Namespace | Path | Status |
|-----------|------|--------|
| App\Domain | src/Domain/ | β
|
| App\Infra | src/Infrastructure/ | π Mismatch |
## 4. PSR Interface Detection
| PSR | Package | Implemented | Quality |
|-----|---------|-------------|---------|
| PSR-3 | psr/log | β
| Good |
| PSR-7 | β | β Not found | β |
| PSR-11 | psr/container | β
| Good |
## 5. Skill Recommendations
| Gap | Skill | Command |
|-----|-------|---------|
| No PSR-3 logger | `acc:create-psr3-logger` | `/acc:generate-psr logger` |
| No PSR-7 messages | `acc:create-psr7-http-message` | `/acc:generate-psr http-message` |
| No PSR-15 middleware | `acc:create-psr15-middleware` | `/acc:generate-psr middleware` |
## 6. Action Items
1. π΄ Add `declare(strict_types=1)` to N files
2. π Fix PSR-12 brace placement in N files
3. π‘ Rename N methods to camelCase
4. π’ Consider implementing PSR-3 logger
# Standard audit (default)
/acc:audit-psr ./src
# Quick check
/acc:audit-psr ./src quick
# Deep analysis with interface quality
/acc:audit-psr ./src deep
# Focus on specific PSR
/acc:audit-psr ./src -- focus on PSR-12 only
# Deep + focus
/acc:audit-psr ./src deep -- focus on interfaces
# Backward compatible
/acc:audit-psr ./src -- level:deep