Laravel database expert

From HoangNguyen0403/agent-skills-standard · View interactive version

Laravel database expert is an AI agent skill from the GitHub repository HoangNguyen0403/agent-skills-standard. Optimize Laravel queries with subqueries, joinSub, Redis cache-aside patterns, and read/write connection splitting. Use when writing complex joins, implementing Cache::remember with tags, or configuring database read replicas.

How to use this skill

Skill file

Laravel Database Expert

**Priority: P1 (HIGH)**

Workflow: Optimize Slow Query

  1. Profile query — Use DB::enableQueryLog() or Laravel Debugbar.
  2. Add missing indexes — Create migration for join/where columns.
  3. Replace N+1 — Use withCount(), withSum(), or addSelect subqueries.
  4. Cache results — Apply Cache::remember() with tags for frequently accessed data.
  5. Split reads/writes — Configure read/write keys in config/database.php.

Cache-Aside with Tags Example

See implementation examples for cache-aside pattern with tag-based invalidation.

Implementation Guidelines

Advanced Query Builder

Caching Strategy (Redis/Memcached)

Scalability & Infrastructure

Anti-Patterns

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.