formrequests

Centralize Laravel input validation with FormRequest classes.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

FormRequests centralize and isolate validation, authorization, and error messaging away from controllers, simplifying controller logic and enabling reuse.

Core Features & Use Cases

  • Centralized validation rules in dedicated FormRequest classes
  • Consistent authorization checks and error messages across controllers
  • Predictable structure under app/Http/Requests/ and clear naming patterns

Quick Start

Refactor controllers by replacing inline validation with dedicated FormRequest classes.

Frequently Asked Questions about formrequests

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

FAQPage Schema
How do I move Laravel validation rules out of my controllers?

Laravel validation rules can be centralized by moving them into dedicated FormRequest classes under app/Http/Requests/. This isolates validation logic away from controllers, simplifying controller code and enabling consistent rule reuse across web and API endpoints.

What is the purpose of using a FormRequest class in Laravel?

A FormRequest class centralizes input validation, authorization checks, and descriptive error messaging. It enforces a predictable structure using authorize() and rules() methods, keeping validation isolated from controller logic for cleaner, more maintainable application code.

How do I authorize user actions when using Laravel FormRequests?

You authorize user actions within the authorize() method of your FormRequest class. This centralizes authorization checks alongside validation rules, ensuring consistent permission validation across web and API controllers before the request reaches your application logic.

Where should FormRequest classes be placed in a Laravel application?

FormRequest classes should be placed under the app/Http/Requests/ directory. Using this predictable structure along with clear naming patterns ensures your centralized validation rules and authorization checks remain organized and easily discoverable across your project.

Does this approach work for both web and API controllers in Laravel?

Yes, this approach works for both web and API controllers in Laravel. Centralizing validation in FormRequest classes provides consistent error messages and authorization checks across all entry points, ensuring predictable behavior regardless of how clients interact with your application.