/kivo-wise:wp-phpstanfrom kivo-wise
Configures and runs PHPStan for WordPress projects using Acorn (Roots stack). Handles phpstan.neon, baseline generation, level raising, and type errors in Blade composers, facades, and ACF classes.
Ships in kivo-wise. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Full procedure: third-party/wp-phpstan/SKILL.upstream.md (official WordPress skill, GPL-2.0-or-later, see third-party/UPSTREAM.md). Read it and its references/ (configuration.md, wordpress-annotations.md, third-party-classes.md) first. This file adds the Roots specifics: where to point the analysis, how Acorn code differs, and how to run everything through the runner. Paths starting with third-party/ are relative to the kivo-wise plugin root, two levels above this skill's folder (<skill dir>/../../third-party/...), not inside the skill folder. In your answer, point the user to that full procedure by its resolved absolute path, and use the same resolution for any other third-party/ path you name.
phpstan.neon yet, or the configuration scans the wrong folders.{{runner.composer}}, {{runner.test}}, the detected app path).phpstan/phpstan (PHPStan 2 needs matching extension versions).Commands: write every command with the runner value from the session context filled in (for example lando wp acorn optimize:clear), never a bare wp/composer/php/npm, never the placeholder, never "prefix with lando if you use it". Commands that run in CI or a deploy script go in a separate block labelled with where they run.
Inspect first. Run the official script from the plugin root, with the project as working directory: node third-party/wp-phpstan/scripts/phpstan_inspect.mjs. It reports the config, the baseline and whether WordPress stubs are installed. It reads files only; it does not run PHPStan.
Install through the runner (dev dependencies, in the Composer root that owns the app):
{{runner.composer}} require --dev phpstan/phpstan szepeviktor/phpstan-wordpress phpstan/extension-installer.
The extension installer loads the WordPress extension automatically; do not also include it by hand.
Point paths at the app code, not at the whole site. Never analyse wp/, vendor/, node_modules/ or uploads.
| Profile | paths: in phpstan.neon |
|---|---|
sage-theme | app/ of the theme (config lives in the theme, or in the repo root with <theme>/app) |
acorn-mu-plugin | app/ of the plugin (for example wp-content/mu-plugins/<plugin>/app); put phpstan.neon at the repo root when the plugin has no own composer.json runner |
radicle-app | app/ at the project root, plus config/ if you want it checked |
Start at level 1 and raise one level per MR; commit a baseline only for existing errors.
Larastan is optional on Acorn. It teaches PHPStan about facades, the container and Eloquent. Add larastan/larastan only when facade or model errors dominate the report, include its extension.neon from vendor/, and check its bootstrap requirement against the installed version first: it expects a bootable Laravel application, which Acorn only provides after WordPress has loaded. If it cannot boot, keep plain PHPStan and add PHPDoc on the few models or facades involved.
Run through the runner: {{runner.composer}} exec phpstan -- analyse --memory-limit=1G (Lando: lando composer exec phpstan -- analyse). Generate or update the baseline with --generate-baseline.
Fix by cause, in this order: missing stubs or autoload, wrong PHPDoc, real bug, then targeted ignoreErrors with a comment. get_field() returns mixed: narrow it with a type check or a typed wrapper instead of ignoring the whole file.
CI: run with --no-progress --error-format=github (or the format your CI reads) and fail on a baseline that grew.
{{runner.composer}} exec phpstan -- analyse exits 0 at the chosen level with the baseline applied.| Symptom | Cause | Fix |
|---|---|---|
Function get_option not found | WordPress stubs not loaded | Install szepeviktor/phpstan-wordpress and the extension installer; remove duplicate manual includes |
Thousands of errors from vendor/ or wp/ | paths too wide | Narrow paths to the app folder; use excludePaths for generated code |
Class Illuminate\... not found in a composer or provider | Analysing the app from a Composer root that lacks the app's vendor | Run from the Composer root that installs Acorn, or add scanDirectories for that vendor |
| Facade or model property errors | No Larastan and no PHPDoc | Add PHPDoc on the model or enable Larastan when it can boot |
| Out of memory | Default memory limit | Pass --memory-limit=1G or raise it in the neon |
| Works locally, fails in CI | Different PHP version or missing dev install | Match the container PHP version in CI |
testing-wp.What SKILL.md sets; muted values are Claude Code's defaults
25 skills in this plugin
/acf-nativeUse when building or reviewing ACF field behaviour or the post save flow - validate before publish, required/maxlength settings, hiding a field (conditional_logic), dynamic choices, running code after save - acf/validate_value, acf/load_field, acf/prepare_field, acf/save_post, acf.getField, wp_insert_post_data, save_post - including projects where ACF may not be installed (Radicle). Maps each need to the native mechanism verified in local source. For ACF Composer scaffolding use acorn-scaffolding; for escaping ACF output use wp-security-escaping./acorn-backgroundUse when work must run outside the request, on a schedule, or be logged in an Acorn project - WP-Cron vs Action Scheduler vs Laravel queues (make:job, ShouldQueue, queue:work, failed_jobs), console commands (make:command, wp acorn <command>), Schedule::command and schedule:run from system cron, Laravel Redis and Cache vs transients, logging channels (Log::, LOG_CHANNEL, stderr, storage/logs). For tables use acorn-data; for object cache tuning use wp-performance./acorn-dataUse when storing or querying data through Acorn's database layer - Eloquent models (app/Models, models over wp_posts, postmeta, users), custom tables, migrations (make:migration, migrate --force on deploy), seeders and factories, the DB facade, table prefix errors ("Table wp_wp_x doesn't exist"), and choosing post meta vs options vs a post type vs a custom table. For queues use acorn-background; for endpoints use acorn-routes-api; for post type registration use acorn-scaffolding./acorn-livewireUse when creating, wiring or fixing a Livewire 4 component in an Acorn app - make:livewire --class, app/Livewire, wire:model modifiers (.live, .blur, .debounce), wire:key, attributes (#[Locked]/#[Computed]/#[Validate]/#[On]), lifecycle hooks, @livewireScripts, the /livewire-<hash>/update route, installing livewire/livewire on Radicle. For errors that start after a deploy (419, RangeError, stale HTML) use roots-debugging; for JSON endpoints use acorn-routes-api; for Alpine-only UI use tailwind-vite-assets./acorn-routes-apiUse when adding or fixing an HTTP endpoint or virtual page in an Acorn project - Acorn routes (routes/web.php, routes/api.php, withRouting, Route::get, controllers, middleware, route:list) versus register_rest_route (permission_callback, /wp-json, X-WP-Nonce); webhooks, JSON APIs, CORS, throttle, API-key or JWT auth, "Target class [auth] does not exist", 404 on a defined route. For Livewire use acorn-livewire; for models use acorn-data; for nonces and capabilities in depth use wp-security-escaping./acorn-scaffoldingUse when generating a new artifact in an Acorn project - a Gutenberg block (ACF Composer acf:block, InnerBlocks, $styles, or a native block.json block via make:block), a post type or taxonomy (Poet config/poet.php, config/post-types.php), an ACF field group, partial or options page (acf:field, acf:options), a provider, View Composer, Blade component or command (make:provider, make:composer, make:component). For changing existing Acorn code use acorn-stack; for ACF hooks use acf-native; for block CSS and JS use tailwind-vite-assets.npx claudepluginhub hekivo/kivo-wise --plugin kivo-wiseOther plugins' skills for the same job