ASP.NET Core Project Free Claude Code CLAUDE.md template, copy & paste
A CLAUDE.md for an ASP.NET Core app: build and test commands, project layout, EF Core rules and the traps.
WHEN TO USE IT
When you start using Claude Code on a .NET web project and want it to build, test and migrate the way your team does.
Formats change. If a field stops working, check it against Anthropic's documentation.
Replace the bracketed parts. Keep the 'Do not' section even if it feels obvious — those are the lines that save the most time.
# [Project name]
[One sentence: what this application does and who uses it.]
## Commands
- Build: `dotnet build`
- Run: `dotnet run --project src/[App]` → http://localhost:5000
- Test: `dotnet test` (all tests must pass before a change is done)
- Format: `dotnet format`
- New migration: `dotnet ef migrations add <Name> --project src/[App].Data`
## Layout
- `src/[App]` — web host, controllers / Razor Pages
- `src/[App].Domain` — entities and business rules, no EF references
- `src/[App].Data` — DbContext, migrations, repositories
- `tests/` — xUnit; integration tests use WebApplicationFactory
## Conventions
- Nullable reference types are on; fix warnings, do not suppress them
- Async all the way: no `.Result` or `.Wait()`
- Options classes bound with `ValidateOnStart()`
- Every new endpoint gets an integration test
## Do not
- Edit files under `Migrations/` by hand — add a new migration instead
- Put secrets in appsettings.json — use user secrets or environment variables
- Add a NuGet package without saying why in the summary
The project root. Commit it — it is as much documentation for the next person as it is for Claude.
mv CLAUDE.md ./CLAUDE.md
git add CLAUDE.md
# or let Claude draft one from the codebase, then edit it:
# /init
MORE CLAUDE.MD
The authority
Anthropic's documentation for CLAUDE.md
This template is a starting point. Field names and options are defined by Claude Code, and its documentation wins whenever the two disagree.
https://code.claude.com/docs/en/memory