php-quality-tooling

Configures PHPStan, Rector, and PHP-CS-Fixer with CI wiring for non-Laravel PHP projects.

1|Updated Jul 29, 2026
One-click install
npx skills add https://github.com/fusengine/kimi-code --skill php-quality-tooling-fusengine
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: php-quality-tooling
Source: https://github.com/fusengine/kimi-code/tree/main/plugins/php-expert/skills/php-quality-tooling
Command: npx skills add https://github.com/fusengine/kimi-code --skill php-quality-tooling-fusengine

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Setting up static analysis, automated refactoring, and code formatting on a framework-agnostic PHP project requires choosing correct PHPStan levels, Rector sets, and PHP-CS-Fixer rule sets, plus wiring them into CI in the right order. This Skill provides decision guides and ready-to-copy config templates so the three tools work together without overlap. ## Core Features & Use Cases - PHPStan configuration: Rule levels 0-10, baseline strategy for legacy code, strict-rules and Bleeding Edge options, with a complete phpstan.neon template. - Rector automation: PHP version upgrades via withPhpSets(), prepared sets for dead code and type coverage, and incremental level-by-level adoption for legacy codebases. - PHP-CS-Fixer setup: @PER-CS rule sets, risky-rule handling, and the Pint boundary for Laravel projects, plus a composer scripts and GitHub Actions CI pipeline template. - Use Case: You inherit a legacy PHP 8.1 codebase with no quality gates. Use this Skill to generate a baseline PHPStan config, adopt Rector one level per PR, enforce @PER-CS3.0 style, and gate everything in CI. ## Quick Start Ask the agent to set up PHPStan, Rector, and PHP-CS-Fixer with a CI pipeline on your non-Laravel PHP project.

Frequently Asked Questions about php-quality-tooling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up PHPStan on a legacy PHP project?▼

Start PHPStan at the highest level that currently passes, then generate a baseline with vendor/bin/phpstan analyse --generate-baseline to record existing errors. Raise the level one step per PR and shrink the baseline over time instead of lowering the level.

What is the difference between PHPStan, Rector, and PHP-CS-Fixer?▼

PHPStan performs static analysis and reports type bugs without editing code. Rector rewrites source for PHP upgrades and refactors, while PHP-CS-Fixer rewrites whitespace and style to a coding standard. They do not overlap, so a full setup runs all three.

Should I use PHP-CS-Fixer or Laravel Pint for code style?▼

Use Pint on Laravel projects since it is an official wrapper around PHP-CS-Fixer with a zero-config preset. Use PHP-CS-Fixer directly on any non-Laravel project. Never run both on the same repository because they will fight over the same files.

How do I run Rector safely without breaking my code?▼

Commit or stash your working tree first, then run vendor/bin/rector process --dry-run to preview the diff before applying changes. On legacy code, adopt changes incrementally with withTypeCoverageLevel or withPhpLevel one level per PR rather than enabling full prepared sets.

What PHPStan level should a new PHP project use?▼

Greenfield projects should start at level 8-9 or higher from day one since there is no existing debt to baseline. Add phpstan-strict-rules and enable Bleeding Edge for extra strictness, and install framework extensions like phpstan-doctrine for accurate third-party types.

In what order should PHP quality tools run in CI?▼

Run the cheapest check first: PHP-CS-Fixer check, then PHPStan analysis, then Rector --dry-run as a drift guard, and tests last. This fails fast on formatting diffs and runs the slowest test suite only on already-validated code.