automattic avatar

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

Installs 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-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.

Sponsors

Details

Repository
github.com/automattic/agent-skills
Category
AI & Agent Building
First seen
Jun 3, 2026

More from automattic/agent-skills

All 12
1jwynia avatardependency-scanjwynia/agent-skillsDetect CVEs and security issues in project dependencies. Use when you need to analyze packages for known vulnerabilities across npm, pip, cargo, and other ecosy368skills.sh installs
2mrexodia avataridapythonmrexodia/ida-pro-mcpidapython368skills.sh installs
3tech-leads-club avatardomain-analysistech-leads-club/agent-skillsMaps business domains and suggests service boundaries in any codebase using DDD Strategic Design. Use when asking "what are the domains in this codebase?", "whe368skills.sh installs
4buiducnhat avatarquick-implementbuiducnhat/agent-skillsquick implement367skills.sh installs
5krutikjain avatarandroid-di-hiltkrutikjain/android-agent-skillsWire Android dependency injection with Hilt, scopes, testing overrides, and module ownership boundaries.367skills.sh installs
6laravel avatardeploying-laravel-cloudlaravel/agent-skillsDeploys and manages Laravel applications on Laravel Cloud using the `cloud` CLI. Use when the user wants to deploy an app, ship to cloud, create/manage environm364skills.sh installs