Skip to content
aaronontheweb avatar

Database Performance

Read/write model separation, N+1 avoidance, row limits, and AsNoTracking for EF Core and Dapper data access.

CCM score
65 of 100
skills.sh installs
741
GitHub stars
1.3K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers CQRS-style read/write separation, with distinct read projections and write commands per aggregate
  • Includes guidance on N+1 avoidance via Include in EF Core and QueryMultipleAsync batching in Dapper
  • Enforces configurable row limits on every read method and keeps joins in SQL rather than application code
  • Designed for teams choosing between EF Core and Dapper for read-heavy data access layers

Install

$ npx -y skills add aaronontheweb/dotnet-skills --skill database-performance -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Database Performance Patterns

When to Use This Skill

Use this skill when:

  • Designing data access layers
  • Optimizing slow database queries
  • Choosing between EF Core and Dapper
  • Avoiding common performance pitfalls

Core Principles

  1. Separate read and write models - Don't use the same types for both
  2. Think in batches - Avoid N+1 queries
  3. Only retrieve what you need - No SELECT *
  4. Apply row limits - Always have a configurable Take/Limit
  5. Do joins in SQL - Never in application code
  6. AsNoTracking for reads - EF Core change tracking is expensive

Read/Write Model Separation (CQRS Pattern)

Read and write models are fundamentally different - they have different shapes, columns, and purposes. Don't create a single "User" entity and reuse it everywhere.

  • Read models are denormalized, optimized for query efficiency, and return multiple projection types (UserProfile, UserSummary, UserDetailForAdmin)
  • Write models are normalized, validation-focused, and accept strongly-typed commands (CreateUserCommand, UpdateUserCommand)

Architecture

Details

Repository
github.com/aaronontheweb/dotnet-skills
Categories
Databases, .NET & C#
First seen
Jun 3, 2026

Questions

What does the database-performance skill do?

The database-performance skill gives data access patterns for performance, such as separating read and write models, avoiding N+1 queries, using AsNoTracking, applying row limits, and doing joins in SQL. It works with both EF Core and Dapper.

How do I install the database-performance skill?

Run npx -y skills add aaronontheweb/dotnet-skills --skill database-performance -y in your project. This lets the agent apply these data access patterns when you design data layers or optimize slow queries.

Which other skills are in the Databases category?

The database-performance skill sits in the Databases category alongside supabase-postgres-best-practices, prisma-client-api, prisma-database-setup, prisma-cli and prisma-postgres. It stands out by focusing on EF Core and Dapper access patterns for performance.

Does the database-performance skill need EF Core or Dapper?

The skill covers both EF Core and Dapper, so it helps whichever you use. Its examples show AsNoTracking and Include for EF Core, and QueryMultipleAsync batch queries for Dapper.

More from aaronontheweb/dotnet-skills

All 34

Similar to Database Performance

More Databases