Official agent skill

Model Building

by dotnet in dotnet/efcore

Implementation details for EF Core model building. An agent skill from dotnet/efcore.

OfficialMITAuto-check passed

Install Model Building

skills CLI
$ npx skills add dotnet/efcore --skill model-building -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install dotnet/efcore model-building --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/dotnet/efcore.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/model-building .claude/skills/model-building && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
model-building
GitHub stars
15k
Token cost
~1.4k tokens
SKILL.md length
499 words
Files
1
Skills in repo
17
Repo updated
First seen
Licence
MIT

At a glance

Implementation details for EF Core model building. An agent skill from dotnet/efcore.

  • Works in 3 steps: Mutable Model — built by ModelBuilder… → Design-Time Model — finalized read-only… → Runtime Model — an optimized read-only…
  • Changing ConventionSet
  • SKILL.md covers Convention System, Metadata Interface Hierarchy, Model Lifecycle and Complex Type Property Recursion, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Model Building is an agent skill from dotnet/efcore, published by the product's own GitHub organization. Implementation details for EF Core model building. Use when changing ConventionSet, ModelBuilder, IConvention implementations, ModelRuntimeInitializer, RuntimeModel, or related classes.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations. The licence is MIT.

When your agent uses it

  • Changing ConventionSet
  • IConvention implementations
  • ModelRuntimeInitializer
  • Related classes

Example prompts

  • “/model-building”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Mutable Model — built by ModelBuilder during OnModelCreating, made read-only by FinalizeModel()
  2. Design-Time Model — finalized read-only Model that also contains design-time-only annotations used in migrations
  3. Runtime Model — an optimized read-only model created by RuntimeModelConvention.ProcessModelFinalized(), does not contain design-time-only…

What it can do on your machine

Read from SKILL.md and the folder at commit d2f4410. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Model Building loads about 1.4k tokens when it runs. Until then it costs about 50 tokens; SKILL.md has 499 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~50
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from dotnet/efcore at commit d2f4410, republished under its MIT licence (© dotnet). 499 words, ~1,428 tokens.

Download SKILL.mdSave it as .claude/skills/model-building/SKILL.md (or your agent's skills folder).
name
model-building
description
Implementation details for EF Core model building. Use when changing ConventionSet, ModelBuilder, IConvention implementations, ModelRuntimeInitializer, RuntimeModel, or related classes.
user-invocable
false

Model Building, Conventions & Initialization

Covers model construction (conventions, fluent API, metadata hierarchy) and model initialization (runtime annotation propagation, compiled model filtering).

Convention System

ConventionSet (src/EFCore/Metadata/Conventions/ConventionSet.cs) holds List<I*Convention> for every metadata event. Key conventions in src/EFCore/Metadata/Conventions/:

  • DbSetFindingConvention — discovers entities from DbSet<T>
  • PropertyDiscoveryConvention — discovers properties from CLR types
  • KeyDiscoveryConvention — finds PKs (Id, TypeId)
  • RelationshipDiscoveryConvention — infers FKs from navigations
  • RuntimeModelConvention — creates optimized RuntimeModel from mutable model

Override ConfigureConventions(ModelConfigurationBuilder) to add/remove conventions.

Metadata Interface Hierarchy

IReadOnly* → IMutable* → IConvention* → IRuntime*

Applies to: Model, EntityType, Property, Key, ForeignKey, Navigation, Index, etc. Builders follow: *Builder → IConvention*Builder.

Model Lifecycle

  1. Mutable Model — built by ModelBuilder during OnModelCreating, made read-only by FinalizeModel()
  2. Design-Time Model — finalized read-only Model that also contains design-time-only annotations used in migrations
  3. Runtime Model — an optimized read-only model created by RuntimeModelConvention.ProcessModelFinalized(), does not contain design-time-only annotations

ModelRuntimeInitializer.Initialize() (called by DbContextServices.CreateModel()):

Initialize(model, designTime, validationLogger)
├─ FinalizeModel() if mutable
├─ Set ModelDependencies, InitializeModel
└─ RuntimeModelConvention creates RuntimeModel, copies/filters annotations

Complex Type Property Recursion

When processing properties in conventions or validation, remember that complex types can contain their own declared properties. Use GetFlattenedProperties() to iterate all properties (including on nested non-collection complex types) or manually recurse through GetDeclaredComplexProperties() → complexProperty.ComplexType.

Adding a New Annotation

  1. Add constant to CoreAnnotationNames and its AllNames
  2. Filter in RuntimeModelConvention.ProcessModelAnnotations if it's a design-time-only annotation (only used in migration operations)
    1. If it was filtered out, add logic to the getters that throws an exception if accessed on the runtime model
  3. Filter in CSharpRuntimeAnnotationCodeGenerator.Generate if it can be computed lazily at runtime (e.g. based on other annotations)
  4. Propagate in RelationalAnnotationProvider if used in up-migrations or the relational model and IMigrationsAnnotationProvider if used in down-migrations

Relational Model

RelationalModel (src/EFCore.Relational/Metadata/Internal/RelationalModel.cs) is a database-centric view of the EF model, mapping entity types to physical database objects: Tables, Views, Functions, Queries, and DefaultTables. DefaultTables are pseudo-table objects only used for FromSql queries.

Created lazily by RelationalModelRuntimeInitializer, accessed via model.GetRelationalModel(). Used by migrations (MigrationsModelDiffer), update and query pipelines.

RelationalAnnotationProvider populates annotations on relational model elements. Provider subclasses (e.g., SqlServerAnnotationProvider) add provider-specific annotations. IMigrationsAnnotationProvider controls annotations used in down-migration operations.

Show full SKILL.md (172 more words)Show less

Model Validation

ModelValidator (src/EFCore/Infrastructure/ModelValidator.cs) and RelationalModelValidator (src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs) run after model finalization, during ModelRuntimeInitializer.Initialize() between the pre- and post-validation InitializeModel calls.

Migration Snapshot Compatibility

Model-building changes can trigger spurious migrations for users who upgrade. Two causes:

  1. New metadata written to the snapshot — old snapshots won't have it; MigrationsModelDiffer sees a diff. Fix: ensure absence of the annotation in an old snapshot is treated as the old default.
  2. Annotation renamed or reinterpreted — old snapshots produce a different model. Fix: keep backward-compatible reading logic.

Inspect CSharpSnapshotGenerator (what gets written) and MigrationsModelDiffer (how absence is handled). Add a snapshot round-trip test in test/EFCore.Design.Tests/Migrations/ModelSnapshotSqlServerTest.cs.

Testing

AreaLocation
Convention unit teststest/EFCore.Tests/Metadata/Conventions/
Metadata unit teststest/EFCore.Tests/Metadata/Internal/
Model builder API teststest/EFCore.Specification.Tests/ModelBuilding/ModelBuilderTest*.cs
Relationship discovery teststest/EFCore.Specification.Tests/ModelBuilding101*.cs
Model validation teststest/EFCore.Tests/Infrastructure/ModelValidatorTest*.cs
Compiled model teststest/EFCore.Specification.Tests/Scaffolding/CompiledModelTestBase.cs

Validation

  • Model builds without InvalidOperationException during finalization
  • All new API is covered by tests
  • Compiled model baselines update cleanly with EF_TEST_REWRITE_BASELINES=1
  • ToString() on metadata objects shows concise contents without throwing exceptions
  • No spurious migration is generated against a project with an existing snapshot

© dotnet, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/model-building of dotnet/efcore.

Open the folder on GitHubat commit d2f4410

Compare with similar skills

Model Building next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Model Building compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Model Building this skilldotnet/efcore15k—~1.4kAutomated safety check: PassMIT
Make Changesremix-run/remix33k—~2.4kAutomated safety check: PassMIT
Orch Change Featureaffaan-m/ECC275k1 repos~420Automated safety check: PassMIT
Change Managementsickn33/agentic-awesome-skills47k2 repos~3.5kAutomated safety check: PassMIT
Implement Changepnpm/pnpm37k—~1.1kAutomated safety check: PassMIT
Testing Changespnpm/pnpm37k—~1.1kAutomated safety check: PassMIT

Similar skills

  • Make Changes

    remix-run/remix

    Create or update Remix repo change files under packages//.changes.

    33k GitHub stars~2.4k tokensUpdated today
    DevelopmentAuto-check passed
  • Orchestrate altering an existing, working feature to new desired behavior — update its tests to the new spec, change the implementation to match, review, and gated commit.

    275k GitHub starsUsed in 1 repo~420 tokens
    Auto-check passed
  • Change Management

    sickn33/agentic-awesome-skills

    Implement change management processes. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 2 repos~3.5k tokens
    DevOps & CloudAuto-check passed
  • Implement a pnpm feature, bug fix, or refactor by checking existing capabilities, prioritizing code reuse and deduplication, assessing architecture impact, and validating the final change.

    37k GitHub stars~1.1k tokensUpdated today
    DevelopmentAuto-check passed
  • Run the tests that cover a change in the pnpm repository, in the Rust workspace (pnpm/, pnpr/) or the TypeScript CLI (pnpm11/), and recognize the cases where a scoped run passes without testing…

    37k GitHub stars~1.1k tokensUpdated today
    DevelopmentAuto-check passed
  • Change Management

    alirezarezvani/claude-skills

    Framework for rolling out organizational changes without chaos.

    28k GitHub starsUsed in 2 repos~2.9k tokens
    Auto-check passed

More from dotnet/efcore

All 17 skills in this repo
  • Make Skill

    dotnet/efcore

    Official

    Create and evaluate new Agent Skills for GitHub Copilot. An agent skill from dotnet/efcore.

    15k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • Make Custom Agent

    dotnet/efcore

    Official

    Create custom GitHub Copilot agents. An agent skill from dotnet/efcore.

    15k GitHub stars~2.3k tokensUpdated today
    Auto-check passed
  • Official

    Create GitHub Actions workflows for CI, automation, or PR management.

    15k GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • Make Instructions

    dotnet/efcore

    Official

    Create and evaluate VS Code file-based instructions (.instructions.md files).

    15k GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • Run Apichief

    dotnet/efcore

    Official

    Run ApiChief in the EF Core repo to emit baselines, summaries, deltas, review files, or breaking-change checks.

    15k GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • Servicing PR

    dotnet/efcore

    Official

    Create EF Core PRs targeting servicing release branches (release/).

    15k GitHub stars~833 tokensUpdated today
    Auto-check passed

Questions about Model Building

What does Model Building do?

Implementation details for EF Core model building. An agent skill from dotnet/efcore. Model Building is an agent skill from dotnet/efcore, published by the product's own GitHub organization. Implementation details for EF Core model building.

When should I use Model Building?

Model Building fits situations like: changing ConventionSet; IConvention implementations; modelRuntimeInitializer; related classes.

How do I install Model Building in Claude Code?

Run `npx skills add dotnet/efcore --skill model-building -a claude-code`. Or copy the skill folder (.agents/skills/model-building in dotnet/efcore) into .claude/skills/model-building in your project. Claude Code loads it when a task matches its description.

How do I install Model Building in Codex?

Run `npx skills add dotnet/efcore --skill model-building -a codex`. Or copy the skill folder (.agents/skills/model-building in dotnet/efcore) into .agents/skills/model-building in your project. Codex loads it when a task matches its description.

Can I use Model Building in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add dotnet/efcore --skill model-building -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/model-building, .gemini/skills/model-building, .github/skills/model-building and .opencode/skills/model-building in your project.

What does Model Building need to run?

SKILL.md names no scripts, command-line tools or credentials: Model Building is instructions for the agent only.

Does Model Building access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Model Building safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Model Building use?

Model Building is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Model Building use?

About 1.4k tokens (SKILL.md is roughly 5.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Model Building?

Skills that share tags, products or a category with Model Building: Make Changes (remix-run/remix, 33k stars), Orch Change Feature (affaan-m/ECC, 275k stars), Change Management (sickn33/agentic-awesome-skills, 47k stars) and Implement Change (pnpm/pnpm, 37k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Model Building?

dotnet (a GitHub organization, an official publisher) maintains it in dotnet/efcore, which has 14,800 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on October 8, 2026.

Source: dotnet/efcore on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.