wp-phpstan
Skill19 starsChanged 20 days agoMITView on GitHub
Use when configuring, running, or fixing PHPStan static analysis in WordPress projects (plugins/themes/sites): phpstan.neon setup, baselines, WordPress-specific typing, and handling third-party plugin classes.
4 other projects use a version of this, 4 of them edited.
Adopted by
Most recently taken up by
- shinobiashi/claude-skillsedited, first seen Oct 8, 2026
- morrealev/wordpress-manageredited, first seen Mar 1, 2026
- eugenepyvovarov/mcpbundler-agent-skills-marketplaceedited, first seen Feb 15, 2026
- WordPress/agent-skillsedited, first seen Dec 23, 2025
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 4
- WordPress/agent-skills★ 2.3k97% same
- eugenepyvovarov/mcpbundler-agent-skills-marketplace★ 1297% same
- morrealev/wordpress-manager★ 891% same
- shinobiashi/claude-skills★ 094% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository120 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- adaptSkill
- animateSkill
- auditSkill
- ckm:banner-designSkill
- bolderSkill
- cinematic-editorial-graphicsSkill
- colorizeSkill
- critiqueSkill
- delightSkill
- ckm:designSkill
- ckm:design-systemSkill
- desktop-app-showcaseSkill
- distillSkill
- extractSkill
- featured-image-creatorSkill
- frontend-designSkill
- hand-drawn-explainersSkill
- hardenSkill
- modern-frontend-designSkill
- monoline-iconsSkill
- normalizeSkill
- onboardSkill
- polishSkill
- quieterSkill
- saas-product-graphicsSkill
- svg-graphicsSkill
- teach-impeccableSkill
- ui-design-brainSkill
- ui-skillsSkill
- ckm:ui-stylingSkill
- ui-ux-pro-maxSkill
- elementor-to-generateblocksSkill
- figma-to-generateblocksSkill
- html-to-generateblocksSkill
- just-htmlSkill
- react-pdfSkill
- ab-test-setupSkill
- ad-creativeSkill
- ckm:brandSkill
- churn-preventionSkill
- clarifySkill
- cold-emailSkill
- competitor-alternativesSkill
- content-strategySkill
- copy-editingSkill
- copywritingSkill
- email-sequenceSkill
- form-croSkill
- free-tool-strategySkill
- launch-strategySkill
- marketing-ideasSkill
- marketing-psychologySkill
- mkbhd-voiceSkill
- omm-styleSkill
- onboarding-croSkill
- page-croSkill
- paid-adsSkill
- paywall-upgrade-croSkill
- popup-croSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. 7 are common, 0 are distinctive, and 7 are very specific to this project.
7
Common
Most of the 4 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Common: line 14
Use this skill when working on PHPStan in a WordPress codebase, for example:
- Very specific: line 33
Prefer the repo’s existing composer script (e.g.
- Very specific: line 40
Ensure the PHPStan config references the stubs (see references/third-party-classes.md).
- Very specific: line 44
Keep paths focused on first-party code (plugin/theme directories).
- Very specific: line 46
Keep ignoreErrors entries narrow and documented.
- Common: line 53
Prefer correcting types over ignoring errors.
- Common: line 65
When integrating with plugins/themes not present in the analysis environment:
- Very specific: line 68
Prefer plugin-specific stubs already used in the repo (common examples: php-stubs/woocommerce-stubs, php-stubs/acf-pro-stubs).
- Very specific: line 69
If PHPStan still cannot resolve classes, add targeted ignoreErrors patterns for the specific vendor prefix.
- Common: line 77
Do not “baseline” newly introduced errors.
- Very specific: line 84
Run PHPStan using the discovered command (composer run ...
- Common: line 95
add explicit PHPDoc (see references) rather than runtime guards
- Common: line 99
If a type depends on a third-party plugin API you can’t confirm, ask for the dependency version or source before inventing types.
- Common: line 100
If fixing requires adding new Composer dependencies (stubs/extensions), confirm it with the user first.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
From Agent Skills for WordPress. Copyright (C) 2026 WordPress Contributors, licensed under GPL-2.0-or-later. Changed from upstream: the
compatibility:frontmatter line was dropped when this copy was made in March 2026, and license frontmatter plus this notice were added on 2026-10-24. See NOTICE.md.
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-triageoutput (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)
- 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.
- Confirm the package is installed (see
composer.dependenciesin the inspect report). - Ensure the PHPStan config references the stubs (see
references/third-party-classes.md).
2) Ensure a sane phpstan.neon for WordPress projects
- Keep
pathsfocused on first-party code (plugin/theme directories). - Exclude generated and vendored code (
vendor/,node_modules/, build artifacts, tests unless explicitly analyzed). - Keep
ignoreErrorsentries narrow and documented.
See:
references/configuration.md
3) Fix errors with WordPress-specific typing (preferred)
Prefer correcting types over ignoring errors. Common WP patterns that need help:
- REST endpoints: type request parameters using
WP_REST_Request<...> - Hook callbacks: add accurate
@paramtypes for callback args - Database results and iterables: use array shapes or object shapes for query results
- Action Scheduler: type
$argsarray shapes for job callbacks
See:
references/wordpress-annotations.md
4) Handle third-party plugin/theme classes (only when needed)
When integrating with plugins/themes not present in the analysis environment:
- First, confirm the dependency is real (installed/required).
- Prefer plugin-specific stubs already used in the repo (common examples:
php-stubs/woocommerce-stubs,php-stubs/acf-pro-stubs). - If PHPStan still cannot resolve classes, add targeted
ignoreErrorspatterns for the specific vendor prefix.
See:
references/third-party-classes.md
5) Baseline management (use as a migration tool, not a trash bin)
- Generate a baseline once for legacy code, then reduce it over time.
- Do not “baseline” newly introduced errors.
See:
references/configuration.md
Verification
- Run PHPStan using the discovered command (
composer run ...orvendor/bin/phpstan analyse). - Confirm the baseline file (if used) is included and didn’t grow unexpectedly.
- Re-run after changing
ignoreErrorsto ensure patterns are not masking unrelated issues.
Failure modes / debugging
- “Class not found”:
- confirm autoloading/stubs, or add a narrow ignore pattern
- Huge error counts after enabling PHPStan:
- reduce
paths, addexcludePaths, start at a lower level, then ratchet up
- reduce
- Inconsistent types around hooks / REST params:
- add explicit PHPDoc (see references) rather than runtime guards
Escalation
- If a type depends on a third-party plugin API you can’t confirm, ask for the dependency version or source before inventing types.
- If fixing requires adding new Composer dependencies (stubs/extensions), confirm it with the user first.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

