laravel-eloquent-database

Community

Master Laravel's data layer.

Authorsasabajic
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill provides a comprehensive guide to writing efficient, maintainable, and best-practice-compliant code for Laravel's Eloquent ORM and database interactions, preventing common pitfalls like N+1 query problems and ensuring robust data management.

Core Features & Use Cases

  • Eloquent Model Structure: Enforces a consistent and organized order for model properties, relationships, scopes, and methods.
  • Relationship Management: Guides on defining and querying relationships effectively, including eager loading and existence checks.
  • Query Optimization: Offers strategies to prevent N+1 issues, select only necessary columns, use chunking for large datasets, and leverage database-level operations.
  • Migrations & Seeding: Outlines best practices for writing clear, rollback-friendly migrations and organizing seeders with factories.
  • Use Case: When developing a feature that displays a list of users with their associated orders, this skill ensures you use with('orders') to avoid performance degradation caused by the N+1 problem.

Quick Start

Use the laravel-eloquent-database skill to refactor the provided user model to follow best practices for Eloquent model structure.

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: laravel-eloquent-database
Download link: https://github.com/sasabajic/laravel-best-practice-skills/archive/main.zip#laravel-eloquent-database

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 223,000+ vetted skills library on demand.