> laravel-eloquent
Advanced Eloquent ORM patterns for performance and query reuse. Use when working with Eloquent relationships, scopes, or advanced query optimization in Laravel. (triggers: app/Models/**/*.php, scope, with, eager, chunk, model)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/laravel-eloquent?format=md"Laravel Eloquent
Priority: P0 (CRITICAL)
Structure
app/
└── Models/
├── {Model}.php
└── Scopes/ # Advanced global scopes
Implementation Guidelines
- N+1 Prevention: Always use
with()or$withfor relationships. - Eager Loading: Set strict loading via
Eloquent::preventLazyLoading(). - Reusable Scopes: Define
scopeNamemethods for common query filters. - Mass Assignment: Define
$fillableand use$request->validated(). - Performance: Use
chunk(),lazy(), orcursor()for large tasks. - Casting: Use
$castsfor dates, JSON, and custom types.
Anti-Patterns
- N+1 Queries: No lazy loading: Never query relationships in loops.
- Fat Models: No business logic: Models are for data access only.
- Magic Queries: No raw SQL: Use Query Builder or Eloquent.
- Select *: No excessive data: Select only required columns.
References
> related_skills --same-repo
> typescript-tooling
Development tools, linting, and build config for TypeScript. Use when configuring ESLint, Prettier, Jest, Vitest, tsconfig, or any TS build tooling. (triggers: tsconfig.json, .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, vitest, build, compile, lint)
> typescript-security
Secure coding practices for TypeScript. Use when validating input, handling auth tokens, sanitizing data, or managing secrets and sensitive configuration. (triggers: **/*.ts, **/*.tsx, validate, sanitize, xss, injection, auth, password, secret, token)
> typescript-language
Modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)
> typescript-best-practices
Idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic. (triggers: **/*.ts, **/*.tsx, class, function, module, import, export, async, promise)