wordpress avatar

Wp Phpstan

Configures and manages PHPStan static analysis for WordPress plugins and themes, handling the quirks that make WordPress codebases tricky to analyze. It sets up phpstan.neon files with WordPress core stubs, fixes type errors using WP-specific annotations for REST requests and hook callbacks, and deals with third-party plugin classes that aren't present during analysis. The baseline management approach is sensible: treat it as a migration tool for legacy code, not a place to hide new errors. Most useful when you're adding PHPStan to an existing WordPress project or trying to reduce a massive error count without resorting to ignore-everything patterns.

skills.sh installs
4.9K
GitHub stars
2.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add wordpress/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/wordpress/agent-skills
Categories
AI & Agent Building, PHP & Laravel, Databases
First seen
Apr 16, 2026

More from wordpress/agent-skills

All 17
1figma avatarfigma-generate-libraryfigma/mcp-server-guideBuild or update a professional-grade design system in Figma from a codebase. Use when the user wants to create variables/tokens, build component libraries, crea4.7Kskills.sh installs
2shubhamsaboo avatarcontent-creatorshubhamsaboo/awesome-llm-appsCreates engaging content for blogs, social media, and marketing materials with audience focus. Use when: writing blog posts, creating social media content, deve4.7Kskills.sh installs
3elastic avatarkibana-dashboardselastic/agent-skillsCreate and manage Kibana Dashboards and visualizations. Use when you need to define dashboards and visualizations declaratively, version control them, or automa4.6Kskills.sh installs
4wordpress avatarwp-abilities-apiwordpress/agent-skillsUse when working with the WordPress Abilities API (wp_register_ability, wp_register_ability_category, /wp-json/wp-abilities/v1/*, @wordpress/abilities) includin4.6Kskills.sh installs
5shubhamsaboo avatarcode-reviewershubhamsaboo/awesome-llm-appsThorough code review with focus on security, performance, and best practices. Use when: reviewing code, performing security audits, checking for code quality, r4.6Kskills.sh installs
6clickhouse avatarclickhousectl-local-devclickhouse/agent-skillsUse when a user wants to build an application with ClickHouse, set up a local ClickHouse development environment, install ClickHouse, create a local server, cre4.5Kskills.sh installs