Wp Phpstan

🏢Official
by wordpress · vlatest · Repository

WP PHPStan analyzes WordPress code for potential errors and style issues, boosting code quality and preventing bugs.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add wp-phpstan npx -- -y @trustedskills/wp-phpstan
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "wp-phpstan": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/wp-phpstan"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

The WP PHPStan skill analyzes WordPress code for potential errors and style issues using PHPStan, a static analysis tool. It helps improve code quality by identifying bugs and inconsistencies within WordPress projects, particularly plugins and themes. The skill guides users through configuring and running PHPStan effectively in a WordPress environment, including handling WordPress-specific coding patterns and third-party dependencies.

When to use it

This skill is useful when:

  • Setting up or updating the phpstan.neon or phpstan.neon.dist configuration files.
  • Generating or updating the phpstan-baseline.neon file.
  • Fixing PHPStan errors by improving PHPDoc comments to reflect WordPress patterns (e.g., REST requests, hooks, query results).
  • Safely handling classes from third-party plugins and themes using stubs or targeted ignores.
  • Managing the baseline file as a tool for migrating legacy code towards better quality.

Key capabilities

  • Discovers PHPStan entrypoints automatically.
  • Inspects existing PHPStan configurations (config, baseline, scripts).
  • Ensures WordPress core stubs are loaded (szepeviktor/phpstan-wordpress or php-stubs/wordpress-stubs).
  • Guides users on creating a suitable phpstan.neon configuration for WordPress projects.
  • Provides guidance on fixing errors using WordPress-specific typing and PHPDoc annotations.
  • Offers strategies for handling third-party plugin/theme classes when stubs are unavailable.
  • Manages baseline files to track and reduce legacy code issues.

Example prompts

  • "Analyze my WordPress plugin's code with PHPStan."
  • "Generate a baseline file for my WordPress theme."
  • "Help me fix the PHPStan errors related to REST endpoints in my plugin."

Tips & gotchas

  • The skill requires a wp-project-triage output as input. Run this first if you haven't already.
  • Ensure that WordPress core stubs are loaded, otherwise expect numerous errors about unknown functions.
  • Prioritize correcting types and improving PHPDoc over simply ignoring PHPStan errors.

Tags

🛡️

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
wordpress
Installs
149

🏢 Official

Published by the company or team that built the technology.