agentsclimarketplace

Api design

Skill gagandeepp/software-agent-teams/.claude/skills/api-design

Use when designing or adding ASP.NET Core Web API endpoints in the LMS backend — Clean Architecture with CQRS, MediatR, FluentValidation, and IdentityServer4 JWT auth. Triggers on new controller actions, request/handler/DTO creation, or URL naming decisions.From its SKILL.md

Install
npx -y skills add gagandeepp/software-agent-teams --skill api-design

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

4.5 KB, as published. Nobody here has run it

Skill: API Design Conventions

Overview

Ensure consistent, well-structured ASP.NET Core Web API endpoints aligned with Clean Architecture and CQRS patterns. Controllers are thin — all logic lives in MediatR handlers.

Stack: .NET 9 · MediatR · FluentValidation · Mapster · Swashbuckle · IdentityServer4


Controller Design

Controllers delegate everything to MediatR. No business logic.

[ApiController]
[Route("api/v1/[controller]")]
public class CoursesController : ControllerBase
{
    private readonly IMediator _mediator;
    public CoursesController(IMediator mediator) => _mediator = mediator;

    [HttpPost]
    [ProducesResponseType(typeof(CourseDto), StatusCodes.Status201Created)]
    [ProducesResponseType(StatusCodes.Status400BadRequest)]
    public async Task<IActionResult> Create([FromBody] CreateCourseRequest request)
    {
        var result = await _mediator.Send(request);
        return CreatedAtAction(nameof(GetById), new { id = result.Id }, result);
    }
}

Naming Conventions

ArtifactConventionExample
Command request{Verb}{Entity}RequestCreateCourseRequest
Query requestGet{Entity}RequestGetCourseByIdRequest
Handler{Verb}{Entity}RequestHandlerCreateCourseRequestHandler
Validator{RequestName}ValidatorCreateCourseRequestValidator
DTO{Entity}DtoCourseDto
StoreI{Entity}Store / {Entity}StoreICourseStore

URL Design

  • Plural nouns: /api/v1/courses, /api/v1/tracks
  • Kebab-case: /api/v1/learning-tracks, /api/v1/audit-logs
  • Always prefix /api/v1/
  • Max 2 levels of nesting: /api/v1/tracks/{trackId}/topics/{topicId} ✅
  • Never use GET for side-effecting operations

HTTP Methods

MethodUseIdempotent?
GETReadYes
POSTCreateNo
PUTFull replaceYes
PATCHPartial updateNo
DELETERemoveYes

Validation

All validation via FluentValidation — never in controllers or handlers.

public class CreateCourseRequestValidator : AbstractValidator<CreateCourseRequest>
{
    public CreateCourseRequestValidator()
    {
        RuleFor(x => x.Title).NotEmpty().MaximumLength(200);
        RuleFor(x => x.Type).IsInEnum();
    }
}

Validators are auto-discovered by RequestValidationBehavior. Failures return 400 before handler runs.


Response Codes

Success:

CodeWhen
200GET, PUT, PATCH
201POST — use CreatedAtAction
204DELETE

Errors:

CodeWhen
400Validation failure
401Not authenticated
403Not authorized
404Not found
409Conflict / duplicate
422Semantic validation failure
500Unhandled (global middleware)

Never return 200 with an error body.


Pagination

public class GetCoursesRequest : IRequest<PaginatedResult<CourseDto>>
{
    public int Page { get; set; } = 1;
    public int PageSize { get; set; } = 20;  // max 100
    public string? SearchTerm { get; set; }
}

Adding a New Endpoint (Checklist)

  • Domain entity in LMS.Domain/Entities/
  • DTO in LMS.Application/DTOs/
  • Request in LMS.Application/{Mutables|Immutables}/
  • Handler in LMS.Application/Handler/{Mutables|Immutables}/
  • FluentValidation validator in LMS.Application/Rules/
  • Thin controller action in LMS.API/Controllers/
  • [ProducesResponseType] for all response codes
  • Register services in ServiceCollectionExtensions if needed
  • Unit tests in UnitTests/ (mock deps, AAA)
  • Integration tests in IntegrationTests/ (Testcontainers + WebApplicationFactory)

Quality Gates

  • Resources use plural nouns and kebab-case
  • Correct HTTP method per operation
  • All validation via FluentValidation (not in controllers/handlers)
  • Controllers are thin — no business logic
  • Pagination on all collection endpoints
  • [ProducesResponseType] on all actions
  • No sensitive data in URL query params
  • No breaking changes — add a new version instead
  • Async/await on all I/O
  • Serilog logging on errors

Keep looking

Skills are one crate of 607,721. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.