L
laravel-performance-select-columns
About laravel-performance-select-columns
A Laravel performance skill for developers optimizing database queries by selecting only the fields an application needs. It also emphasizes eager loading and keeping data resources aligned with query results.
Key features
- 01Select specific query columns
- 02Select relation columns with eager loading
- 03Align DTOs and resources with selected fields
- 04Avoid selecting all columns
Use cases
- 01Reduce query payloads in paginated results
- 02Load only needed fields from related models
- 03Avoid N+1 queries with eager loading
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ noartem/ skills --skill laravel-performance-select-columnsAfter installing, type/laravel-performance-select-columnsin Claude Code to confirm it loaded.
Details
From the project READMESelect Only Needed Columns
Reduce payloads by selecting exact fields:
User::select(['id', 'name'])->paginate();
Post::with(['author:id,name'])->select(['id','author_id','title'])->get();
- Avoid
*; keep DTOs/resources aligned with selected fields - Combine with eager loading to avoid N+1
Comments
Markdown supported