ef-core-safety
Skill4 starsChanged 53 days agoMITView on GitHub
Design, implement, or review Entity Framework Core queries, writes, migrations, and DbContext usage. Use only when a .NET task changes EF Core persistence behavior or investigates database performance/correctness.
In this repository37 other files it gives its agents.
- global-instructions/AGENTS.mdAGENTS.md
- api-contract-safetySkill
- api-endpoint-deprecationSkill
- aspnet-core-api-developmentSkill
- background-services-dotnetSkill
- bug-investigationSkill
- code-qualitySkill
- code-reviewSkill
- context-resetSkill
- dependency-managementSkill
- deployment-readiness-dotnetSkill
- diff-reviewSkill
- distributed-workflowsSkill
- dotnet-architectureSkill
- dotnet-implementationSkill
- dotnet-securitySkill
- exception-handlingSkill
- git-workflowSkill
- google-bigquery-dotnetSkill
- google-cloud-pubsub-dotnetSkill
- google-firestore-dotnetSkill
- http-client-integrationsSkill
- integration-testing-dotnetSkill
- observability-dotnetSkill
- performance-diagnostics-dotnetSkill
- poc-developmentSkill
- production-debuggingSkill
- production-hotfixSkill
- production-loggingSkill
- redis-dotnetSkill
- relational-database-dotnetSkill
- retry-resilienceSkill
- safe-terminalSkill
- shared-code-impactSkill
- targeted-validationSkill
- task-routerSkill
- unit-testingSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Keep DbContext scoped to a unit of work and never use one instance concurrently.
- Distinctive: line 15
Treat migrations as production contracts: inspect generated operations, data loss, locks, defaults/backfills, deployment ordering, …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
EF Core safety
Understand the entity model, mappings, query shape, indexes, tracking needs, transaction boundary, concurrency behavior, and migration history before editing.
- Keep
DbContextscoped to a unit of work and never use one instance concurrently. Await each operation before starting the next. - Project only needed data; avoid accidental N+1 queries, client evaluation assumptions, unbounded result sets, premature materialization, and unnecessary tracking (
AsNoTrackingfor read-only work when consistent with the repository). - Propagate cancellation to async database calls. Use async methods for request-path I/O.
- Make transaction boundaries explicit when multiple writes must be atomic. Account for execution-strategy retries and external side effects; do not assume a database transaction covers remote calls.
- Handle optimistic concurrency deliberately when lost updates matter. Design retry/merge behavior rather than blindly overwriting.
- Treat migrations as production contracts: inspect generated operations, data loss, locks, defaults/backfills, deployment ordering, mixed-version compatibility, and rollback/roll-forward strategy.
Do not introduce a custom retry loop merely because a database failure might be transient. Add retry behavior only when explicitly requested or already required/configured by the architecture, prefer the provider's EF Core execution strategy, and verify idempotency, transaction boundaries, duplicate-write safety, timeout budget, bounded attempts, cancellation, and permanent-error classification.
Validate query behavior and SQL/performance when risk warrants it. Test provider-specific behavior with the appropriate provider; do not assume an in-memory provider reproduces relational semantics.
For production schema changes, prefer an expand/backfill/contract sequence where mixed application versions must coexist. Review backfill batching, locks, resumability and compatibility before deployment. Verify migrations and constraints against the actual provider when practical.
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.

