agentleFS
CodeCaroSCodeCaroS/MythOs_Aegis/.agents/skills/rest-api-best-practices/SKILL.md

rest-api-best-practices

Skill0 starsChanged 3 months agoApache-2.0View on GitHub

Design, implement, document, or review framework-neutral REST/HTTP APIs using current HTTP semantics, predictable resource contracts, secure trust boundaries, compatibility rules, and focused verification. Use for endpoint design, API reviews, OpenAPI contracts, HTTP methods and status codes, resource URLs, errors, pagination, filtering, idempotency, caching, concurrency, versioning, deprecation, authorization, rate limits, or API test plans.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Verify the published contract and runtime behavior agree.

    line 29
  2. Very specific:

    Follow HTTP method safety and idempotency semantics.

    line 33
  3. Very specific:

    Use HTTP status codes and headers as protocol semantics, not decorative metadata inside a 200 body.

    line 34
  4. Distinctive:

    Use RFC 9457 Problem Details for a new error format unless an established compatible format must be preserved.

    line 36
  5. Very specific:

    Keep success representations consistent by resource and media type.

    line 37
  6. Distinctive:

    Prefer additive evolution.

    line 40
  7. Distinctive:

    Never expose secrets, stack traces, internal queries, or sensitive identifiers in responses or logs.

    line 41
  8. Distinctive:

    Keep the contract, semantic defect, compatibility impact, fix, and verification together.

    line 51

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

REST API Best Practices

Build the smallest predictable HTTP contract that fits the product. Preserve sound repository conventions; correct conventions that conflict with HTTP semantics, security, or compatibility.

Workflow

  1. Inspect the existing routes, handlers, schemas, OpenAPI files, shared response/error helpers, authorization boundaries, and contract tests. Trace callers before changing shared behavior.
  2. State the resource, consumer, operation, trust boundary, compatibility promise, and expected scale. If the interface is mainly commands or workflows, say when HTTP RPC is clearer than forced resource-shaped REST.
  3. Define the contract before implementation: method, path, request, success response, error response, headers, authorization rule, retry behavior, and compatibility impact.
  4. Apply the standards-backed checklist. Load only the relevant sections for a narrow task; read it fully for a new API or whole-API review.
  5. Reuse existing validation, authorization, serialization, pagination, and error infrastructure. Add no framework or dependency unless the current stack cannot express the contract safely.
  6. Implement shared boundary behavior once, then leave the smallest runnable check that would fail on regression.
  7. Verify the published contract and runtime behavior agree. Report any deliberate deviation with its consumer-visible consequence.

Non-negotiables

  • Follow HTTP method safety and idempotency semantics; do not use POST for every operation.
  • Use HTTP status codes and headers as protocol semantics, not decorative metadata inside a 200 body.
  • Validate syntax and shape at the boundary; enforce business invariants in the domain; authorize every object, function, and exposed property.
  • Use RFC 9457 Problem Details for a new error format unless an established compatible format must be preserved.
  • Keep success representations consistent by resource and media type. Do not impose a universal {success,message,data} wrapper without a demonstrated client need.
  • Bound collection size and resource consumption. Define stable ordering and pagination behavior.
  • Prevent lost updates where concurrent writes matter with validators such as ETag and If-Match.
  • Prefer additive evolution. Introduce a new API version only for a breaking contract change that cannot be migrated compatibly.
  • Never expose secrets, stack traces, internal queries, or sensitive identifiers in responses or logs.
  • Describe the contract with the repository's existing OpenAPI tooling when present. Do not hand-maintain a second source of truth.

Review Output

Lead with confirmed contract defects, ordered by user or security impact. For each defect, give the endpoint, violated semantic or invariant, consequence, and smallest compatible fix. Separate optional style preferences from correctness issues. End with checks run and unresolved compatibility decisions.

Shared output profile

Compose the review profile from output-templates. Keep the contract, semantic defect, compatibility impact, fix, and verification together. Preserve stricter domain rules above, omit empty components, and never fill a component with invented evidence.

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.