← ClaudeAtlas

php-auto-fixerlisted

CRITICAL: Read BEFORE writing or modifying any PHP file. A PostToolUse hook automatically runs nette/coding-standard (ECS) on PHP files after Claude Code Edit/Write or Codex apply_patch (when hooks are enabled and trusted). The fixer removes unused `use` statements - so never add `use` statements in a separate edit before the code that references them. Always include `use` imports in the same edit as the referencing code, or add the code first then `use` statements. This skill should be used whenever creating new PHP files, editing existing PHP code, adding methods, refactoring, or fixing bugs in PHP - even for small one-line changes.
nette/agent-plugins · ★ 44 · AI & Automation · score 81
Install: claude install-skill nette/agent-plugins
# PHP Auto-Fixer A PostToolUse hook runs `ecs fix` after Claude Code `Edit`/`Write` or Codex `apply_patch` operations. A patch may edit multiple PHP files; the hook processes each one. In Codex, hooks must first be reviewed and trusted via `/hooks`. Edits made through shell commands are not covered, so run the project's fixer explicitly after those edits. ## Editing Order for `use` Statements The fixer removes any `use` statement not referenced in the file. A `use` added in one edit and the code that needs it in the next therefore loses the import in between. Always add `use` statements in the same Edit as the code that references them, or add the code first and the `use` second. Never add `use` statements alone in a separate Edit before the code. ## What the Fixer Does - Removes unused `use` statements and sorts the rest - Fixes indentation, spacing and line breaks - Enforces PSR-12 with Nette modifications (e.g., no space before parentheses in arrow functions) When the hook is active, let the fixer handle formatting and removal or sorting of `use` statements. If the hook is unavailable or the edit was made through the shell, run the project's fixer explicitly. ## When the Fixer Reports Errors When ECS cannot fix everything, the hook reports "Could not fix all coding standard issues in <file>" followed by the remaining violations; fix them by hand. A file that is not valid PHP is skipped without a report. ## Excluding Paths To stop the fixer from touching certain