0095-laravel-validation-patterns

Community

Validate Laravel inputs safely and consistently

AuthorMrJmpl3
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill helps you avoid insecure, inconsistent, and hard-to-test request validation in Laravel by showing production-ready patterns for Form Requests, custom rules, conditional and nested validation, and safe data handling.

Core Features & Use Cases

  • Form Request validation patterns: Centralize validation with authorize(), rules(), custom messages(), and lifecycle hooks like prepareForValidation() and after().
  • Reusable custom validation rules: Implement rule objects (e.g., password complexity) and plug them directly into request rules.
  • Conditional, array, and nested validation: Apply rules based on other fields (required_if, exclude_if, Rule::when) and validate complex payloads using wildcard syntax (items.*.field, tags.*).
  • Database-backed constraints: Use Rule::unique() with ignore() and scoping (where(...)), and Rule::exists() with additional constraints.
  • Enum validation and safe persistence: Validate enums with Rule::enum() and consistently use validated/safe request data (validated(), safe()) instead of raw input to prevent accidental trust of untrusted fields.
  • Common pitfalls and guardrails: Avoid controller-level inline validation, ensure correct failure behavior (bail), and prevent unsafe writes using $request->all() / $request->input().

Quick Start

Use the 0095-laravel-validation-patterns skill to draft a Form Request for your endpoint that includes authorization, sanitization, conditional rules, and safe persistence using validated data only.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: 0095-laravel-validation-patterns
Download link: https://github.com/MrJmpl3/codex_____data_____configuration/archive/main.zip#0095-laravel-validation-patterns

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.