agentleFS
jacksonwilliamsvajacksonwilliamsva/kiro-skills-library/skills/api-and-interface-design/SKILL.md

api-and-interface-design

Skill2 starsChanged 7 months agoMITView on GitHub

Use when designing or modifying any public interface — REST APIs, GraphQL schemas, module boundaries, Terraform provider schemas, CLI commands, or component contracts

92 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use observability-and-instrumentation, accessibility-engineering and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • jaydubya818Skill

    observability-and-instrumentation

    Add or review logs, metrics, traces, and actionable alerts.

    Also in 50 projects that use this

  • steven123397Skill

    accessibility-engineering

    Audits existing interfaces for WCAG 2.2 AA conformance and remediates the violations found. Use when auditing a page or component for accessibility, running axe-core or pa11y, triaging a11y violations, or checking screen reader and contrast issues before shipping.

    Also in 4 projects that use this

  • MrCipherSmithSkill

    constraint-driven-development

    Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.

    Also in 22 projects that use this

  • seikaikyoSkill

    doubt-driven-development

    對非平凡決策啟動新鮮 context 對抗審查(找碴不背書),在修正還便宜的時候抓出錯誤方向。適用:高風險改動(production、資安敏感邏輯、不可逆操作)、不熟的程式碼、要宣稱「這樣是安全的 / 可行的」之前。機械性操作與一行修改不適用。

    Also in 59 projects that use this

  • skytiger6724Skill

    brainstorm-experiments-existing

    Design experiments to test assumptions for an existing product — prototypes, A/B tests, spikes, and other low-effort validation methods. Use when validating assumptions, testing feature ideas cheaply, or planning product experiments.

    Also in 4 projects that use this

  • skytiger6724Skill

    prioritize-assumptions

    Prioritize assumptions using an Impact × Risk matrix and suggest experiments for each. Use when triaging a list of assumptions, deciding what to test first, or applying the assumption prioritization canvas.

    Also in 4 projects that use this

  • +1 more from skytiger6724

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 87 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Don't leak implementation details.

    line 16
  2. Distinctive:

    Don't force consumers to choose between versions.

    line 36

“Common” is measured: kept by at least 6 in 10 of the 87 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 and Interface Design

Design stable interfaces that are hard to misuse. Applies to REST, GraphQL, module exports, Terraform providers, and CLIs.

Core Principles

Hyrum's Law

With sufficient users, all observable behaviors become depended on — regardless of your contract.

Don't leak implementation details. Plan deprecation at design time (see deprecation-and-migration).

Contract First

Define the interface before implementing. Types, schemas, HCL attributes, CLI flags — the contract is the spec. Implementation follows.

Consistent Error Semantics

Pick one error strategy. Use it everywhere across the same surface.

SurfaceStrategy
RESTHTTP status codes + { error: { code, message } }
GraphQLerrors[] with extensions
ModuleTyped error/result types or consistent exceptions
Terraformdiag.Diagnostics with summary + detail
CLIstderr for errors, stdout for data, exit codes

One-Version Rule

Don't force consumers to choose between versions. Diamond dependencies arise when different consumers need different versions. Extend rather than fork.

Design Rules

  1. Validate at boundaries — API handlers, CLI arg parsing, provider schema, third-party responses. Trust internal code.
  2. Prefer addition over modification — new optional fields/subcommands/attributes. Never change types or remove fields.
  3. Predictable naming — plural nouns for REST resources, no verbs in URLs, consistent casing, is/has/can for booleans.
  4. Paginate from day one — every list endpoint/query.
  5. Separate input from output — what callers provide vs what the system returns.

Anti-Rationalization Table

RationalizationReality
"We'll document it later"Types/schemas ARE the documentation. Define first.
"Don't need pagination yet"You will at 100+ items. Add from the start.
"Nobody uses that behavior"Hyrum's Law: if observable, someone depends on it.
"We can maintain two versions"Multiple versions multiply cost. One-Version Rule.
"Internal APIs don't need contracts"Internal consumers are still consumers.
"We'll version when we need to"Breaking changes without versioning break consumers.

Red Flags — STOP and Redesign

  • Different response shapes depending on conditions
  • Inconsistent error formats across the same surface
  • Validation scattered in internal code instead of boundaries
  • Breaking changes to existing fields
  • List operations without pagination
  • Verbs in REST URLs (/api/createTask)
  • Third-party responses used without validation
  • CLI mixing data and status messages on stdout

Verification

  • Every operation has typed/documented input and output
  • Errors follow a single consistent format
  • Validation at boundaries only
  • Lists paginated
  • Changes are additive and backward-compatible
  • Naming consistent across all operations
  • Deprecation path exists for removals (see deprecation-and-migration)

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.