artisan-mastery
PHP Artisan CLI patterns including make commands, flags, custom commands, and AI-friendly usage.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
PHP Artisan CLI patterns including make commands, flags, custom commands, and AI-friendly usage.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Advanced Eloquent ORM patterns including relationships, eager loading, factories, and query optimization.
Laravel development best practices covering service providers, dependency injection, facades, and the Laravel Way.
Laravel Tinker best practices for debugging, testing ideas, and data exploration. When and how to use safely.
Laravel-native error handling patterns. Renderable exceptions, Livewire traits strategies, and user-facing notifications.
Integrate Anthropic Claude API with Laravel. HTTP client, message format, error handling. Use when calling Claude models from Laravel applications.
API security patterns for Laravel. Rate limiting, headers, CORS, Sanctum tokens, input validation. Use when building or securing API endpoints.
| name | artisan-mastery |
| description | PHP Artisan CLI patterns including make commands, flags, custom commands, and AI-friendly usage. |
# Model with migration, factory, seeder, controller
php artisan make:model Post -mfsc --no-interaction
# Resource controller with form requests
php artisan make:controller PostController --resource --requests
# Pest test (not PHPUnit)
php artisan make:test CreatePostTest --pest
# Filament resource with generated form/table
php artisan make:filament-resource Post --generate
| Command | Purpose | Common Flags |
|---|---|---|
make:model | Eloquent model | -m (migration), -f (factory), -s (seeder), -c (controller) |
make:controller | HTTP controller | --resource, --api, --invokable, --requests |
make:migration | Database migration | --create=table, --table=table |
make:request | Form request validation | - |
make:policy | Authorization policy | --model=Post |
make:job | Queue job | --sync |
make:event | Event class | - |
make:listener | Event listener | --event=EventName |
make:mail | Mailable class | --markdown=emails.template |
make:notification | Notification | --markdown=notifications.template |
make:command | Console command | - |
make:livewire | Livewire component | --inline, --test |
# ✅ Always pass --no-interaction for AI agents
php artisan make:model Post -mfsc --no-interaction
# ✅ Check available options first
php artisan make:model --help
# List all make commands
php artisan list make
# Get specific command help
php artisan help make:model
class PublishPosts extends Command
{
protected $signature = 'posts:publish {--dry-run : Preview without publishing} {--limit=10 : Max posts to publish}';
protected $description = 'Publish scheduled posts';
public function handle(): int
{
if ($this->option('dry-run')) {
$this->info('Dry run mode');
}
return Command::SUCCESS;
}
}
✅ posts:publish (noun:verb)
✅ cache:clear (noun:verb)
✅ queue:work (noun:verb)
❌ publish-posts (kebab-case)
❌ PublishPosts (PascalCase)
# 1. Create model with everything
php artisan make:model Post -mfsc --no-interaction
# 2. Create form requests
php artisan make:request StorePostRequest --no-interaction
php artisan make:request UpdatePostRequest --no-interaction
# 3. Create policy
php artisan make:policy PostPolicy --model=Post --no-interaction
# 4. Create tests
php artisan make:test CreatePostTest --pest --no-interaction
php artisan make:test UpdatePostTest --pest --no-interaction
# All routes
php artisan route:list
# Filter by path
php artisan route:list --path=api
# Filter by name
php artisan route:list --name=posts