wp-phpstan-static-analysis

wp-phpstan-static-analysis is a skill for Claude Code, Codex from Lonsdale201/wp-agent-skills. It costs 227 tokens per session (2,518 once invoked), scanned A, original, MIT.

A guide for running PHPStan static analysis on a WordPress plugin or theme. PHPStan finds likely type and logic errors without running the code, while WordPress stubs describe WordPress functions and classes for the checker.

In plain words
What is it for?
It is for adding or configuring phpstan.neon, installing WordPress-aware analysis dependencies, raising analysis strictness, and handling issues involving filters, errors, the database object, and conditional constants.
Why use it?
It sets up the missing WordPress definitions and explains how to reduce framework-specific false alarms, while separating type checks from coding-style checks.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for adding or configuring phpstan.neon, installing WordPress-aware analysis dependencies, raising analysis strictness, and handling issues involving filters, errors, the database object, and conditional constants.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lonsdale201/wp-agent-skills/wp-phpstan-static-analysis
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Lonsdale201/wp-agent-skills --skill wp-phpstan-static-analysis
Clone the repo
git clone --depth 1 https://github.com/Lonsdale201/wp-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for wp-phpstan-static-analysis

README.md
[![agentmods](https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/wp-phpstan-static-analysis/github.svg)](https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wp-phpstan-static-analysis)
Your own site
<a href="https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wp-phpstan-static-analysis"><img src="https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/wp-phpstan-static-analysis/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for wp-phpstan-static-analysis

Your own site · 80×15
<a href="https://agentmods.dev/skills/lonsdale201/wp-agent-skills/wp-phpstan-static-analysis"><img src="https://agentmods.dev/badge/skills/lonsdale201/wp-agent-skills/wp-phpstan-static-analysis.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 227 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,518 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00227 $0.02518
Opus 5 $0.00113 $0.01259
Sonnet 5 $0.00045 $0.00504
Haiku 4.5 $0.00023 $0.00252

Measured 8d ago against content hash 235984545aae, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

wp-phpstan-static-analysis scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

dev-tooling/wp-phpstan-static-analysis/SKILL.md · 197 lines

How it starts

The opening of the file, as written. The whole thing — 197 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PHPStan static analysis for WordPress

PHPStan catches type errors, dead code, and bad calls without running anything. It doesn't load WordPress, so it needs stubs for core's functions/classes — szepeviktor/phpstan-wordpress provides those plus WP-aware rules. This skill wires it up and tames the WP-specific noise. PHPCS (wp-phpcs-coding-standards) covers style; PHPStan covers types/logic — run both.

When to use this skill

  • Adding static analysis to a plugin/theme.
  • Writing or reviewing phpstan.neon / phpstan.neon.dist.
  • Raising the analysis level on existing code (and baselining the backlog).
  • Killing WP-specific false positives (apply_filters arg counts, is_wp_error(), $wpdb, conditional constants).

Install

composer require --dev szepeviktor/phpstan-wordpress
composer require --dev phpstan/extension-installer   # recommended: auto-registers the extension

szepeviktor/phpstan-wordpress (2.0.3) pulls in phpstan/phpstan ^2.0 and php-stubs/wordpress-stubs ^6.6.2 transitively — you don't normally add those yourself. It requires PHPStan 2.0+.

At the WordPress 7.1 audit date, the newest tagged wordpress-stubs release is 7.0.1. Composer can therefore analyze ordinary plugin code, but new 7.1-only symbols may still be reported as unknown. Do not silence those errors broadly. Feature-detect the API for older WordPress support and add a small reviewed project stub for the missing 7.1 declaration, then remove it when an official 7.1 stubs package is available.

phpstan/extension-installer is a Composer plugin that auto-includes any installed phpstan-extension package's config, so you don't hand-wire the include. Composer 2.2+ needs it in allow-plugins:

{
  "config": {
    "allow-plugins": {
      "phpstan/extension-installer": true
    }
  }
}

Configure (phpstan.neon.dist)

With extension-installer, the config is minimal — the extension auto-registers:

parameters:
    level: 5
    paths:
        - my-plugin.php
        - includes/

Read the full file on GitHub · 197 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 197 lines · 227 tokens per session scan A 235984545aae

Subscribe to this mod's changes

wp-phpstan-static-analysis is a skill published in the GitHub repository Lonsdale201/wp-agent-skills (22 stars, last pushed 10d ago), licensed MIT. It adds 227 tokens to every session and 2,518 once invoked, about $0.0011 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

drupaltools-phpstan

Run PHPStan static analysis in a Drupal project and resolve the reported errors. Use this skill whenever the user asks to run phpstan, run static analysis, fix type errors, or says "run phpstan and fix the errors".

drupaltools/skills · 53 tokens

kotlin-tooling-native-build-performance

Diagnoses and fixes slow Kotlin/Native compilation and linking in Kotlin Multiplatform projects that target iOS. Use when the user reports slow iOS or shared-framework builds, long linkDebug/linkRelease or XCFramework tasks, cold CI builds that re-download the Kotlin/Native toolchain, KSP or other generated code on…

Kotlin/kotlin-agent-skills · 96 tokens

xcode-compilation-analyzer

Analyze Swift and mixed-language compile hotspots using build timing summaries and Swift frontend diagnostics, then produce a recommend-first source-level optimization plan. Use when a developer reports slow compilation, type-checking warnings, expensive clean-build compile phases, long CompileSwiftSources tasks…

AvdLee/Xcode-Build-Optimization-Agent-Skill · 74 tokens

sentry-php-sdk

Full Sentry SDK setup for PHP. Use when asked to "add Sentry to PHP", "install sentry/sentry", "setup Sentry in PHP", or configure error monitoring, tracing, profiling, logging, metrics, crons, or AI monitoring for PHP applications. Supports plain PHP, Laravel, and Symfony.

getsentry/sentry-for-ai · 71 tokens

profiling

Use the free official .NET diagnostics CLI tools for profiling and runtime investigation in .NET repositories. USE FOR: the repo needs performance or runtime profiling for a .NET application; the user asks about slow code, high CPU, GC pressure, allocation growth, exception storms, lock. DO NOT USE FOR: replacing…

managedcode/dotnet-skills · 119 tokens

auditing-php-applications

Audit PHP web application source for critical vulnerabilities using PHP's specific sink and footgun catalog — object injection via unserialize and phar:// POP chains, type-juggling and magic-hash auth bypass, LFI/RFI through php:// and phar:// wrappers, dynamic includes and extract()/superglobal trust, SQL injection…

trilwu/secskills · 129 tokens