ef-core-patterns

ef-core-patterns is a skill for Claude Code from zdanovichnick/dotnet-pilot. It costs 24 tokens per session (686 once invoked), scanned A, original, MIT.

A reference guide for Entity Framework Core, a .NET tool that maps application code to database tables. It covers safer database changes, query tuning, setup patterns, and common mistakes.

In plain words
What is it for?
Use it when planning database migrations, adding or changing tables and columns, configuring models, optimizing queries, or checking EF Core code for risky patterns.
Why use it?
It helps developers avoid losing data, breaking existing rows, or writing database queries that run poorly. It also provides consistent guidance for configuring EF Core.

Skill for Claude Code

Written for Claude Code: when-to-use in frontmatter.

Part of the dotnet-pilot plugin — 15 skills, 9 agents, 6 hooks, 1 MCP server shipped together

Good fit Use it when planning database migrations, adding or changing tables and columns, configuring models, optimizing queries, or checking EF Core code for risky patterns.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/zdanovichnick/dotnet-pilot/ef-core-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add zdanovichnick/dotnet-pilot --skill ef-core-patterns
Clone the repo
git clone --depth 1 https://github.com/zdanovichnick/dotnet-pilot

Made for: Claude Code.

Or install dotnet-pilot, the plugin that ships this one along with the rest of its 15 skills, 9 agents, 6 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ef-core-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/zdanovichnick/dotnet-pilot/ef-core-patterns/github.svg)](https://agentmods.dev/skills/zdanovichnick/dotnet-pilot/ef-core-patterns)
Your own site
<a href="https://agentmods.dev/skills/zdanovichnick/dotnet-pilot/ef-core-patterns"><img src="https://agentmods.dev/badge/skills/zdanovichnick/dotnet-pilot/ef-core-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ef-core-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/zdanovichnick/dotnet-pilot/ef-core-patterns"><img src="https://agentmods.dev/badge/skills/zdanovichnick/dotnet-pilot/ef-core-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 686 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00024 $0.00686
Opus 5.5 $0.00010 $0.00274
Sonnet 5.5 $0.00005 $0.00137
Haiku 4.5 $0.00002 $0.00069

Measured 29d ago against content hash 7b6a914ea0fc, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

ef-core-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 29d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/ef-core-patterns/SKILL.md · 80 lines

How it starts

The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.

EF Core Patterns

Reference material for EF Core development.

Migration Safety

Safe Operations

  • Adding a new table
  • Adding a nullable column
  • Adding a column with a default value
  • Adding an index
  • Renaming (with migrationBuilder.RenameColumn — preserves data)

Dangerous Operations (require confirmation)

  • Dropping a column (data loss)
  • Changing column type (potential data truncation)
  • Adding NOT NULL column without default (fails on existing rows)
  • Dropping a table (data loss)
  • Removing an index (performance impact)

Migration Best Practices

  • One migration per logical change
  • Generate with dotnet ef migrations add, then review and adjust the generated Up/Down (a rename scaffolded as drop + add must become RenameColumn; data moves go in Sql()). Never hand-write a migration from scratch — the model snapshot would drift
  • dotnet ef database update has no dry-run: review the SQL with dotnet ef migrations script <from> <to> (--idempotent for scripts run against unknown state)
  • dotnet ef migrations has-pending-model-changes (EF Core 8+) fails when the model has changed since the last migration — use it as a CI gate
  • Keep migrations small and reversible
  • Use migrationBuilder.Sql() for data migrations, not EF operations

Configuration Patterns

Fluent API (preferred)

public class UserConfiguration : IEntityTypeConfiguration<User>
{
    public void Configure(EntityTypeBuilder<User> builder)
    {
        builder.HasKey(u => u.Id);
        builder.Property(u => u.Email).HasMaxLength(256).IsRequired();
        builder.HasIndex(u => u.Email).IsUnique();
        builder.HasMany(u => u.Orders).WithOne(o => o.User).HasForeignKey(o => o.UserId);
    }
}

DbContext Registration

// In OnModelCreating:
modelBuilder.ApplyConfigurationsFromAssembly(typeof(ApplicationDbContext).Assembly);

Query Optimization

Do

  • Use AsNoTracking() for read-only queries
  • Use projections (Select) to fetch only needed columns
  • Use Include with ThenInclude for eager loading (avoid N+1)
  • Use split queries for many includes: .AsSplitQuery()
  • Use ExecuteUpdateAsync / ExecuteDeleteAsync for bulk operations (EF 7+)

Read the full file on GitHub · 80 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 29d ago Changed · +6 lines 7b6a914ea0fc
  2. 1mo ago First seen · 74 lines · 24 tokens per session scan A 0ab7f2c851e7

Subscribe to this mod's changes

ef-core-patterns is a skill published in the GitHub repository zdanovichnick/dotnet-pilot (5 stars, last pushed 13d ago), licensed MIT. It adds 24 tokens to every session and 686 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

azure-resource-manager-postgresql-dotnet

Azure PostgreSQL Flexible Server SDK for .NET. Database management for PostgreSQL Flexible Server deployments. Use for creating servers, databases, firewall rules, configurations, backups, and high availability. Triggers: "PostgreSQL", "PostgreSqlFlexibleServer", "PostgreSQL Flexible Server", "Azure Database for…

microsoft/skills · 97 tokens

entity-design

Design EF Core entities with navigation properties, value objects, Fluent API configuration, and audit fields. Use when creating new database entities, adding relationships, configuring owned types, designing a domain model for Entity Framework Core, or setting up table-per-hierarchy inheritance.

andresharpe/dotbot · 54 tokens

create-migration

Create and manage Entity Framework Core database migrations including schema changes, seed data, and rollback strategies. Use when adding or modifying EF Core entities, setting up a new DbContext, applying data seeding, running dotnet ef commands, or troubleshooting migration conflicts.

andresharpe/dotbot · 55 tokens

language-csharp

C# and .NET idioms — .NET 8 LTS, C# NRT, records, value semantics, switch expressions, async/await, Task, ValueTask, CancellationToken, ConfigureAwait, IOptions , LINQ, Span , ArrayPool, hot path, allocation profiling, and performance. Auto-load when working with .cs files, .csproj, .sln, Directory.Build.props, or…

lugassawan/swe-workbench · 142 tokens

creating-oracle-to-postgres-master-migration-plan

Discovers all projects in a .NET solution, classifies each for Oracle-to-PostgreSQL migration eligibility, and produces a persistent master migration plan. Use when starting a multi-project Oracle-to-PostgreSQL migration, creating a migration inventory, or assessing which .NET projects contain Oracle dependencies.

boshi-xixixi/TraeSkill · 71 tokens

add-migration

Create an EF Core migration for a specific microservice. Use after adding or modifying entities, DbSets, or entity configurations -- migration creation is mandatory for any schema change.

makigjuro/cloudstack-ai-plugins · 38 tokens