From superpowers-laravel
Prompts with Laravel-specific patterns like Eloquent queries, Form Requests, API Resources, Jobs/Queues to generate idiomatic framework code for DB ops, validation, APIs, background tasks.
npx claudepluginhub jpcaparas/superpowers-laravel --plugin superpowers-laravelThis skill uses the workspace's default tool permissions.
Use Laravel's vocabulary to get idiomatic code. Generic requests produce generic solutions that don't leverage the framework.
Provides expert Laravel patterns for PHP 8.2+ including Eloquent ORM best practices, N+1 prevention, efficient queries, atomic operations, query optimization, and RESTful API controllers.
Provides Laravel architecture patterns for production apps: routing/controllers, Eloquent ORM, service layers, queues, events, caching, API resources.
Provides Laravel patterns for controllers, services, Eloquent ORM, routing, queues, events, caching, and API resources in production apps.
Share bugs, ideas, or general feedback.
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.