Skip to content
Back to skills

Backend Architecture

ASecurity

Use when adding or changing an endpoint, business rule, model or repository in the .NET backend (backend/). Explains the layers, auth and the checklist for a new feature.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 18, 2026
ai-agentsapibackendsecurity

Works with

  • api

Security analysis

A100/100

Scanned November 18, 2026

npx -y skills add erumkatzwan/agentic-product-starter --skill backend-architecture --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Backend Architecture?

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

Security grade badge for Backend Architecture
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/erumkatzwan-backend-architecture/badge)](https://www.skillsdirectory.com/skills/erumkatzwan-backend-architecture)

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: backend-architecture
description: Use when adding or changing an endpoint, business rule, model or repository in the .NET backend (backend/). Explains the layers, auth and the checklist for a new feature.
---

# Backend architecture

ASP.NET Core minimal APIs on .NET 10. Nullable on, warnings are errors.

## Layers

| Folder | Holds | Rules |
|---|---|---|
| `Domain/` | Entities (`User`, `FeatureFlag`, `Item`) | No framework code |
| `Data/` | Repository interfaces + implementations, seed data | Endpoints never touch storage directly |
| `Auth/` | `AccountService` (account rules), `Tokens`, `CurrentUserFilter` | Rules live here, not in endpoints |
| `Contracts/` | Request/response records | Never return domain entities from endpoints |
| `Endpoints/` | One static class per area, `Map…Endpoints` | Thin: validate, call a service/repository, map to a contract |
| `Program.cs` | Composition root | Only place that registers implementations |

## Auth

- Bearer tokens (`AddBearerToken`). Sign-in returns `{ accessToken, expiresIn, refreshToken }`.
- Signed-in endpoints: `.RequireAuthorization().AddEndpointFilter<CurrentUserFilter>()`, then `CurrentUserFilter.Get(http)`.
- Admin endpoints: `.RequireAuthorization(Tokens.AdminPolicy)`.
- Sign-out and access changes rotate `User.SecurityStamp`, which invalidates old tokens.

## Checklist: new feature

1. Model in `Domain/`, storage behind an interface in `Data/` (in-memory first).
2. Rules in a service with unit tests.
3. Contracts in `Contracts/`; validation returns `Results.ValidationProblem` with field names in camelCase.
4. Endpoints in `Endpoints/`, mapped in `Program.cs`.
5. Integration tests through `ApiFactory`.
6. If it is switchable, add a feature flag to `InMemoryFeatureFlagRepository` and to the defaults in every app.
7. Update the API table in `backend/README.md` and every app that uses the endpoint.

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 ai-agents →

Comments

Loading comments…

Newsletter

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