ef-queries
CommunityOptimize EF Core queries and avoid N+1
AuthorFaysilAlshareef
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Many EF Core queries accidentally load too much data, perform extra database round-trips, or create N+1 performance problems; this Skill focuses on patterns that make queries efficient, safe, and scalable for .NET applications.
Core Features & Use Cases
- Read-only performance: Apply AsNoTracking and projection to return only the columns needed for UI or APIs.
- N+1 prevention: Use split queries or appropriate includes to avoid cartesian explosion when loading related collections.
- Hot-path optimization: Compile frequently used queries for reuse and high throughput, and use pagination and batch operations to control result size.
- Raw SQL & bulk work: Employ parameterized raw SQL and ExecuteUpdateAsync/ExecuteDeleteAsync for complex aggregations or bulk changes.
- Use Case: Replace full entity loads in list endpoints with Select projections and paginated responses, compile detail lookups for hot endpoints, and convert load-and-update loops to ExecuteUpdateAsync for archival jobs.
Quick Start
Optimize this query to use AsNoTracking, project results to a DTO with Select, apply pagination, and add AsSplitQuery where multiple Includes cause N+1 issues.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: ef-queries Download link: https://github.com/FaysilAlshareef/dotnet-ai-kit/archive/main.zip#ef-queries Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.