Laravel verification

From aaione/everything-claude-code-zh · View interactive version

Laravel verification is an AI agent skill from the GitHub repository aaione/everything-claude-code-zh. Laravel 项目验证循环:环境检查、代码风格检查、静态分析、带覆盖率的测试、安全扫描和部署就绪检查。

How to use this skill

Skill file

Laravel 验证循环

在提交 PR、重大变更后和部署前运行。

何时使用

工作原理

阶段 1:环境检查

php -v
composer --version
php artisan --version

如果本地使用 Laravel Sail:

./vendor/bin/sail php -v
./vendor/bin/sail artisan --version

阶段 1.5:Composer 和自动加载

composer validate
composer dump-autoload -o

阶段 2:代码风格检查和静态分析

vendor/bin/pint --test
vendor/bin/phpstan analyse

如果项目使用 Psalm 而非 PHPStan:

vendor/bin/psalm

阶段 3:测试和覆盖率

php artisan test

覆盖率(CI):

XDEBUG_MODE=coverage php artisan test --coverage

CI 示例(格式化 -> 静态分析 -> 测试):

vendor/bin/pint --test
vendor/bin/phpstan analyse
XDEBUG_MODE=coverage php artisan test --coverage

阶段 4:安全和依赖检查

composer audit

阶段 5:数据库和迁移

php artisan migrate --pretend
php artisan migrate:status

阶段 6:构建和部署就绪

php artisan optimize:clear
php artisan config:cache
php artisan route:cache
php artisan view:cache

阶段 7:队列和调度器检查

php artisan schedule:list
php artisan queue:failed

如果使用 Horizon:

php artisan horizon:status

如果有 queue:monitor 可用,使用它检查积压而不处理任务:

php artisan queue:monitor default --max=100

主动验证(仅限 staging):向专用队列分发一个空操作任务,并运行单个工作者处理(确保配置了非 sync 的队列连接)。

php artisan tinker --execute="dispatch((new App\\Jobs\\QueueHealthcheck())->onQueue('healthcheck'))"
php artisan queue:work --once --queue=healthcheck

验证任务产生了预期的副作用(日志条目、健康检查表记录或指标)。

仅在处理测试任务安全的非生产环境中运行。

示例

最小化流程:

php -v
composer --version
php artisan --version
composer validate
vendor/bin/pint --test
vendor/bin/phpstan analyse
php artisan test
composer audit
php artisan migrate --pretend
php artisan config:cache
php artisan queue:failed

CI 风格流水线:

composer validate
composer dump-autoload -o
vendor/bin/pint --test
vendor/bin/phpstan analyse
XDEBUG_MODE=coverage php artisan test --coverage
composer audit
php artisan migrate --pretend
php artisan optimize:clear
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan schedule:list
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.