resources/boost/skills/policies/SKILL.md
Centralised authorization logic for a given Eloquent model. Policies define per-ability access control and are enforced at the controller level.
npx skillsauth add codebar-ag/coding-guidelines policiesInstall 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.
app/Policies/PascalCase with a Policy suffix, named after the model they protect: InvoicePolicy, PostPolicyviewAny, view, create, update, delete, restore, forceDeletecan:* is equivalent enforcement to calling $this->authorize() in controllersModelPolicy naming conventionAuthServiceProvidernamespace App\Policies;
use App\Models\Invoice;
use App\Models\User;
class InvoicePolicy
{
public function viewAny(User $user): bool
{
return $user->isAdmin();
}
public function view(User $user, Invoice $invoice): bool
{
return $user->id === $invoice->user_id || $user->isAdmin();
}
public function create(User $user): bool
{
return $user->hasVerifiedEmail();
}
public function update(User $user, Invoice $invoice): bool
{
return $user->id === $invoice->user_id && $invoice->isDraft();
}
public function delete(User $user, Invoice $invoice): bool
{
return $user->isAdmin();
}
}
// Usage in controller
public function update(UpdateInvoiceRequest $request, Invoice $invoice): InvoiceResource
{
$this->authorize('update', $invoice);
// ...
}
// Usage in Form Request
public function authorize(): bool
{
return $this->user()->can('update', $this->route('invoice'));
}
// Safe always-true example (explicitly public endpoint)
public function authorize(): bool
{
// Intentionally public route: no model-sensitive data is exposed.
return true;
}
// Usage via route middleware
Route::put('/invoices/{invoice}', [InvoiceController::class, 'update'])
->middleware('can:update,invoice');
return true in authorize() without documenting the intentControllers/SKILL.md — the layer where policies are enforcedFormRequests/SKILL.md — can use can() in authorize() methodtesting
Translation and localization conventions for Laravel. Use when adding user-facing strings, creating translation files, or working with lang/ directory.
tools
Reusable behaviour shared across multiple unrelated classes. Traits provide shared Eloquent scopes, accessors, lifecycle hooks, and small stateless helper methods.
development
Tailwind CSS v4 styling conventions. Use when working with CSS, Tailwind utilities, or customizing the theme in Laravel projects.
development
Orchestration classes that coordinate multiple Actions, external APIs, or domain operations into a cohesive workflow. Services own transaction boundaries and third-party API integrations.