phpstan-developer

Installation
SKILL.md

PHPStan Extension Builder

PHPStan finds bugs by traversing the PHP-Parser AST, resolving types via PHPStan's type system, and reporting errors from processNode().

Workflow

  1. Identify the PHP-Parser node type to target — use var_dump(get_class($node)) with Node::class as a temporary getNodeType() to discover node types, or check the php-parser docs
  2. For cross-file analysis (e.g. "find unused things", "check all calls to X"), use a Collector to gather data and a CollectedDataNode rule to report — see references/collectors.md
  3. Write the Rule class extending nothing — implement Rule interface directly
  4. Write the test class extending RuleTestCase with fixture PHP files
  5. Register the rule in a neon config file

Rule Skeleton

<?php

declare(strict_types=1);
Related skills

More from peterfox/agent-skills

Installs
10
GitHub Stars
11
First Seen
Mar 5, 2026