Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/kayw-geek/phpstan-type-tracenpx agentmods add skills/kayw-geek/phpstan-type-trace/phpstan-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/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.
<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="Reviewed on agentmods" width="80" 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.1 | $0.00162 | $0.02953 |
| Opus 5.5 | $0.00065 | $0.01181 |
| Sonnet 5.5 | $0.00032 | $0.00591 |
| Haiku 4.5 | $0.00016 | $0.00295 |
Grade A, and why
phpstan-trace 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 yesterday.
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.
How it starts
The opening of the file, as written. The whole thing — 225 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.
- yesterday Changed · +49 lines · +19 tokens per session scan C → A 9fcc726f8cf9
- 3mo 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 (19 stars, last pushed yesterday), licensed MIT. It adds 162 tokens to every session and 2,953 once invoked, about $0.0006 per session on Opus 5.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.
phpstan-trace compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| phpstan-tracekayw-geek/phpstan-type-trace | Skill | 19 | yesterday | MIT | A | 162 | Claude Code |
| golang-troubleshootingsamber/cc-skills-golang | Skill | 4.1k | 2d ago | MIT | A | 175 | Claude Code |
| stack-trace-go-probeopensquilla/opensquilla | Skill | 7.2k | 7d ago | Apache-2.0 | A | 42 | Claude Code |
| stack-trace-python-probeopensquilla/opensquilla | Skill | 7.2k | 7d ago | Apache-2.0 | A | 40 | Claude Code |
| stack-trace-rust-probeopensquilla/opensquilla | Skill | 7.2k | 7d ago | Apache-2.0 | A | 42 | Claude Code |
| golang-error-handlingsamber/cc-skills-golang | Skill | 4.1k | 2d ago | MIT | A | 144 | Claude Code |
| replphel-lang/phel-lang | Skill | 538 | today | MIT | A | 12 | Claude Code |