Agent skill
api-setup
Configure affolterNET.Web.Api service registration and middleware pipeline. Use when setting up AddApiServices, ConfigureApiApp, or configuring the API middleware order.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/api-setup
SKILL.md
API Setup
Configure the affolterNET.Web.Api service registration and middleware pipeline.
For complete reference, see Library Guide.
Quick Start
// Program.cs
var builder = WebApplication.CreateBuilder(args);
// Step 1: Register services
var options = builder.Services.AddApiServices(
builder.Environment.IsDevelopment(),
builder.Configuration,
opts => {
opts.EnableSecurityHeaders = true;
opts.ConfigureApi = api => {
api.AuthMode = AuthenticationMode.Authorize;
};
});
var app = builder.Build();
// Step 2: Configure middleware
app.ConfigureApiApp(options);
app.Run();
Configuration Options
ApiAppOptions
| Property | Type | Description |
|---|---|---|
EnableSecurityHeaders |
bool | Enable security headers middleware |
ConfigureApi |
Action<ApiOptions> | Configure API-specific options |
ConfigureAfterRoutingCustomMiddleware |
Action<IApplicationBuilder> | Add custom middleware after routing |
ConfigureBeforeEndpointsCustomMiddleware |
Action<IApplicationBuilder> | Add custom middleware before endpoints |
ApiOptions
| Property | Type | Default | Description |
|---|---|---|---|
AuthMode |
AuthenticationMode | None |
Authentication mode (None/Authenticate/Authorize) |
Middleware Pipeline
The ConfigureApiApp configures middleware in this order:
- Security Headers Middleware
- Swagger/OpenAPI
- Routing
- Custom Middleware (after routing hook)
- CORS
- Authentication & Authorization + RPT Middleware
- Custom Middleware (before endpoints hook)
- Endpoint Mapping (with Health Checks)
Common Patterns
Development vs Production
var options = builder.Services.AddApiServices(
builder.Environment.IsDevelopment(), // isDev flag
builder.Configuration,
opts => {
// Development-specific config happens automatically
// based on isDev flag
});
Adding Custom Middleware
var options = builder.Services.AddApiServices(isDev, config, opts => {
opts.ConfigureAfterRoutingCustomMiddleware = app => {
app.UseMiddleware<RequestLoggingMiddleware>();
};
opts.ConfigureBeforeEndpointsCustomMiddleware = app => {
app.UseMiddleware<TenantMiddleware>();
};
});
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?