agentleFS
mag1artmag1art/skills/aspnet-core-api/SKILL.md

aspnet-core-api

Skill1 starsChanged 3 months agoApache-2.0View on GitHub

Use for designing, implementing, or reviewing production ASP.NET Core HTTP APIs.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 14 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use for HTTP API contracts, controllers, Minimal APIs, middleware, authentication, authorization, validation, error handling, and OpenAPI.

    line 25
  2. Distinctive:

    Do not use for frontend-only work, generic C# code, or persistence-only changes without an API boundary.

    line 29
  3. Distinctive:

    Keep business behavior in application services or use cases, not controllers.

    line 36
  4. Distinctive:

    Add validation, authorization, cancellation, logging, and OpenAPI metadata.

    line 37
  5. Distinctive:

    Add endpoint tests for success, validation, auth, not-found, conflict, and failure paths.

    line 38
  6. Distinctive:

    Run formatting, build, tests, and API contract checks.

    line 39
  7. Distinctive:

    Use DTOs at the HTTP boundary.

    line 44
  8. Distinctive:

    Use route constraints and stable operation IDs.

    line 45
  9. Distinctive:

    Use CreatedAtAction or a Location header for successful resource creation.

    line 48
  10. Distinctive:

    Avoid unbounded collections and internal exception messages.

    line 50
  11. Distinctive:

    Keep middleware order explicit: exception handling, security, authentication, authorization, endpoint mapping.

    line 52
  12. Distinctive:

    Check authentication scheme, authorization policy, object-level access, CORS, request-size limits, rate limiting, secret handling, and …

    line 57
  13. Distinctive:

    Verify build/tests, actual OpenAPI schemas, cancellation, authorization, bounded reads, and safe structured logging.

    line 61
  14. Distinctive:

    Keep the handler focused on HTTP concerns.

    line 87

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ASP.NET Core API

When to Use

Use for HTTP API contracts, controllers, Minimal APIs, middleware, authentication, authorization, validation, error handling, and OpenAPI.

When Not to Use

Do not use for frontend-only work, generic C# code, or persistence-only changes without an API boundary.

Workflow

  1. Inspect the target framework, API style, routing, serialization, auth, and error contract.
  2. Preserve established conventions unless the user requests a migration.
  3. Define DTOs and explicit status codes before changing handlers.
  4. Keep business behavior in application services or use cases, not controllers.
  5. Add validation, authorization, cancellation, logging, and OpenAPI metadata.
  6. Add endpoint tests for success, validation, auth, not-found, conflict, and failure paths.
  7. Run formatting, build, tests, and API contract checks.

API Rules

  • Pass CancellationToken from endpoint to every I/O operation.
  • Use DTOs at the HTTP boundary; never expose EF entities directly.
  • Use route constraints and stable operation IDs.
  • Return ProblemDetails or ValidationProblemDetails consistently.
  • Map domain/application errors centrally to HTTP status codes.
  • Use CreatedAtAction or a Location header for successful resource creation.
  • Paginate collection endpoints and cap page size.
  • Avoid unbounded collections and internal exception messages.
  • Apply authorization per operation and resource.
  • Keep middleware order explicit: exception handling, security, authentication, authorization, endpoint mapping.
  • Configure JSON enum, date, null, and naming policies intentionally.

Security Gate

Check authentication scheme, authorization policy, object-level access, CORS, request-size limits, rate limiting, secret handling, and sensitive logging.

Quality Gate

Verify build/tests, actual OpenAPI schemas, cancellation, authorization, bounded reads, and safe structured logging.

Example: Explicit HTTP Contract

builder.Services.AddProblemDetails();
builder.Services.AddAuthentication().AddJwtBearer();
builder.Services.AddAuthorization();

app.UseExceptionHandler();
app.UseAuthentication();
app.UseAuthorization();

app.MapGet("/api/orders/{id:guid}", async (
    Guid id,
    IOrderService orders,
    CancellationToken ct) =>
{
    var order = await orders.GetAsync(id, ct);
    return order is null ? Results.NotFound() : Results.Ok(order);
})
.RequireAuthorization("orders:read")
.WithName("GetOrder")
.Produces<OrderResponse>()
.ProducesProblem(StatusCodes.Status404NotFound);

Keep the handler focused on HTTP concerns. Put business rules, persistence, and external calls in IOrderService. Return ProblemDetails consistently for validation and unexpected errors.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.