agentleFS
LeanMeanCleanAppsLeanMeanCleanApps/CleanLambdaFunction/.agents/skills/api-conventions/SKILL.md

api-conventions

Skill0 starsChanged 10 days agoMITView on GitHub

The conventions for this Lambda function's contract - function names, one request record in and one response record out, offset paging with NextOffset, errors as Lambda function errors, the HTTP API routes and their problem details, and what is left to API Gateway or IAM. Use when naming a function, shaping its request or response, or deciding how a failure reaches the caller.

15 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 4

    Distinctive

    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:

    Put every optional input on the request with a default, and document the default.

    line 30
  2. Distinctive:

    Add a test for each success and for each exception the use case can throw.

    line 32
  3. Distinctive:

    Put a write behind the HTTP API without deciding how it's protected.

    line 36
  4. Distinctive:

    Add authentication checks to the function.

    line 40

“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “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

API conventions (Lambda function)

The rule

TopicConvention
NamesA verb and a plural noun for lists (GetMovies), a verb and a singular noun for one item (GetMovieById)
InputOne request record, deserialised from the invocation payload. Optional values have defaults, so {} is a valid request
OutputOne response record. Lists return Page<T>(Items, TotalCount, NextOffset), written as items, totalCount and nextOffset
Pagingoffset and limit on the request (paging). nextOffset is the offset of the next page, or left out on the last page
SearchA query property on the list request, not a separate function
ErrorsApplication exceptions are not caught. Lambda returns them as a function error whose errorType is the exception name (ValidationException, NotFoundException) and whose errorMessage is its message
HTTPLists that callers also want over HTTP get an Http-prefixed twin on an API Gateway HTTP API, the lower-cost API Gateway choice AWS recommends when REST API-only features aren't needed. GET /movies, /authors and /reviews, inputs from the query string, 200 with the same Page<T> JSON, 400 with application/problem+json (title, status, errors by property). Other failures fail the invocation and API Gateway answers 500
AuthNone in the function. API Gateway or the caller's IAM permissions decide who can invoke it (optional-token-auth)
JSONProperty names read in any case, written in camelCase, nulls left out (json-serialization)
Nested itemsA review holds its movie and its author, each without counts or averages. Callers get those from GetMovies and GetAuthors

Callers, such as Step Functions or another service, match on errorType to tell bad input from a missing item and from a fault.

Steps

  1. Name the function from the table and give it its own request record unless an existing one fits exactly (ListRequest serves movies and authors).
  2. Put every optional input on the request with a default, and document the default.
  3. Return a record designed for the caller, not the Application entity.
  4. Add a test for each success and for each exception the use case can throw.

Don't

  • Put a write behind the HTTP API without deciding how it's protected. The routes are open until a JWT or IAM authorizer is added.
  • Return an error inside a successful response, or null for not found. Let the exception reach Lambda.
  • Wrap exceptions in a generic one. The exception name is part of the contract.
  • Return an unbounded list.
  • Add authentication checks to the function.

Check

dotnet test tests/Presentation.Tests.Integration

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.