wp-phpstan
Skill by benbalter
Guides an AI assistant through configuring, running and fixing PHPStan static analysis in WordPress plugins, themes and sites. It covers phpstan.neon setup, baselines, WordPress-specific typing and third-party plugin classes.
Install wp-phpstan
Built from the published package, never by AI.
git clone --depth 1 https://github.com/benbalter/wordpress-static-site-exporter /tmp/wordpress-static-site-exporter && mkdir -p ~/.claude/skills && cp -r /tmp/wordpress-static-site-exporter/.claude/skills/wp-phpstan ~/.claude/skills/wp-phpstanRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/benbalter/wordpress-static-site-exporter /tmp/wordpress-static-site-exporter && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/wordpress-static-site-exporter/.claude/skills/wp-phpstan ~/.gemini/antigravity-cli/skills/wp-phpstanAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
WP PHPStan is an agent skill for setting up, running and fixing PHPStan static analysis in WordPress plugins, themes and sites. It walks the assistant through phpstan.neon configuration, generating and reducing phpstan-baseline.neon files, and loading WordPress core stubs from szepeviktor/phpstan-wordpress or php-stubs/wordpress-stubs. The skill starts by running a bundled inspect script that reports the existing PHPStan setup, and it prefers the repo's own composer script when one exists.
The skill favors fixing errors with WordPress-aware PHPDoc, such as typing REST request parameters with WP_REST_Request, hook callback arguments, query result shapes and Action Scheduler job arguments. For third-party plugin classes it suggests existing vendor stubs first, and only then narrow ignoreErrors patterns. It is aimed at developers working on WordPress codebases that use Composer-based PHPStan.
Written from the project's SKILL.md and checked against it.
What it can do
- Inspect PHPStan setupRuns a bundled inspect script to report the PHPStan config, baseline and scripts.
- Load WordPress core stubsChecks for szepeviktor/phpstan-wordpress or php-stubs/wordpress-stubs and the config reference to them.
- Configure phpstan.neonKeeps paths on first-party code and excludes vendored, generated and test code.
- WordPress-specific typingAdds PHPDoc for REST requests, hook callbacks, query results and Action Scheduler jobs.
- Handle third-party classesUses existing plugin stubs first, then adds targeted ignoreErrors patterns if needed.
- Manage baselinesGenerates a baseline for legacy code and reduces it over time without baselining new errors.
What you need
- Composer-based PHPStan
- WordPress 6.9 or later (compatibility target)
- PHP 7.2.24 or later
- Node.js to run the inspect script
Try asking
- Set up phpstan.neon for my WordPress plugin and exclude vendor code.
- Fix the PHPStan errors in my REST endpoint by adding WP_REST_Request types.
- Generate a phpstan baseline for my legacy theme and show how to reduce it.
Good to know
- Adding Composer dev dependencies such as stubs needs user confirmation first.
- New errors should be fixed, not added to the baseline.
- Ignore patterns should be re-checked so they do not mask unrelated issues.
- Types tied to third-party plugin APIs should not be invented without a confirmed version or source.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .claude/skills/wp-phpstan/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md4 KB -
references/configuration.md1 KB -
references/third-party-classes.md3 KB -
references/wordpress-annotations.md3 KB -
scripts/phpstan_inspect.mjs8 KB
Alternatives to wp-phpstan
All alternatives →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
Compare with agent-reproduce-align, google_contacts or m06-error-handling
wp-phpstan: common questions
Does this skill need WordPress stubs?
The source says szepeviktor/phpstan-wordpress or php-stubs/wordpress-stubs are effectively required for most WordPress plugin and theme repos. Without them, expect many errors about unknown WordPress core functions.
Which WordPress and PHP versions does it target?
The compatibility field says it targets WordPress 6.9 and later, with PHP 7.2.24 and later. It requires Composer-based PHPStan.
How does it handle third-party plugin classes?
It first confirms the dependency is installed, then prefers existing plugin stubs such as php-stubs/woocommerce-stubs or php-stubs/acf-pro-stubs. Narrow ignoreErrors patterns are added only if PHPStan still cannot resolve the classes.
How do I install wp-phpstan?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is wp-phpstan free?
The code is published under the GPL-3.0 licence. The service it connects to may have its own pricing.
Is wp-phpstan safe to use?
It scores 80 of 100. Grades: maintenance A, licence C, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to wp-phpstan?
Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.
