laraveldaily-eloquent-audit

Community

Audit Eloquent models for performance & correctness

AuthorLaravelDaily
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Identifies performance, correctness, and maintainability issues in Laravel Eloquent usage so teams can reduce query bloat, fix hidden N+1s, avoid large memory usage, and make model code safer and more predictable.

Core Features & Use Cases

  • N+1 Detection: Locate relationship access patterns in controllers, Blade templates, components, and accessors that cause N+1 queries and recommend eager loading or withCount/withSum alternatives.
  • Query Efficiency: Flag filtering done in PHP after get/all, missing select column constraints in API responses, and large resultset hydration in jobs/commands that should use chunk, cursor, or lazy.
  • Model Correctness: Highlight missing or incorrect casts, mass-assignment risks, absent uniqueness constraints for upserts, transaction gaps for multi-step writes, unsafe convenience helper usage, and $with over-fetching.
  • Operational Guidance: Tie findings to migrations where possible, classify severity, and provide actionable suggestions such as using with(), withCount(), select(), DB::transaction(), Model::shouldBeStrict(), and Prunable traits.
  • Use Case: Run a repository scan to produce a findings-by-category report showing file locations, severity, and concrete code-level remediation advice for each issue.

Quick Start

Audit the Laravel repository for Eloquent issues and return a structured report with file-level evidence, severities, and suggested fixes for N+1s, casts, mass-assignment, large-memory loads, and relationship anti-patterns.

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: laraveldaily-eloquent-audit
Download link: https://github.com/LaravelDaily/AI-Workflows-For-Laravel/archive/main.zip#laraveldaily-eloquent-audit

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.