Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

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.

  • Score 80
  • 1.1k stars
  • GPL-3.0
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

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-phpstan

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install wp-phpstan in Claude Code

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

A

No 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 →

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.

wp-phpstan Install

Add to stack

Loading.