Code quality tooling with PHPStan, Pint, and strict types. Use when working with code quality, static analysis, formatting, or when user mentions PHPStan, Pint, quality, static analysis, type safety, code style, linting.
/plugin marketplace add leeovery/claude-laravel/plugin install leeovery-claude-laravel@leeovery/claude-laravelThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/code-style.mdreferences/type-safety.mdTesting, static analysis, and code quality enforcement.
Related guides:
# composer.json scripts
{
"test": "pest",
"analyse": "phpstan analyse",
"format": "pint",
"quality": [
"@analyse",
"@test"
]
}
All files must have declare(strict_types=1) at top. Run quality checks before every commit.
tests/Pest.php
pest()->extend(Tests\TestCase::class)->in('Feature', 'Unit');
tests/Architecture/ActionsTest.php
<?php
declare(strict_types=1);
arch('actions are invokable')
->expect('App\Actions')
->toHaveMethod('__invoke');
arch('actions live in Actions namespace')
->expect('App\Actions')
->toBeClasses()
->toOnlyBeUsedIn('App\Actions', 'App\Http', 'App\Jobs', 'App\Listeners');
arch('actions do not use models directly')
->expect('App\Actions')
->not->toUse('Illuminate\Database\Eloquent\Model');
tests/Architecture/DataTest.php
<?php
declare(strict_types=1);
arch('data objects extend base Data class')
->expect('App\Data')
->toExtend('App\Data\Data')
->ignoring('App\Data\Data');
arch('data objects use constructor property promotion')
->expect('App\Data')
->toHaveConstructor();
tests/Architecture/StrictTypesTest.php
<?php
declare(strict_types=1);
arch('app files declare strict types')
->expect('App')
->toUseStrictTypes();
arch('test files declare strict types')
->expect('Tests')
->toUseStrictTypes();
tests/Architecture/ControllersTest.php
<?php
declare(strict_types=1);
arch('controllers do not use DB facade')
->expect('App\Http')
->not->toUse('Illuminate\Support\Facades\DB');
arch('controllers do not use models directly')
->expect('App\Http\Web\Controllers')
->not->toUse('App\Models');
tests/Architecture/NamingTest.php
<?php
declare(strict_types=1);
arch('actions end with Action suffix')
->expect('App\Actions')
->toHaveSuffix('Action');
arch('data objects end with Data suffix')
->expect('App\Data')
->toHaveSuffix('Data')
->ignoring('App\Data\Data', 'App\Data\Concerns');
arch('exceptions end with Exception suffix')
->expect('App\Exceptions')
->toHaveSuffix('Exception')
->ignoring('App\Exceptions\Concerns');
tests/Architecture/ModelsTest.php
<?php
declare(strict_types=1);
arch('models use custom query builders')
->expect('App\Models')
->toHaveMethod('newEloquentBuilder');
arch('models do not use local scopes')
->expect('App\Models')
->not->toHaveMethod('scope*');
composer require phpstan/phpstan --dev
composer require phpstan/phpstan-strict-rules --dev
composer require larastan/larastan --dev
phpstan.neon
includes:
- vendor/larastan/larastan/extension.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
parameters:
level: 8
paths:
- app
- tests
excludePaths:
- app/Providers/TelescopeServiceProvider.php
checkMissingIterableValueType: true
checkGenericClassInNonGenericObjectType: true
reportUnmatchedIgnoredErrors: false
./vendor/bin/phpstan analyse
composer require laravel/pint --dev
pint.json
{
"preset": "laravel",
"rules": {
"simplified_null_return": true,
"no_unused_imports": true,
"ordered_imports": {
"sort_algorithm": "alpha"
}
}
}
./vendor/bin/pint
./vendor/bin/pint --test # Check only
phpunit.xml
<coverage>
<report>
<html outputDirectory="coverage"/>
<text outputFile="php://stdout"/>
</report>
</coverage>
./vendor/bin/pest --coverage
./vendor/bin/pest --coverage --min=80 # Enforce minimum
.github/workflows/tests.yml
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
coverage: xdebug
- name: Install Dependencies
run: composer install --prefer-dist --no-interaction
- name: Code Style
run: ./vendor/bin/pint --test
- name: Static Analysis
run: ./vendor/bin/phpstan analyse
- name: Run Tests
run: ./vendor/bin/pest --coverage --min=80
composer require brainmaestro/composer-git-hooks --dev
composer.json
{
"extra": {
"hooks": {
"pre-commit": [
"./vendor/bin/pint",
"./vendor/bin/phpstan analyse",
"./vendor/bin/pest"
]
}
},
"scripts": {
"post-install-cmd": "vendor/bin/cghooks add --ignore-lock",
"post-update-cmd": "vendor/bin/cghooks update"
}
}
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.