1. Habit
  2. Skills
  3. Optimizing EF Core Queries skill
dotnet · 5K installs

Optimizing EF Core Queries skill
Runs by itself, data access code changes.

Catch slow EF Core queries early.

Install the Optimizing EF Core Queries skill and make it a habit: follow https://gethabit.dev/skills/dotnet/optimizing-ef-core-queries.md

  1. 1Copy
  2. 2Paste into Claude Code, Codex or Cursor
  3. 3It runs by itself

5K installs6K starsMIT licenceSource on GitHub ↗

Optimizing EF Core Queries

by dotnet · 5K installs

The skill

The optimizing ef core queries skill reviews and fixes Entity Framework Core data access: N+1 queries, premature materialization, index-hostile predicates, tracking, Includes, paging, bulk writes and DbContext overlap.

Only when you ask.

The habit

Catch slow EF Core queries early.

↻ Runs by itselfdata access code changes

How the habit works.
You don't have to.

Three questionsWhen does it start? How does it check its work? What does it remember?

One run, step by step.
Then it stops.

Stop ruleStops after one pull request per run.

  1. 01

    Find the boundary

    Your agent finds the DbContext, DbSets, repositories and model-building code.

  2. 02

    Trace execution

    It follows each query to execution and checks Queryable versus Enumerable.

  3. 03

    Count operations

    It counts round-trips and SaveChanges calls on the calling path.

  4. 04

    Check each query

    It checks predicates, projections, bounds, ordering, Includes, tracking and parameterization.

  5. 05

    Report

    It lists prioritized findings with impact and a safe fix, and notes what was not validated.

  6. 06

    Ask on migrations

    For index fixes it adds a migration and asks you before any database update.

What it may do.
Nothing more.

Safe by defaultIt writes only in its own folder and asks you before anything goes out.

Is it for you?
Use it when it fits.

Quick checkRead both lists. If the left one sounds like you, the Optimizing EF Core Queries skill helps.

Use it when

  • ✓ EF Core queries are slow
  • ✓ You see N+1 query patterns
  • ✓ Deep pages get slower

Skip it when

  • – You use Dapper or raw ADO.NET
  • – You have no data access code

Questions

Optimizing EF Core Queries skill, answered.

Will it apply migrations?

No. It adds a migration and waits for your approval before updating the database.

Does it cover Dapper?

No. For Dapper or raw ADO.NET it answers SQL questions without EF Core APIs.

How do I install the Optimizing EF Core Queries skill?

Copy the prompt at the top into your agent. It installs the skill from dotnet/skills and sets up the habit. Or run npx skills add dotnet/skills --skill optimizing-ef-core-queries.

Is the Optimizing EF Core Queries skill free?

Yes. It is published under MIT. Habit is free too.

Optimizing EF Core Queries. Now as a habit.

Install the Optimizing EF Core Queries skill and make it a habit: follow https://gethabit.dev/skills/dotnet/optimizing-ef-core-queries.md

  • Free
  • No account
  • Undo in one line

All dotnet skills →More code skills →

Works in

  • Claude Code
  • Codex
  • Cursor
  • ChatGPT
  • Claude app

Made by dotnet, published under MIT. Habit links to the original and never changes it. Is this your skill?

Copying didn't work here. Select the line and copy it by hand.