scaffold-controller
SKILL.md
Laravel Controller Pattern Skill
Use this skill when creating or refactoring Controllers.
Rules
1. Verification First
- Always create a Form Request class for validation. Never write validation logic (
$request->validate()) inside the controller. - Always use Resource Classes for API responses.
2. Method Structure
- Controllers should only coordinate flow: Input -> Service/Model -> Output.
- Complex business logic belongs in a Service Class (use
service-patternskill).
3. Route Model Binding & Typing
- Use Implicit Binding by matching the route parameter name
{user}with the controller argument$user. - Type hint the Model
(User $user)and the Form Request(StoreUserRequest $request).
// Route: Route::get('/users/{user}', [UserController::class, 'show']);
public function show(User $user): Response
{
return view('users.show', ['user' => $user]);
}
public function store(StoreUserRequest $request)
{
$data = $request->validated();
User::create($data);
// ...
}
4. Dependency Injection
- Inject Services into the constructor or method signature.
public function __construct(
protected UserService $userService
) {}
Weekly Installs
4
Repository
iurygdeoliveira…bsis-kitGitHub Stars
31
First Seen
Jan 23, 2026
Security Audits
Installed on
claude-code3
windsurf2
opencode2
codex2
antigravity2
gemini-cli2