skills/laravel/laravel-database-expert/SKILL.md
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.
npx skillsauth add hoangnguyen0403/agent-skills-standard laravel-database-expertInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
DB::enableQueryLog() or Laravel Debugbar.withCount(), withSum(), or addSelect subqueries.Cache::remember() with tags for frequently accessed data.read/write keys in config/database.php.See implementation examples for cache-aside pattern with tag-based invalidation.
joinSub($subquery, 'alias', ...) and whereExists(fn($q) => $q->select(DB::raw(1))...) over raw SQL or whereIn for correlated subqueries.addSelect with DB::raw subquery to avoid N+1 issues.withCount(), withSum(), and withAvg() directly via Eloquent for optimized column-based aggregation.selectRaw or whereRaw with bindings; never use string concatenation in raw queries.Cache::remember('key', $ttl, $closure) for frequently accessed data (e.g., posts.all).Cache::tags(['posts', 'user:1']) for grouped invalidation.Cache::tags(['posts'])->flush() to clear specific subsets; never use Cache::flush() globally in production.config/database.php mysql/pgsql connections. Laravel automatically routes SELECT to read and INSERT/UPDATE/DELETE to write; no code changes needed.Cache::flush(): Use tags to target specific cache groups.development
Standardize SRS and FRS specifications for technical behavior, interfaces, data contracts, quality constraints, and verification mapping. Use when writing SRS, functional specification, system behavior requirements, API/data contracts, or non-functional thresholds.
development
Standardize BRD and BRD-lite discovery for business goals, stakeholder impact, current-to-future state, and measurable value outcomes. Use when creating BRD, business case, project justification, ROI narrative, or AS-IS to TO-BE scope.
development
Implements a strict Red-Green-Refactor loop to ensure zero production code is written without a prior failing test. Use when: creating new features, fixing bugs, or expanding test coverage.
testing
Standardize PRD discovery and drafting for product scope, user outcomes, requirement IDs, and acceptance criteria. Use when creating PRD, product requirements, feature specification, or acceptance criteria plan.