一键导入
install-php-fixer
Install nette/coding-standard globally for PHP code style checking
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Install nette/coding-standard globally for PHP code style checking
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Invoke BEFORE running PHPStan or fixing PHPStan errors. Covers error resolution strategy (refactoring > phpDoc > ignoring), common Nette error patterns, baseline management, and type tests. Use this whenever the user mentions PHPStan, static analysis, type errors, wants to suppress warnings, or manage the baseline - even for a single error.
CRITICAL: Read BEFORE writing or modifying any PHP file. A PostToolUse hook automatically runs nette/coding-standard (ECS) on every PHP file after each Edit or Write. 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.
Invoke BEFORE writing or modifying any PHP code. Provides coding standards and naming conventions for Nette repos: TABs, single quotes, strict_types, PSR-12 modifications, use statement ordering. Use this whenever creating, modifying, or refactoring any PHP code - even small bug fixes or one-line changes.
Invoke BEFORE writing phpDoc. Provides Nette conventions for docblocks: when to skip documentation, class/method/property/exception docs, generic array types (array<T>, list<T>), conditional return types. Use this whenever writing or editing any /** */ comment - even when the user just says "document this" without mentioning phpDoc.
Invoke before creating or modifying .latte files, even for single-line changes. Provides Latte syntax, tags, filters, n:attributes, layouts, template inheritance, AJAX snippets, extensions, and Nette integration. Also trigger when user mentions Latte by name.
Invoke before designing presenters, modules, or application structure in web application. Use when asking about directory structure (app/ folder organization), presenter organization (modules, Admin/Front/Api, BasePresenter), domain-driven placement (Core/ vs Model/), component and factory placement, presenter lifecycle (action/render/template), CLI tasks, Accessory placement, project skeleton, or refactoring architecture. Also trigger when starting a new Nette project.
| name | install-php-fixer |
| description | Install nette/coding-standard globally for PHP code style checking |
| allowed-tools | Bash, Read, AskUserQuestion |
| disable-model-invocation | true |
Install the nette/coding-standard package globally to enable automatic PHP code style checking and fixing.
Check PHP availability (requires PHP 8.0+)
php --version
Check Composer availability
composer --version
Detect existing installation
composer global show nette/coding-standard 2>/dev/null
Allow the required plugin (needed for global installation)
composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
Install the coding standard
composer global require nette/coding-standard
Run ecs from the Composer global bin directory to verify it works:
# Unix
$(composer global config home)/vendor/bin/ecs --version
# Windows
php "$(composer global config home)/vendor/bin/ecs" --version
The fix-php-style hook finds ecs automatically in the Composer home directory – PATH configuration is not needed.
If verification succeeds, confirm to the user that Nette Coding Standard is installed and the fix-php-style hook will automatically fix code style after editing PHP files.
Check if gh CLI is available
gh --version
If gh is available, use AskUserQuestion:
Only if user explicitly says yes, run:
gh api -X PUT /user/starred/nette/coding-standard
gh api -X PUT /user/starred/nette/claude-code
sudo chown -R $(whoami) "$(composer global config home)"