wp-phpstan — Claude Code skill: what it does, how to install
Sets up PHPStan static analysis in WordPress plugins and themes, while managing baselines and WordPress-specific PHPDoc types.
npx skills add WordPress/agent-skills --skill wp-phpstan -a claude-codeWhat wp-phpstan does
This skill guides PHPStan static analysis setup across WordPress plugins and themes. It inspects existing configurations using node skills/wp-phpstan/scripts/phpstan_inspect.mjs and verifies that core stub packages like szepeviktor/phpstan-wordpress are installed. Missing stubs cause massive volumes of false errors on native WordPress functions. Analysis paths stay focused on custom code, while directories like vendor/ and node_modules/ stay excluded.
Instead of suppressing errors with blanket ignores, the skill introduces WordPress-specific PHPDoc annotations. It adds precise parameter types to hook callbacks and sets generic arguments on WP_REST_Request. For external integrations like WooCommerce or ACF, it relies on dedicated stubs from Composer. Because it targets WordPress 7.0+ and PHP 7.4.0+ with Composer-based PHPStan, projects without Composer cannot use this workflow.
Baselines in phpstan-baseline.neon serve strictly as migration aids for legacy code. Newly introduced errors cannot be baselined.
What it helps with
- configure
phpstan.neonfor WordPress plugins or themes - generate a
phpstan-baseline.neonfile for legacy code - type hook callback parameters and
WP_REST_Requestpayloads - resolve third-party classes with stubs like WooCommerce or ACF
Example prompts for the agent
- Inspect our phpstan.neon configuration and fix the vendor paths
- Fix hook callback type errors and update the PHPStan baseline
- Add WooCommerce stubs to resolve missing third-party classes
How to install wp-phpstan
1Skills CLI (Vercel)
npx skills add WordPress/agent-skills --skill wp-phpstan -a claude-code2Manually: put the files in place
~/.claude/skills/wp-phpstan/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/wp-phpstan/
1Skills CLI (Vercel)
npx skills add WordPress/agent-skills --skill wp-phpstan -a codex2Manually: put the files in place
.agents/skills/wp-phpstan/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add WordPress/agent-skills --skill wp-phpstan -a cursor2Manually: put the files in place
.cursor/skills/wp-phpstan/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install WordPress/agent-skills wp-phpstan2Manually: put the files in place
.github/skills/wp-phpstan/SKILL.md1Skills CLI (Vercel)
npx skills add WordPress/agent-skills --skill wp-phpstan -a gemini-cli2Platform CLI
gemini skills install https://github.com/WordPress/agent-skills --path skills/wp-phpstanManually: put the files in place
.devin/skills/wp-phpstan/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add WordPress/agent-skills --skill wp-phpstan -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set8
The whole set →Similar
Questions about wp-phpstan
How to install wp-phpstan in Claude Code?
Run the command npx skills add WordPress/agent-skills --skill wp-phpstan -a claude-code.
What does wp-phpstan do?
It inspects phpstan.neon, verifies WordPress core stubs, manages the baseline, and adds PHPDoc types for hooks and REST API endpoints.
What are the requirements for wp-phpstan?
The project must target WordPress 7.0+ on PHP 7.4.0+ with Composer-managed PHPStan. Core stubs such as szepeviktor/phpstan-wordpress or php-stubs/wordpress-stubs are also necessary.