技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
laravel-database-expert【数据与研究】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.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
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.When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant:
INSERT/UPDATE/DELETE
correlated subqueries
grouped invalidation
no code changes needed
posts.all
Additional task-grounded exact anchors: Cache::remember; withAvg