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.
npx agentmods add skills/kayw-geek/phpstan-type-trace/phpstan-tracenpx skills add kayw-geek/phpstan-type-trace --skill phpstan-tracegit clone --depth 1 https://github.com/kayw-geek/phpstan-type-traceWrote 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.
[](https://agentmods.dev/skills/kayw-geek/phpstan-type-trace/phpstan-trace)<a href="https://agentmods.dev/skills/kayw-geek/phpstan-type-trace/phpstan-trace"><img src="https://agentmods.dev/badge/skills/kayw-geek/phpstan-type-trace/phpstan-trace.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00143 | $0.02243 |
| Opus 5 | $0.00072 | $0.01122 |
| Sonnet 5 | $0.00029 | $0.00449 |
| Haiku 4.5 | $0.00014 | $0.00224 |
Grade C, and why
phpstan-trace scanned grade C with 1 finding 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 3d 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.
Harvests environment variableshighData exfiltration
Enumerating or grepping the environment for keys collects credentials unrelated to what the mod says it does.
- The CLI runs `phpstan` internally on the target file with a dump environment variable set; it does **not** modify your source or your phpstan config. How it starts
The opening of the file, as written. The whole thing — 176 lines — stays where its author put it; the contents beside it link to each section on GitHub.
phpstan-trace
Inspect the full type-inference chain of a variable at a PHP source location.
When to use
Invoke this skill before attempting to fix a PHPStan type error when any of these signals are present:
- The variable is touched in 2+ scopes (passed into a closure, callback, helper, or array map).
- A third-party extension is plausibly involved: larastan Eloquent magic attributes (
$user->name,$model->created_at), webmozart/assert or beberlei/assert guards, doctrine collections, dynamic-return-type extensions (e.g.Model::query()). - The enclosing method is longer than ~30 lines OR the file exceeds ~100 lines.
- The error involves generics,
array{...}shapes, or template parameters that don't match what you expect from reading the signature. - You already read the source and the inferred type at the error line still doesn't make sense.
- The error is
Cannot access property X on string,... expects Foo, Foo|null given,... always evaluates to true/false, or a similar "where did this type come from?" message in any of the above contexts.
The CLI returns every event (parameter binding, assign, compound-op, narrowing, read) that shaped the variable from function entry up to the failing line — so you can see where the wrong type came in, instead of guessing.
When NOT to use
Skip the CLI and just read the source if all of these hold:
- The file is short (< 100 lines) AND the method is short (< 30 lines).
- The error message names a single line and the variable is assigned/parameter-bound in plain sight nearby.
- No third-party extension is shaping the type (vanilla PHP, no Eloquent magic, no assert library).
- The fix is obviously a missing
??default, a missing null guard, or a typo in a property name.
Also skip for non-type errors: Call to undefined method, Class X not found, Access to undefined constant — these don't need a type-inference chain.
Rule of thumb: if you'd confidently write the fix in under 30 seconds from reading the source, skip the trace. If you'd be guessing, run it.
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.
- 3d ago First seen · 176 lines · 143 tokens per session scan C d18eff140f39
phpstan-trace is a skill published in the GitHub repository kayw-geek/phpstan-type-trace (20 stars, last pushed 3mo ago), licensed MIT. It adds 143 tokens to every session and 2,243 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it C with 1 finding (harvests environment variables). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
vigilante-issue-implementation-on-php
Implement a GitHub issue end-to-end when Vigilante dispatches work for a PHP repository with Composer, static analysis, and security guidance.
wp-coding-standards
Use when setting up PHPCS with WordPress Coding Standards (WPCS), configuring phpcs.xml.dist, running phpcs/phpcbf, fixing sniff violations, adding PHPCS to CI (GitHub Actions), configuring IDE integration, or verifying a plugin meets WP.org code style requirements. Covers squizlabs/phpcodesniffer…
wp-i18n-workflow
Use when managing the full translation workflow for a WordPress plugin — registering text domain with loadplugintextdomain, wrapping strings with (), e(), eschtml(), escattr(), n(), x(), ex(), nx(), generating POT with wp i18n make-pot, compiling .po to .mo (wp i18n make-mo / msgfmt) and .json (wp i18n make-json)…
laravel-eloquent
Eloquent and query-layer engineering rules for Laravel — eliminating N+1, choosing a pagination strategy, short atomic transactions, casts and scopes on the model, where raw SQL is allowed, and how migrations declare the schema those queries depend on. Use when writing or reviewing Eloquent models, migrations, query…
laravel-testing
Test strategy for a layered Laravel application — which test style fits each layer, hand-written fakes over mocks, real-database tests for Query Classes and Repositories, pure tests for Value Objects, and feature tests that assert authorization, payload shape and query counts. Use when writing or reviewing Laravel…
webman
Expert skill for the webman framework (a long-lived, in-memory PHP framework based on workerman). Covers routing, controllers, middleware, database/Redis, custom processes, timers, coroutines (v2), plugin development, and guarding against memory leaks and cross-request state pollution under the resident process model.…