Claude Skill

api-design

Designs interfaces that survive their consumers — resource modeling, errors, versioning, pagination, and compatibility. Use this to design a new API, review one before it ships, decide how to version or deprecate, fix an interface consumers keep misusing, or work out whether a ch

LLM Mart · 0 points · 18 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download cbrock84-headcount-plugins_technology_skills_api-design-98d1c17.zip · 3 KB
Part of cbrock84/headcount — 160 skills

Install

skills CLI npx skills add https://github.com/cbrock84/headcount/tree/main/plugins/technology/skills/api-design
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install cbrock84-headcount@llmmart
Git git clone https://github.com/cbrock84/headcount.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole cbrock84/headcount collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

API design

An API is a promise you cannot withdraw once someone depends on it. Design accordingly: the cost of getting it wrong is paid continuously by everyone who integrates.

Model the domain, not the database

Expose concepts the consumer thinks in. An interface that mirrors internal table structure leaks implementation, breaks whenever storage changes, and forces consumers to reconstruct meaning you already had.

Name things as the domain names them. Consistency in naming, casing, date formats and identifier style matters more than any individual choice being optimal — an interface that is uniformly imperfect is learnable, and one that is inconsistently excellent is not.

Errors are part of the contract

Most integrations spend most of their code on failure. Give it the same care as the success path:

  • Distinguish machine-readable code from human-readable message. Consumers branch on the code; the message is for the developer reading logs.
  • Say what to do about it. Retryable or not, and after how long.
  • Never leak internals — stack traces and SQL in error bodies are a security finding as well as bad design.
  • Be consistent about which failures are which status. Validation, authorization, and conflict are different situations and should never share a shape.

Compatibility

Adding an optional field is safe. Removing a field, renaming one, tightening validation, changing a default, or adding a required parameter are all breaking, and the last three break consumers who are doing nothing wrong.

Version when you must break, and be explicit about how long the previous version lives. A deprecation without a date is a deprecation nobody acts on.

Prefer expansion over versioning where possible: a new optional field costs a consumer nothing, a new version costs them a migration.

Pagination, filtering and limits

Any collection that can grow needs pagination from the first release — retrofitting it is a breaking change to every consumer. Prefer cursors over offsets for anything that changes while being read; offset pagination silently skips and duplicates records under concurrent writes.

State rate limits in the contract and communicate them in responses. An undocumented limit is discovered in the consumer's production incident.

Sources

references/sources.md in this skill lists the outside authorities that settle the questions here — what each one is authoritative for, and what you may do with it. Check them before answering on anything they cover, and cite what you used. Most are free to read and not free to reproduce; the use note on each is binding.

Tooling

Specification and documentation: OpenAPI with Redocly, Stoplight, or Scalar; gRPC with protocol buffers where the consumers are internal services, and similar.

Design review and testing: Postman, Insomnia, Bruno, and similar. Contract testing — Pact and similar — is what catches a breaking change before a consumer does.

Generate the documentation from the specification and the specification from or alongside the code. Hand-maintained API documentation is wrong within a release, and being confidently wrong is worse for a consumer than being absent.

Never

  • Expose internal identifiers or storage structure through the interface.
  • Return errors whose meaning must be inferred from the message text.
  • Tighten validation on an existing endpoint and call it non-breaking.
  • Ship a collection endpoint without pagination.
Files (headcount)
  • references
    • sources.md 2.2 KB
      # Sources — `technology:api-design`
      
      <!-- Generated by scripts/build-sources.py from sources/*.toml. Do not edit. -->
      
      Check these before answering on anything they cover, and cite what you used. The use note on each one is binding: most of what a professional cites is free to read and not free to reproduce.
      
      ## OpenAPI Specification
      
      OpenAPI Initiative, Linux Foundation · global · free to use with attribution — credit the publisher
      
      <https://spec.openapis.org/oas/latest.html>
      
      **Authoritative for:** What a valid API description document contains. Settles whether a given file is conformant rather than merely accepted by one tool.
      
      ## RFC 9110: HTTP Semantics
      
      IETF · global · **read and cite only — copyrighted, do not reproduce**
      
      <https://www.rfc-editor.org/rfc/rfc9110.html>
      
      **Authoritative for:** What an HTTP method, status code or header actually means. Settles whether PUT is idempotent, whether 409 or 422 is correct, and what a conditional request obliges a server to do.
      
      ## RFC 9457: Problem Details for HTTP APIs
      
      IETF · global · **read and cite only — copyrighted, do not reproduce**
      
      <https://www.rfc-editor.org/rfc/rfc9457.html>
      
      **Authoritative for:** The wire format of an API error body. It obsoletes RFC 7807, so it also settles which of the two a new service should follow.
      
      ## RFC 9700: Best Current Practice for OAuth 2.0 Security
      
      IETF · global · **read and cite only — copyrighted, do not reproduce**
      
      <https://www.rfc-editor.org/rfc/rfc9700.html>
      
      **Authoritative for:** Which OAuth 2.0 patterns remain permitted — that the implicit grant and password grant must not be used, that PKCE is required, and that redirect URIs must match exactly.
      
      ## Semantic Versioning 2.0.0
      
      Semantic Versioning project · global · CC BY — quote with attribution
      
      <https://semver.org/>
      
      **Authoritative for:** What a version increment is allowed to mean, and therefore whether a given change requires a major bump. A community specification rather than a standards body, but the one every dependency resolver assumes.
      
      ---
      
      Sources are maintained in `sources/` upstream, not here. If one is wrong, out of date, or missing, fix it there — this file is regenerated and an edit to it is lost.
      
  • SKILL.md 3.7 KB
    ---
    name: api-design
    description: Designs interfaces that survive their consumers — resource modeling, errors, versioning, pagination, and compatibility. Use this to design a new API, review one before it ships, decide how to version or deprecate, fix an interface consumers keep misusing, or work out whether a change is breaking.
    ---
    
    # API design
    
    An API is a promise you cannot withdraw once someone depends on it. Design accordingly: the cost of
    getting it wrong is paid continuously by everyone who integrates.
    
    ## Model the domain, not the database
    
    Expose concepts the consumer thinks in. An interface that mirrors internal table structure leaks
    implementation, breaks whenever storage changes, and forces consumers to reconstruct meaning you
    already had.
    
    Name things as the domain names them. Consistency in naming, casing, date formats and identifier
    style matters more than any individual choice being optimal — an interface that is uniformly
    imperfect is learnable, and one that is inconsistently excellent is not.
    
    ## Errors are part of the contract
    
    Most integrations spend most of their code on failure. Give it the same care as the success path:
    
    - **Distinguish machine-readable code from human-readable message.** Consumers branch on the code;
      the message is for the developer reading logs.
    - **Say what to do about it.** Retryable or not, and after how long.
    - **Never leak internals** — stack traces and SQL in error bodies are a security finding as well as
      bad design.
    - **Be consistent about which failures are which status.** Validation, authorization, and conflict
      are different situations and should never share a shape.
    
    ## Compatibility
    
    Adding an optional field is safe. Removing a field, renaming one, tightening validation, changing a
    default, or adding a required parameter are all breaking, and the last three break consumers who are
    doing nothing wrong.
    
    Version when you must break, and be explicit about how long the previous version lives. A
    deprecation without a date is a deprecation nobody acts on.
    
    Prefer expansion over versioning where possible: a new optional field costs a consumer nothing, a new
    version costs them a migration.
    
    ## Pagination, filtering and limits
    
    Any collection that can grow needs pagination from the first release — retrofitting it is a breaking
    change to every consumer. Prefer cursors over offsets for anything that changes while being read;
    offset pagination silently skips and duplicates records under concurrent writes.
    
    State rate limits in the contract and communicate them in responses. An undocumented limit is
    discovered in the consumer's production incident.
    
    ## Sources
    
    `references/sources.md` in this skill lists the outside authorities that settle the questions
    here — what each one is authoritative for, and what you may do with it. Check them before
    answering on anything they cover, and cite what you used. Most are free to read and not free
    to reproduce; the use note on each is binding.
    
    ## Tooling
    
    Specification and documentation: OpenAPI with Redocly, Stoplight, or Scalar; gRPC with protocol
    buffers where the consumers are internal services, and similar.
    
    Design review and testing: Postman, Insomnia, Bruno, and similar. Contract testing — Pact and
    similar — is what catches a breaking change before a consumer does.
    
    Generate the documentation from the specification and the specification from or alongside the code.
    Hand-maintained API documentation is wrong within a release, and being confidently wrong is worse
    for a consumer than being absent.
    
    ## Never
    
    - Expose internal identifiers or storage structure through the interface.
    - Return errors whose meaning must be inferred from the message text.
    - Tighten validation on an existing endpoint and call it non-breaking.
    - Ship a collection endpoint without pagination.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related