From backend-csharp
Use when implementing ASP.NET Core features — enforces Clean Architecture with CQRS, MediatR command/query handlers, FluentValidation, minimal APIs vs controllers, middleware pipeline, and IdentityServer4 JWT auth patterns
How this skill is triggered — by the user, by Claude, or both
Slash command
/backend-csharp:csharp-frameworksThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
```
Presentation (API) → Application → Domain → Infrastructure
Controllers/ Commands/ Entities EF Core DbContext
Minimal APIs Queries Value Objs Repositories
DTOs Handlers Domain Svc External APIs
Filters Validators Interfaces Message Bus
// Command (writes)
public record CreateOrderCommand(string CustomerId, List<OrderItem> Items) : IRequest<Result<OrderId>>;
public class CreateOrderCommandHandler : IRequestHandler<CreateOrderCommand, Result<OrderId>>
{
public async Task<Result<OrderId>> Handle(CreateOrderCommand request, CancellationToken ct)
{
// Validate → Create entity → Persist → Return
}
}
// Query (reads)
public record GetOrderQuery(int OrderId) : IRequest<OrderDto?>;
Result<T>, queries return DTOs or nullservices.AddMediatR(cfg => cfg.RegisterServicesFromAssemblyContaining<Program>());public class CreateOrderCommandValidator : AbstractValidator<CreateOrderCommand>
{
public CreateOrderCommandValidator()
{
RuleFor(x => x.CustomerId).NotEmpty().MaximumLength(50);
RuleFor(x => x.Items).NotEmpty().WithMessage("Order must have at least one item");
RuleForEach(x => x.Items).ChildRules(item =>
{
item.RuleFor(i => i.Quantity).GreaterThan(0);
});
}
}
[ApiController]
[Route("api/v{version:apiVersion}/[controller]")]
[Produces("application/json")]
public class OrdersController : ControllerBase
{
private readonly IMediator _mediator;
[HttpPost]
[ProducesResponseType(typeof(OrderId), StatusCodes.Status201Created)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
public async Task<IActionResult> Create([FromBody] CreateOrderCommand command, CancellationToken ct)
{
var result = await _mediator.Send(command, ct);
return result.Match(
success => CreatedAtAction(nameof(GetById), new { id = success.Value }, success),
failure => BadRequest(failure.ToProblemDetails())
);
}
}
[ApiController] attribute on all controllersCancellationToken on all async actionsProblemDetails for errors (RFC 7807)api/v1/ordersapp.UseExceptionHandler("/error");
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
AddAuthentication().AddJwtBearer() with proper token validation[Authorize] attribute, never manual token parsingnpx claudepluginhub gagandeepp/software-agent-teams --plugin backend-csharpGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Enforces test-driven development: write failing test first, then minimal code to pass. Use when implementing features or bugfixes.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.