ef-core
Skill0 starsChanged 2 months agoMITView on GitHub
Get best practices for Entity Framework Core
5 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- codewithmukesh/dotnet-claude-kittheir own version, first seen Nov 8, 2026
- github/awesome-copilotedited, first seen Oct 25, 2026
- Resgrid/Coretheir own version, first seen Oct 8, 2026
- solakpetri/Enzo.Ai.Skillstheir own version, first seen Aug 13, 2026
- rloisell/rl-agents-n-skillstheir own version, first seen Jun 5, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- github/awesome-copilot★ 41k100% same
Wrote their own version · 4
- codewithmukesh/dotnet-claude-kit★ 808same name
- Resgrid/Core★ 238same name
- rloisell/rl-agents-n-skills★ 8same name
- solakpetri/Enzo.Ai.Skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository21 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- angular-developerSkill
- channels-setupSkill
- copilotkit-channelsSkill
- copilotkit-cliSkill
- copilotkitSkill
- csharp-asyncSkill
- csharp-docsSkill
- csharp-xunitSkill
- github-actions-efficiencySkill
- github-actions-hardeningSkill
- github-actions-runtime-upgrade-conventionsSkill
- inspector-docsSkill
- inspector-workbenchSkill
- intelligence-docsSkill
- microsoft-agent-frameworkSkill
- microsoft-docsSkill
- ngrx-signal-storeSkill
- prdSkill
- setup-slack-channelSkill
- technical-writingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
30 rules. 0 are common, 30 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
30
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Keep DbContext classes focused and cohesive
- Distinctive: line 13
Use constructor injection for configuration options
- Distinctive: line 16
Consider using DbContextFactory pattern for console apps or tests
- Distinctive: line 20
Use meaningful primary keys (consider natural vs surrogate keys)
- Distinctive: line 22
Use data annotations or fluent API for constraints and validations
- Distinctive: line 24
Consider using owned entity types for value objects
- Distinctive: line 28
Use AsNoTracking() for read-only queries
- Distinctive: line 30
Use Include() to eager load related entities when needed
- Distinctive: line 31
Consider projection (Select) to retrieve only required fields
- Distinctive: line 32
Use compiled queries for frequently executed queries
- Distinctive: line 33
Avoid N+1 query problems by properly including related data
- Distinctive: line 37
Create small, focused migrations
- Distinctive: line 39
Verify migration SQL scripts before applying to production
- Distinctive: line 40
Consider using migration bundles for deployment
- Distinctive: line 41
Add data seeding through migrations when appropriate
- Distinctive: line 45
Use IQueryable judiciously and understand when queries execute
- Distinctive: line 46
Prefer strongly-typed LINQ queries over raw SQL
- Distinctive: line 47
Use appropriate query operators (Where, OrderBy, GroupBy)
- Distinctive: line 48
Consider database functions for complex operations
- Distinctive: line 53
Use appropriate change tracking strategies
- Distinctive: line 56
Consider using transactions for multiple operations
- Distinctive: line 57
Use appropriate DbContext lifetimes (scoped for web apps)
- Distinctive: line 61
Avoid SQL injection by using parameterized queries
- Distinctive: line 64
Consider data encryption for sensitive information
- Distinctive: line 65
Use migrations to manage database user permissions
- Distinctive: line 69
Use in-memory database provider for unit tests
- Distinctive: line 70
Create separate testing contexts with SQLite for integration tests
- Distinctive: line 72
Test migrations in isolated environments
- Distinctive: line 73
Consider snapshot testing for model changes
- Distinctive: line 75
When reviewing my EF Core code, identify issues and suggest improvements that follow these best practices.
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Entity Framework Core Best Practices
Your goal is to help me follow best practices when working with Entity Framework Core.
Data Context Design
- Keep DbContext classes focused and cohesive
- Use constructor injection for configuration options
- Override OnModelCreating for fluent API configuration
- Separate entity configurations using IEntityTypeConfiguration
- Consider using DbContextFactory pattern for console apps or tests
Entity Design
- Use meaningful primary keys (consider natural vs surrogate keys)
- Implement proper relationships (one-to-one, one-to-many, many-to-many)
- Use data annotations or fluent API for constraints and validations
- Implement appropriate navigational properties
- Consider using owned entity types for value objects
Performance
- Use AsNoTracking() for read-only queries
- Implement pagination for large result sets with Skip() and Take()
- Use Include() to eager load related entities when needed
- Consider projection (Select) to retrieve only required fields
- Use compiled queries for frequently executed queries
- Avoid N+1 query problems by properly including related data
Migrations
- Create small, focused migrations
- Name migrations descriptively
- Verify migration SQL scripts before applying to production
- Consider using migration bundles for deployment
- Add data seeding through migrations when appropriate
Querying
- Use IQueryable judiciously and understand when queries execute
- Prefer strongly-typed LINQ queries over raw SQL
- Use appropriate query operators (Where, OrderBy, GroupBy)
- Consider database functions for complex operations
- Implement specifications pattern for reusable queries
Change Tracking & Saving
- Use appropriate change tracking strategies
- Batch your SaveChanges() calls
- Implement concurrency control for multi-user scenarios
- Consider using transactions for multiple operations
- Use appropriate DbContext lifetimes (scoped for web apps)
Security
- Avoid SQL injection by using parameterized queries
- Implement appropriate data access permissions
- Be careful with raw SQL queries
- Consider data encryption for sensitive information
- Use migrations to manage database user permissions
Testing
- Use in-memory database provider for unit tests
- Create separate testing contexts with SQLite for integration tests
- Mock DbContext and DbSet for pure unit tests
- Test migrations in isolated environments
- Consider snapshot testing for model changes
When reviewing my EF Core code, identify issues and suggest improvements that follow these best practices.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

