/syarif-laravel-ai-skills:controller-cleanupfrom syarif-laravel-ai-skills
Keeps Laravel controllers focused on HTTP orchestration by moving validation, authorization, and business workflows outward. Guides splitting controllers by resource boundary and using Form Requests, Actions, and Policies.
Ships in syarif-laravel-ai-skills. 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 this skill when controllers become difficult to understand, test, or maintain.
When a Laravel app has several menus/pages, also use module-per-menu: avoid one broad controller for the whole app, and split by menu, page group, or resource boundary.
Controllers should stay thin and focused on HTTP orchestration. They should not contain long business workflows, provider payload construction, repeated query logic, or file-processing loops.
A controller may:
$this->authorize() or rely on middleware/Form Request authorization;validated() data;A controller should not:
Keep coarse access requirements visible in routes or route groups.
Route::middleware(['auth', 'verified'])->group(function () {
Route::resource('records', RecordController::class)
->middlewareFor('index', 'can:viewAny,' . Record::class)
->middlewareFor(['create', 'store'], 'can:create,' . Record::class)
->middlewareFor(['edit', 'update'], 'can:update,record')
->middlewareFor('destroy', 'can:delete,record');
});
Use Policies for model-state rules and Form Request authorize() for request-input-dependent authorization.
Use controller actions for committed production endpoints that need middleware, sessions, tests, cache headers, or deployment route caching.
Route closures are acceptable for static views, simple redirects, prototypes, and temporary debugging.
Place static or specific routes before broad resource routes when URI patterns could collide.
Route::get('records/export', ExportRecordsController::class)
->name('records.export');
Route::resource('records', RecordController::class);
Verify collision-prone route changes with php artisan route:list or a feature test.
final class RecordController
{
public function store(StoreRecordRequest $request, CreateRecord $create): RedirectResponse
{
$record = $create->handle($request->user(), $request->validated());
return redirect()
->route('records.show', $record)
->with('status', 'Record created.');
}
}
Layer: 3 (Implementation)
Load this skill only when controllers need cleanup. Do not load with unrelated skills. Keep the diff minimal: inline validation only when rules are tiny, otherwise Form Request; one Action per use case; no repository by default.
What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (soden46/syarif-laravel-ai-skills) — no native marketplace selected
npx claudepluginhub p/soden46-syarif-laravel-ai-skills72 skills in this plugin
/actions-and-servicesUse Actions and Services as deliberate Laravel application boundaries for use cases, integrations, and reusable workflows./ai-sdkBuild AI features with the first-party Laravel AI SDK (Laravel 13+); agents, embeddings, images, audio, and tool calling with provider-agnostic APIs/api-resources-and-paginationLaravel guidance to use API Resources with pagination and conditional fields; keep response shapes stable and cache-friendly