laraveldaily-structure-audit

Audit Laravel project structure and generate refactoring suggestions.

132|33|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/LaravelDaily/AI-Workflows-For-Laravel --skill laraveldaily-structure-audit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laraveldaily-structure-audit
Source: https://github.com/LaravelDaily/AI-Workflows-For-Laravel/tree/main/skills/laraveldaily-structure-audit
Command: npx skills add https://github.com/LaravelDaily/AI-Workflows-For-Laravel --skill laraveldaily-structure-audit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers quickly evaluate a Laravel application's architecture, identifying structural issues such as inline validation, overly large controllers, hard‑coded strings, duplicated code, misuse of env() outside config, and other anti‑patterns, so they can refactor for maintainability and readability.

Core Features & Use Cases

  • Inline Validation Detection: Flags large or complex validation logic inside controllers and suggests Form Request extraction.
  • Fat Controller Identification: Highlights controller methods exceeding ~20 lines or containing multiple responsibilities, recommending service or action extraction.
  • String Constant & Enum Recommendation: Finds hard‑coded role/status strings and advises using PHP Enums.
  • Duplicate Logic Spotting: Detects repeated code blocks across controllers and proposes shared scopes or services.
  • Env Misuse Alert: Catches env() calls outside config files to prevent production bugs.
  • API Resource & Route Model Binding Checks: Suggests proper response resources and model binding for cleaner APIs.
  • Authorization & Policy Guidance, Lifecycle Logic Consolidation, Over‑Engineering Flags, and more.

Quick Start

Ask the skill to audit the structure of a Laravel project located at ./my‑app and provide a concise report with actionable suggestions.

Frequently Asked Questions about laraveldaily-structure-audit

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

FAQPage Schema
How do I audit my Laravel project structure for code quality issues?

Scanning PHP source files detects inline validation, fat controllers, hard-coded strings, and env misuse, excluding vendor, node_modules, and storage directories. It produces a structured refactoring report with actionable suggestions following Laravel best practices.

What is considered a fat controller in Laravel and how do I identify it?

Fat controllers in Laravel are methods exceeding roughly twenty lines or containing multiple responsibilities. Scanning controller files highlights these methods and recommends extracting services or action classes to improve code maintainability.

Why should I avoid using the env function outside of config files in Laravel?

Using the env function outside config files in Laravel causes production bugs because env returns null after configuration caching. Env misuse detection catches these calls to prevent configuration failures in production.

How do I detect duplicate logic and hard-coded strings across Laravel controllers?

Detecting duplicate logic and hard-coded strings involves scanning Laravel controllers for repeated code blocks and literal role or status values. The audit recommends extracting shared scopes or services and replacing strings with PHP Enums.

Can I audit a Laravel application located in a specific directory path?

Yes, you can audit a Laravel application by specifying its directory path. The audit scans PHP source files within that location to identify architectural issues and outputs a concise refactoring report with actionable suggestions.

What is the best way to refactor inline validation in Laravel controllers?

Refactoring inline validation in Laravel involves extracting complex validation logic from controllers into dedicated Form Request classes. The audit detects large inline validation blocks and recommends this extraction for better code organization.