Skip to content
Back to skills

Dotnet Services

ASecurity

Build ASP.NET Core services: dependency injection, async, EF Core, validation, options and tests

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
developmentsqlapi

Works with

  • api

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add AdityaaaTiwari/ANVIL --skill dotnet-services --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dotnet Services?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Dotnet Services
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adityaaatiwari-dotnet-services/badge)](https://www.skillsdirectory.com/skills/adityaaatiwari-dotnet-services)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: dotnet-services
description: "Build ASP.NET Core services: dependency injection, async, EF Core, validation, options and tests"
---

<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->

# .NET services

Use in solutions with `.csproj` / `.sln` files.

## Async and DI
- `async` all the way: never `.Result` or `.Wait()` on tasks (deadlocks and thread starvation). Pass `CancellationToken` through.
- Register services with the right lifetime: `DbContext` is scoped; do not inject scoped services into singletons.
- Bind configuration to typed options (`IOptions<T>`) with validation on start (`ValidateDataAnnotations().ValidateOnStart()`).

## EF Core
- Migrations via `dotnet ef migrations add`; review the generated code and the SQL (`dotnet ef migrations script`).
- Use `AsNoTracking()` for read-only queries and projections (`Select`) to avoid loading whole entities.
- Watch for N+1 with lazy loading; prefer explicit `Include` or projections.
- Never build SQL strings; `FromSqlInterpolated` parameterizes, `FromSqlRaw` with concatenated input does not.

## API
- Validate input (data annotations or FluentValidation) and return `ProblemDetails` for errors.
- Authorization with policies and resource-based checks for object ownership.
- Enable nullable reference types and treat warnings as errors in new projects.

## Verify
`dotnet build -warnaserror`, `dotnet test`, and `dotnet format --verify-no-changes` if the repo uses it.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.