requests

Enforce FormRequest-based validation for Laravel controller input paths.

3|Updated Feb 13, 2026
One-click install
npx skills add https://github.com/codebar-ag/coding-guidelines --skill requests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: requests
Source: https://github.com/codebar-ag/coding-guidelines/tree/main/resources/boost/skills/requests
Command: npx skills add https://github.com/codebar-ag/coding-guidelines --skill requests

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Form Request Validation centralizes input validation away from controllers, preventing validation logic from scattering across actions and improving security and maintainability.

Core Features & Use Cases

  • Dedicated Form Requests live under app/Http/Requests and group validation by domain (e.g., Auth, Invoices).
  • Methods authorize(), rules(), and messages() provide clear access control and user-friendly errors, with PHPDoc annotations for static analysis.
  • Automatic validation: Laravel applies the FormRequest before the controller action, returning validation errors when needed.
  • Use Case: When creating or updating resources, replace inline validation with a dedicated request class to enforce consistent rules.

Quick Start

Create a Form Request class for the target resource, inject it into the controller method, and trigger the request to validate input automatically.

Frequently Asked Questions about requests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I separate validation logic from Laravel controllers?

To separate validation logic from Laravel controllers, create dedicated Form Request classes under app/Http/Requests. Injecting these classes into your controller methods automatically validates user input before the action executes, keeping your controllers clean.

What is the best way to authorize user input in Laravel form requests?

The best way to authorize user input in Laravel form requests is by implementing the authorize() method within your dedicated FormRequest class. This gates access before the controller action runs, providing centralized security and preventing unauthorized data modifications.

How do I define custom validation rules for a Laravel resource?

To define custom validation rules for a Laravel resource, add a rules() method to your Store{Resource}Request or Update{Resource}Request class. This centralizes all input constraints in one location, which Laravel applies automatically upon form submission.

Does Laravel form request validation support custom error messages?

Laravel form request validation supports custom error messages by implementing the messages() method in your FormRequest class. This allows you to return user-friendly validation errors tailored to specific input fields instead of relying on default framework messaging.

When do I need to use a dedicated form request class in Laravel?

You need to use a dedicated form request class in Laravel when creating or updating resources to enforce consistent validation rules. Replacing inline controller validation with a request class groups your rules by domain and improves overall project maintainability.

Can I use PHPDoc annotations with Laravel form requests for static analysis?

You can use PHPDoc annotations with Laravel form requests to support static analysis. Adding these annotations to your authorize(), rules(), and messages() methods provides clear type hints and access control documentation for your IDE and analysis tools.