ASP.NET Core Service Workflow
Purpose
Build or modify an ASP.NET Core service with clear ownership, configuration, endpoints, tests, and validation.
The practical decision is what the service exposes, which project owns the HTTP host, where domain logic lives, how configuration reaches the app, and how tests prove behavior without turning the whole service into a fragile integration fixture.
When To Use
- Use this skill when adding or changing an ASP.NET Core API or service.
- Use this skill when deciding whether a .NET project should be a web service or a library consumed by one.
- Use this skill when adding endpoints, middleware, configuration, dependency injection, or service tests.
- Use this skill after
dotnet:choose-project-shape has identified an ASP.NET Core service shape.
Source Check
Use repo-local .NET files, checked-out dependency sources, Dash MCP or Dash HTTP for installed .NET docsets, and then official Microsoft documentation when Dash/local coverage is missing or stale:
Planning Workflow
- Inspect project shape:
- web project
- domain library
- test project
- config files
- existing endpoints
- existing hosting style
- Identify the service job:
- HTTP API
- local service
- webhook receiver
- background worker plus HTTP health surface
- internal admin tool
- Choose language and boundary:
- F# service
- C# service
- C# host with F# domain library
- F# host with C# infrastructure library
- Keep domain logic outside endpoint handlers when it has real behavior.
- Keep configuration explicit and environment-safe.
- Add tests at the smallest useful level.
- Validate with
dotnet build and dotnet test.
F# Service Notes
For F# services:
- keep endpoint functions small
- model request and response data clearly
- keep domain transformations in modules that can be tested without the HTTP host
- be explicit at task/async boundaries
- preserve
.fsproj file ordering
C# Service Notes
For C# services:
- keep nullable request/response contracts clear
- avoid overbuilding service classes for one endpoint
- use dependency injection for real external dependencies, not as decoration
- keep middleware and endpoint registration readable
- respect analyzers and warnings-as-errors
Configuration And Secrets
Do not commit secrets.
For local development, follow repo conventions first. If none exist, recommend committed safe defaults and ignored local overrides rather than hard-coded secrets. Explain which settings are required for the app to start and which settings are optional.
Testing
Choose the smallest test that proves the behavior:
- pure domain test for business rules
- endpoint-level test for routing, validation, or response shape
- integration test for host/config/middleware behavior
Do not run live external services as ordinary unit tests unless the repo already has an isolated test harness for that purpose.
Output Shape
Return:
Service shape: host project, domain project, and test project.
Language boundary: F#, C#, or mixed.
Endpoint behavior: routes, inputs, outputs, and errors.
Configuration: required settings and local override behavior.
Tests: level and command.
Validation: exact dotnet commands and results.
Guardrails
- Do not add a new service layer without naming the real duplication or testability issue it removes.
- Do not put significant business rules directly inside endpoint registration.
- Do not commit secrets or machine-local configuration.
- Do not make ASP.NET Core the default .NET app shape when a library or CLI would fit better.
- Do not ignore F# compile ordering or C# nullable/analyzer settings.
1---2name: aspnet-core-service-workflow3description: Plan, build, and validate ASP.NET Core service surfaces for F#, C#, or mixed .NET solutions using explicit project ownership, configuration, endpoints, tests, and dotnet CLI validation.4license: Apache-2.05---67# ASP.NET Core Service Workflow89## Purpose1011Build or modify an ASP.NET Core service with clear ownership, configuration, endpoints, tests, and validation.1213The practical decision is what the service exposes, which project owns the HTTP host, where domain logic lives, how configuration reaches the app, and how tests prove behavior without turning the whole service into a fragile integration fixture.1415## When To Use1617- Use this skill when adding or changing an ASP.NET Core API or service.18- Use this skill when deciding whether a .NET project should be a web service or a library consumed by one.19- Use this skill when adding endpoints, middleware, configuration, dependency injection, or service tests.20- Use this skill after `dotnet:choose-project-shape` has identified an ASP.NET Core service shape.2122## Source Check2324Use repo-local .NET files, checked-out dependency sources, Dash MCP or Dash HTTP for installed .NET docsets, and then official Microsoft documentation when Dash/local coverage is missing or stale:2526- [ASP.NET Core documentation](https://learn.microsoft.com/aspnet/core/)27- [Minimal APIs documentation](https://learn.microsoft.com/aspnet/core/fundamentals/minimal-apis)28- [ASP.NET Core configuration](https://learn.microsoft.com/aspnet/core/fundamentals/configuration/)29- [ASP.NET Core dependency injection](https://learn.microsoft.com/aspnet/core/fundamentals/dependency-injection)30- [ASP.NET Core integration tests](https://learn.microsoft.com/aspnet/core/test/integration-tests)3132## Planning Workflow33341. Inspect project shape:35 - web project36 - domain library37 - test project38 - config files39 - existing endpoints40 - existing hosting style412. Identify the service job:42 - HTTP API43 - local service44 - webhook receiver45 - background worker plus HTTP health surface46 - internal admin tool473. Choose language and boundary:48 - F# service49 - C# service50 - C# host with F# domain library51 - F# host with C# infrastructure library524. Keep domain logic outside endpoint handlers when it has real behavior.535. Keep configuration explicit and environment-safe.546. Add tests at the smallest useful level.557. Validate with `dotnet build` and `dotnet test`.5657## F# Service Notes5859For F# services:6061- keep endpoint functions small62- model request and response data clearly63- keep domain transformations in modules that can be tested without the HTTP host64- be explicit at task/async boundaries65- preserve `.fsproj` file ordering6667## C# Service Notes6869For C# services:7071- keep nullable request/response contracts clear72- avoid overbuilding service classes for one endpoint73- use dependency injection for real external dependencies, not as decoration74- keep middleware and endpoint registration readable75- respect analyzers and warnings-as-errors7677## Configuration And Secrets7879Do not commit secrets.8081For local development, follow repo conventions first. If none exist, recommend committed safe defaults and ignored local overrides rather than hard-coded secrets. Explain which settings are required for the app to start and which settings are optional.8283## Testing8485Choose the smallest test that proves the behavior:8687- pure domain test for business rules88- endpoint-level test for routing, validation, or response shape89- integration test for host/config/middleware behavior9091Do not run live external services as ordinary unit tests unless the repo already has an isolated test harness for that purpose.9293## Output Shape9495Return:96971. `Service shape`: host project, domain project, and test project.982. `Language boundary`: F#, C#, or mixed.993. `Endpoint behavior`: routes, inputs, outputs, and errors.1004. `Configuration`: required settings and local override behavior.1015. `Tests`: level and command.1026. `Validation`: exact `dotnet` commands and results.103104## Guardrails105106- Do not add a new service layer without naming the real duplication or testability issue it removes.107- Do not put significant business rules directly inside endpoint registration.108- Do not commit secrets or machine-local configuration.109- Do not make ASP.NET Core the default .NET app shape when a library or CLI would fit better.110- Do not ignore F# compile ordering or C# nullable/analyzer settings.