From superpowers-laravel
Enforces Laravel access via Policies and Gates; standardizes controller protections using authorize() and authorizeResource(). Useful for model authorization and route guards.
How this skill is triggered — by the user, by Claude, or both
Slash command
/superpowers-laravel:policies-and-authorizationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use Policies for per-model actions; use Gates for cross-cutting checks.
Use Policies for per-model actions; use Gates for cross-cutting checks.
# Generate a policy
sail artisan make:policy PostPolicy --model=Post # or: php artisan make:policy PostPolicy --model=Post
# Apply in routes (resource controllers)
Route::resource('posts', PostController::class);
// In controller constructor
$this->authorizeResource(Post::class, 'post');
# One-off checks
$this->authorize('update', $post); // in controller
Gate::allows('manage-billing', $user); // ad-hoc gate
viewAny, view, create, update, delete, restore, forceDeleteAuthServiceProvidercan middleware for quick route protection: ->middleware('can:update,post')actingAs($user)->get(...)->assertForbidden() for denied casesnpx claudepluginhub jpcaparas/superpowers-laravel --plugin superpowers-laravelProvides Laravel authorization patterns using Gates, Policies, middleware, and Response objects for ability checks and model access control.
Creates ActionPolicy authorization in Rails: policy classes, controller integration with authorize!, scopes, caching, I18n, tests, GraphQL/ActionCable support. Proactive alternative to Pundit.
Generates PHP 8.4 Policy pattern for encapsulating authorization, validation, and business rules. Includes interfaces, implementations, exceptions, and unit tests for domain constraints.