laravel:routes-best-practices

Enforce Laravel route organization with controller-focused request mappings.

1|Updated Sep 22, 2025
One-click install
npx skills add https://github.com/meistro57/chat_bridge --skill laravel-routes-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel:routes-best-practices
Source: https://github.com/meistro57/chat_bridge/tree/main/.claude/skills/routes-best-practices
Command: npx skills add https://github.com/meistro57/chat_bridge --skill laravel-routes-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the common issue of bloating Laravel route files with business logic, validation, and database operations, leading to unmaintainable code.

Core Features & Use Cases

  • Route Definition Best Practices: Demonstrates how to keep routes concise, focusing solely on mapping requests to controllers.
  • Controller Implementation Guidance: Shows how to move logic into controllers and dedicated services.
  • Route Organization: Provides strategies for structuring route files (web.php, api.php, admin.php) for better maintainability.
  • Use Case: Refactor a messy routes/web.php file to ensure all complex logic is handled within controllers and form requests, making the application easier to understand and extend.

Quick Start

Apply the laravel:routes-best-practices skill to refactor the provided route definitions into clean, controller-focused mappings.

Frequently Asked Questions about laravel:routes-best-practices

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

FAQPage Schema
How do I keep business logic out of Laravel routes?

To keep business logic out of Laravel routes, map requests solely to controllers and delegate database operations, business logic, and validation to dedicated services and form requests.

What is the best way to organize Laravel route files for maintainability?

The best way to organize Laravel route files is by separating concerns into structured files like web.php, api.php, and admin.php, utilizing route grouping and resource controllers for better maintainability.

How do I refactor a messy Laravel routes file?

Refactor a messy Laravel routes file by ensuring routes only map requests to controllers, moving complex inline logic to controllers and form requests, and applying route grouping for cleaner definitions.

Does Laravel route caching work with closures in route files?

Laravel route caching requires routes to map to controllers instead of closures. Moving logic to resource controllers ensures route caching functions properly for application performance optimization.

When should I use route model binding in Laravel?

Use Laravel route model binding when you need to automatically inject model instances into your controller methods, keeping route definitions concise while separating request mapping from database operations.

Can I use form requests for validation in Laravel controller routes?

Yes, you can use form requests for validation by moving validation logic out of route definitions and into dedicated request classes, ensuring controllers handle the validated data mapping cleanly.