laravel-laravel-prompting-patterns
Use Laravel-specific vocabulary—Eloquent patterns, Form Requests, API resources, jobs/queues—to get idiomatic framework code
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use Laravel-specific vocabulary—Eloquent patterns, Form Requests, API resources, jobs/queues—to get idiomatic framework code
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
shadcn-vue for Vue/Nuxt with Reka UI components and Tailwind. Use for accessible UI, Auto Form, data tables, charts, dark mode, MCP server setup, or encountering component imports, Reka UI errors.
Decompose large Vue 3 components into focused SFCs and composables with explicit contracts, simple templates, and SSR-safe side effects.
Enforces an opinionated UI baseline to prevent AI-generated interface slop.
Keep cyclomatic complexity low; flatten control flow, extract helpers, and prefer table-driven/strategy patterns over large switches
Use API Resources with pagination and conditional fields; keep response shapes stable and cache-friendly
Portable storage configuration across S3/R2/MinIO with optional CDN—env toggles, path-style endpoints, and URL generation
| name | laravel-laravel-prompting-patterns |
| description | Use Laravel-specific vocabulary—Eloquent patterns, Form Requests, API resources, jobs/queues—to get idiomatic framework code |
Use Laravel's vocabulary to get idiomatic code. Generic requests produce generic solutions that don't leverage the framework.
"Get all active users with their posts"
"Query active users with eager-loaded posts using Eloquent:
User::where('active', true)
->with('posts')
->get();
Add a scope to User model: scopeActive($query)"
"Set up a many-to-many relationship between Posts and Tags:
post_tag pivot table migrationbelongsToMany in Post modelbelongsToMany in Tag modelattach(), detach(), sync() for management""Avoid N+1 on the posts index:
author and category relationshipswithCount('comments') for comment totalspublished_at and category_id""Validate the user input"
"Create UserStoreRequest with validation rules:
public function rules(): array
{
return [
'email' => ['required', 'email', 'unique:users,email'],
'password' => ['required', 'min:12', Password::defaults()],
'name' => ['required', 'string', 'max:255'],
];
}
Add custom error messages in messages() method"
"Validate order creation:
Rule::exists('products', 'id') for product IDsitems.*.quantity must be integer, min 1Rule::requiredIf() for conditional shipping addressnew HasSufficientStock""Create an API for products"
"Create RESTful product API:
ProductController with apiResource routesProductResource for response transformationProductCollection for index endpoint with paginationauth:sanctumProductStoreRequest and ProductUpdateRequest for validation""Paginate products API:
Product::paginate(20) in controllerProductResource::collection($products)total, per_page, current_page, last_page?page=2 query parameter""Add filtering to products API:
?category=electronics&min_price=100 query paramswhen() for conditional queriesProductFilters class for reusability"Send email after user registers"
"Dispatch SendWelcomeEmail job after registration:
SendWelcomeEmail::dispatch($user)
->onQueue('emails')
->delay(now()->addMinutes(5));
ShouldQueue interface$tries = 3 and $timeout = 30failed() method$tags = ['user:'.$user->id]""Configure queue for payment processing:
redis connection for payments queuequeue:work --queue=payments,defaultretry_after to 90 seconds in config"Process order with job chain:
Bus::chain([
new ValidateInventory($order),
new ChargePayment($order),
new SendConfirmation($order),
])->dispatch();
If any job fails, chain stops. Handle in catch() callback."
"Implement according to Laravel's Eloquent Relationships docs"
"Follow Laravel's Form Request Validation pattern"
"Use Laravel's API Resource pattern for response transformation"
"Configure queues per Laravel Queue docs"
Models & Eloquent:
hasMany, belongsTo, belongsToMany, morphManyscopeActive, scopePublishedget{Attribute}Attribute, set{Attribute}Attributeprotected $casts = ['published_at' => 'datetime']Validation:
UserStoreRequest, ProductUpdateRequestrequired, unique:table,column, exists:table,columnnew Uppercase, Rule::in(['admin', 'user'])API:
UserResource, ProductCollectionpaginate(), simplePaginate(), cursorPaginate()throttle:60,1 middlewareJobs & Queues:
ShouldQueue, dispatch(), dispatchSync()Bus::chain(), Bus::batch()Use Laravel's vocabulary. Get Laravel solutions.