
Wp Phpstan
Configures and fixes PHPStan static analysis in WordPress plugins, themes, and sites. You'll reach for this when setting up phpstan.neon files, managing baselines, or clearing out type errors that stem from WordPress's dynamic API (REST requests, hook callbacks, database queries). It knows the common pain points: making sure WordPress core stubs are loaded, typing WP_REST_Request parameters properly, and handling third-party plugin classes that aren't present during analysis. The skill treats baselines as migration tools, not permanent error suppression, and pushes you toward proper PHPDoc annotations instead of ignoring legitimate type issues. Assumes Composer-based PHPStan and WordPress 6.9 or later.
- skills.sh installs
- 368
- GitHub stars
- 211
- last updated
- Jun 3, 2026
Install
$ npx -y skills add automattic/agent-skills --skill wp-phpstan --agent claude-codeInstalls into .claude/skills of the current project.
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-triageoutput (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)
- 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.
Sponsors
Details
- Repository
- github.com/automattic/agent-skills
- Category
- AI & Agent Building
- First seen
- Jun 3, 2026