larastan
Installation
SKILL.md
Larastan
Applicability (check first)
- If the project ships its own
.ai/skills/larastan/, defer to that copy. - Read
phpstan.neonfirst — level, baseline, and custom rules vary by project age. Current sprintify runs level 6 with custom rules (ModelLocationRule,NoFacadeAliasRule,NoRequestAllRule,NoCascadeOnDeleteRule, plus audit rules); older forks run lower levels with none. Fix to the project's configured level, not this skill's examples. - The
HasBuilder/HasCollectiontraits require Laravel 11+. On older projects, keepnewEloquentBuilder()/newCollection()overrides — don't migrate.
When to Activate
- Activate when fixing PHPStan or Larastan errors.
- Activate when adding or correcting
@return,@var,@param,@extends,@use, or@templatePHPDoc tags. - Activate when working with generic type annotations on models, builders, factories, collections, or relationships.
- Activate when the user mentions PHPStan, Larastan, static analysis, or type-level errors.
Scope
- In scope: PHPDoc generics for relationships, factories, builders, collections, Attribute accessors; fixing PHPStan errors; understanding Larastan-specific rules.
- Out of scope: runtime bugs, general Laravel patterns unrelated to static analysis.