/superpowers-laravel:laravel:policies-and-authorizationfrom superpowers-laravel
Enforces access control in Laravel using Policies and Gates, with authorize() and authorizeResource() for controller protection. Covers policy generation, route middleware, and Laravel 13+ authorization attributes.
Ships in superpowers-laravel. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
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 casesuse Illuminate\Routing\Attributes\Controllers\Authorize;
use Illuminate\Routing\Attributes\Controllers\Middleware;
#[Middleware('auth')]
class CommentController
{
#[Authorize('create', [Comment::class, 'post'])]
public function store(Post $post) { /* ... */ }
#[Authorize('delete', 'comment')]
public function destroy(Comment $comment) { /* ... */ }
}
$this->authorize(...) — pick one style per codebase (see laravel:php-attributes)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
laravel-policies, gates, authorization, access-control, php-attributes
npx claudepluginhub jpcaparas/superpowers-laravel --plugin superpowers-laravel57 skills in this plugin
/laravel:ai-sdkBuild AI features with the first-party Laravel AI SDK (Laravel 13+); agents, embeddings, images, audio, and tool calling with provider-agnostic APIs/laravel:api-resources-and-paginationUse API Resources with pagination and conditional fields; keep response shapes stable and cache-friendly/laravel:api-surface-evolutionEvolve APIs safely using versioned DTOs/transformers, deprecations, and compatibility tests/laravel:blade-components-and-layoutsCompose UIs with Blade components, slots, and layouts; keep templates pure and testable/laravel:bootstrap-checkDetect Sail/non‑Sail and print the right command pairs for your environment; verify dependencies and key services are reachable/laravel:brainstormingInteractive design refinement tailored to Laravel projects; clarify domain, data, interfaces, testing, and quality gates while accounting for Sail/non‑Sail environmentsOther plugins' skills for the same job