ef-core — GitHub Copilot skill: what it does, how to install
This skill guides Entity Framework Core reviews and suggests practices for models, queries, migrations, security, and tests. Use it when EF Core code needs a focused check.
npx skills add github/awesome-copilot --skill ef-coreWhat ef-core does
ef-core helps review Entity Framework Core code against practices for DbContext and entity design. It covers focused DbContext classes, constructor injection, fluent configuration, IEntityTypeConfiguration, relationships, constraints, navigation properties, owned entity types, and DbContextFactory for console apps or tests.
The skill examines query and performance choices such as AsNoTracking(), Skip() and Take(), Include(), Select projections, compiled queries, and N+1 problems. It also looks at IQueryable execution, LINQ operators, transactions, concurrency control, parameterized SQL, data access permissions, and DbContext lifetimes. Migration guidance includes small descriptive changes, checking SQL before production, migration bundles, and isolated migration tests.
For tests, it considers the in-memory database provider, SQLite contexts for integration tests, mocks for DbContext and DbSet, and snapshot testing for model changes. Install it when your project uses EF Core and you want focused code review guidance. It is unnecessary for projects that do not use Entity Framework Core.
What it helps with
- review DbContext and entity configuration
- spot N+1 queries and excessive related-data loading
- choose a suitable EF Core projection or tracking mode
- check migrations before applying them to production
- prepare isolated contexts for EF Core tests
Example prompts for the agent
- Review this DbContext using the ef-core skill.
- Find N+1 risks and query issues involving Include() and AsNoTracking().
- Check this migration and its SQLite integration tests against ef-core practices.
How to install ef-core
1Skills CLI (Vercel)
npx skills add github/awesome-copilot --skill ef-core2GitHub CLI
gh skill install github/awesome-copilot ef-core3Manually: put the files in place
.github/skills/ef-core/SKILL.md1Skills CLI (Vercel)
npx skills add github/awesome-copilot --skill ef-core -a claude-code2Manually: put the files in place
~/.claude/skills/ef-core/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/ef-core/
Manually: put the files in place
.agents/skills/ef-core/SKILL.mdFor all projects use ~/.agents/skills/
Manually: put the files in place
.cursor/skills/ef-core/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
Platform CLI
gemini skills install https://github.com/github/awesome-copilot --path skills/ef-coreManually: put the files in place
.devin/skills/ef-core/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set554
The whole set →Similar
Questions about ef-core
How do I install ef-core in GitHub Copilot?
Run npx skills add github/awesome-copilot --skill ef-core. The skill is then available at .github/skills/ef-core/SKILL.md. You can also run gh skill install github/awesome-copilot ef-core.
What does ef-core do?
It helps review Entity Framework Core code covering DbContext, entities, LINQ queries, migrations, saving changes, security, and testing.
Which EF Core testing approaches does it cover?
It covers the in-memory database provider for unit tests, separate SQLite contexts for integration tests, DbContext and DbSet mocks, isolated migration tests, and snapshot testing for model changes.
Source text
SKILL.md · MIT
--- name: ef-core description: 'Get best practices for Entity Framework Core' --- # 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.
© github · MIT · github/awesome-copilot