ef-core-patterns

Guide EF Core migrations, Fluent API configurations, and query optimization in .NET.

4|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/zdanovichnick/dotnet-pilot --skill ef-core-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ef-core-patterns
Source: https://github.com/zdanovichnick/dotnet-pilot/tree/main/skills/ef-core-patterns
Command: npx skills add https://github.com/zdanovichnick/dotnet-pilot --skill ef-core-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It prevents broken EF Core migrations and inefficient or unsafe query patterns by providing vetted guidance for schema changes, configuration, and performance-minded data access.

Core Features & Use Cases

  • Migration Safety Playbook: Distinguishes safe vs dangerous migration operations (e.g., dropping data or changing types) and outlines best practices like small, reversible changes and avoiding manual edits to generated migrations.
  • Configuration Patterns: Provides a clean approach using Fluent API entity configurations and applying configurations from the DbContext assembly.
  • Query Optimization Checklist: Recommends performance-safe query practices such as AsNoTracking for reads, projection to reduce data loading, and safer SQL usage patterns.

Quick Start

Ask for a migration plan and query review by saying: "Using ef-core-patterns, which EF Core migration operations are risky for dropping or changing a column type, and what query and configuration practices should I follow for this DbContext?"

Frequently Asked Questions about ef-core-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are the most dangerous EF Core migration operations I should avoid?

Dangerous EF Core migration operations include dropping data and changing column types, which can cause data loss. The safest approach is making small, reversible schema changes and avoiding manual edits to generated migrations.

How do I configure EF Core entities using Fluent API patterns?

EF Core Fluent API configuration is best implemented using IEntityTypeConfiguration setups applied directly from the DbContext assembly. This pattern ensures consistent entity configuration and maintains clean separation of schema rules.

What's the best way to optimize EF Core queries for read performance?

Optimizing EF Core queries requires using AsNoTracking for read-only operations and projecting data to reduce loading. You must also avoid premature materialization and unsafe raw SQL interpolation to ensure correctness.

Can I manually edit generated EF Core migrations before applying them to the database?

Manually editing generated EF Core migrations is strongly discouraged as it breaks deterministic operational requirements. You should instead rely on small, reversible schema changes generated directly by the framework.

Why does EF Core raw SQL interpolation create unsafe query behavior?

Unsafe raw SQL interpolation in EF Core creates query vulnerability risks by bypassing parameterized safety mechanisms. Safer SQL usage patterns enforce proper parameterization to maintain both performance and query correctness.

Does ef-core-patterns help with planning schema changes in .NET applications?

Yes, ef-core-patterns provides vetted guidance for planning schema changes in .NET applications by enumerating safe versus dangerous migration actions and specifying Fluent API configuration patterns for consistent setups.