一键导入
laravel-quality
Code quality tooling with PHPStan, Pint, and strict types. Use when configuring or running static analysis, code style, or linting.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Code quality tooling with PHPStan, Pint, and strict types. Use when configuring or running static analysis, code style, or linting.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
High-level architecture decisions, patterns, and project structure. Use when deciding which pattern to use, organizing code, or making structural decisions.
Background jobs and event listeners for async processing. Use when creating or modifying jobs, queues, listeners, or event-driven workflows.
Package development and extraction of reusable code. Use when creating, extracting, or modifying composer packages.
Service providers, bootstrapping, and application configuration. Use when modifying service providers, booters, bootstrap logic, or app-level configuration.
Route configuration, route model binding, and authorization. Use when defining routes, configuring model binding, or setting up route-level authorization.
Comprehensive testing patterns with Pest. Use when writing or modifying tests, mocking, factories, or test patterns.
| name | laravel-quality |
| description | Code quality tooling with PHPStan, Pint, and strict types. Use when configuring or running static analysis, code style, or linting. |
Testing, 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.
Enforce conventions with Pest architecture tests when appropriate for the project.
→ Architecture test examples: architecture-tests.md
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: 5 # Minimum 5, increase per-project as practical (up to 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"
}
}