phpstan-developer

Scaffold PHPStan rules, collectors, and extensions with tests and neon registrations.

25|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/peterfox/agent-skills --skill phpstan-developer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: phpstan-developer
Source: https://github.com/peterfox/agent-skills/tree/main/phpstan-developer
Command: npx skills add https://github.com/peterfox/agent-skills --skill phpstan-developer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Build PHPStan rules, collectors, and extensions that analyze PHP code for custom errors. Use when asked to create, modify, or explain PHPStan rules, collectors, or type extensions. Triggers on requests like "write a PHPStan rule to...", "create a PHPStan rule that...", "add a PHPStan rule for...", "write a collector for...", or when working on a phpstan extension package.

Core Features & Use Cases

  • Comprehensive scaffolding and guidance for rule, collector, and extension development.
  • Clear testing, neon registration, and documentation patterns to streamline integration into projects.
  • Use Case: A developer wants to add a new PHPStan rule to enforce a project-specific convention and needs end-to-end guidance from creation to tests.

Quick Start

Create a new PHPStan extension by following the scaffolding pattern and running tests to validate rules.

Frequently Asked Questions about phpstan-developer

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

FAQPage Schema
How do I create a custom PHPStan rule to enforce a project-specific convention?

Develop PHPStan collectors by following established scaffolding patterns to extract node data, registering the collector in your neon configuration, and writing tests to validate the collected information for consistent static analysis.

What is the best way to register a PHPStan extension in a neon configuration file?

Registering a PHPStan extension in a neon file requires specifying the extension class under the appropriate services key to ensure consistent integration. This establishes the required structure for maintainable extension packages.

How do you test PHPStan rules and extensions effectively?

Testing PHPStan rules involves applying established testing patterns to verify that your custom rules trigger the expected errors on target code. This ensures your static analysis extensions remain reliable and maintainable.

When do I need to use a PHPStan collector instead of a standard rule?

You need a PHPStan collector when your custom analysis requires gathering and aggregating data across multiple nodes before reporting an error, allowing your rules to evaluate broader code context within your extension package.

Does this PHPStan extension scaffolding work for both new and existing extension packages?

This scaffolding applies to both creating new PHPStan extensions and modifying existing ones by applying consistent structure, testing patterns, and neon registrations to ensure maintainable static analysis tooling across your projects.