Skip to content
automattic avatar

Wp Phpstan

Configure, run, and fix PHPStan static analysis in WordPress plugins, themes, and sites with WordPress-specific typing.

CCM score
55 of 100
skills.sh installs
388
GitHub stars
211
last updated
Jun 3, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers phpstan.neon setup, baseline generation and reduction, WordPress-specific PHPDoc typing, and handling of third-party plugin and theme classes
  • Includes an inspection script (phpstan_inspect.mjs) that reports PHPStan config, baseline, and composer script entrypoints, and reference guides for configuration, annotations, and third-party classes
  • Enforces WordPress core stubs via szepeviktor/phpstan-wordpress or php-stubs/wordpress-stubs and requires confirmation before adding new Composer dependencies
  • Designed for WordPress 6.9+ projects (PHP 7.2.24+) that use Composer-based PHPStan

Install

$ npx -y skills add automattic/agent-skills --skill wp-phpstan -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

WP PHPStan

When to use

Use this skill when working on PHPStan in a WordPress codebase, for example:

  • setting up or updating phpstan.neon / phpstan.neon.dist
  • generating or updating phpstan-baseline.neon
  • fixing PHPStan errors via WordPress-friendly PHPDoc (REST requests, hooks, query results)
  • handling third-party plugin/theme classes safely (stubs/autoload/targeted ignores)

Inputs required

  • wp-project-triage output (run first if you haven't)
  • Whether adding/updating Composer dev dependencies is allowed (stubs).
  • Whether changing the baseline is allowed for this task.

Procedure

0) Discover PHPStan entrypoints (deterministic)

  1. Inspect PHPStan setup (config, baseline, scripts):
    • node skills/wp-phpstan/scripts/phpstan_inspect.mjs

Prefer the repo’s existing composer script (e.g. composer run phpstan) when present.

1) Ensure WordPress core stubs are loaded

szepeviktor/phpstan-wordpress or php-stubs/wordpress-stubs are effectively required for most WordPress plugin/theme repos. Without it, expect a high volume of errors about unknown WordPress core functions.

Details

Repository
github.com/automattic/agent-skills
Categories
PHP & Laravel, Code Review & Quality
First seen
Jun 3, 2026

Questions

What does the wp-phpstan skill do?

The wp-phpstan skill guides an agent through configuring, running, and fixing PHPStan static analysis in WordPress plugins, themes, and sites. It covers phpstan.neon setup, baselines, WordPress-specific typing for REST requests and hooks, and handling third-party plugin classes.

How do I install wp-phpstan?

Run npx -y skills add automattic/agent-skills --skill wp-phpstan -y in a project to install it. Once installed, the wp-phpstan skill lets the agent work through PHPStan setup and error fixes in that WordPress project.

Where does wp-phpstan rank in its category?

wp-phpstan is in the PHP and Laravel category and ranks in the top 100 on its category page. It sits alongside skills such as laravel-specialist and php-pro, but focuses on PHPStan in WordPress codebases rather than Laravel.

What does wp-phpstan need before it runs?

The wp-phpstan skill targets WordPress 6.9 and later with PHP 7.2.24 or later, and it requires a Composer-based PHPStan setup. It also expects WordPress core stubs such as szepeviktor/phpstan-wordpress or php-stubs/wordpress-stubs to be installed.

More from automattic/agent-skills

All 12

Similar to Wp Phpstan

More PHP & Laravel