skills/laravel-policies-and-authorization/SKILL.md
Enforce access via Policies and Gates; use authorize() and authorizeResource() to standardize controller protections
npx skillsauth add noartem/laravel-vue-skills laravel-policies-and-authorizationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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 casestesting
Decompose large Vue 3 components into focused SFCs and composables with explicit contracts, simple templates, and SSR-safe side effects.
tools
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.
documentation
Wrap multi-write operations in transactions; use dispatchAfterCommit and idempotency patterns to ensure consistency
tools
Stabilize workflows with Template Method or Strategy; extend by adding new classes instead of editing core logic