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

38 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use constraint-driven-development, doubt-driven-development 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.
  • vinvcnSkill

    constraint-driven-development

    把一个项目的质量线确立为书面契约,并阻止 agent 悄悄降低它。通过访谈确定用户在意哪些维度,当用户心里没有数字时提供合理的默认阈值,把一切记录进 CONSTRAINTS.md,并盯住 diff 中质量线被削弱的迹象——新增的 @ts-ignore 或 eslint-disable 抑制注释、被跳过或删除的测试、被剥掉的断言、未实现的 stub、被调低的阈值。当没有任何质量线被写下来时使用;当用户说 "set up constraints" 或 "define our standards" 时;当用户希望把他们在意的维度——无障碍性、Web 性能、覆盖率——设置成被强制执行的约束时;当 agent 为了变绿不断静默检查或跳过测试时;当你需要一个覆盖率或性能阈值却不知道该选什么数字时;或者当 agent 写下的代码超出任何人会读的体量时。

    Also in 4 projects that use this

  • mycelium-hqSkill

    doubt-driven-development

    Use when correctness matters more than speed: about to commit non-trivial code, make an architectural call under uncertainty, work in unfamiliar code, or assert what the compiler cannot check (''this is safe'', ''thread-safe'', ''this scales'', ''matches the spec''). Strongest on high-stakes surfaces (production deploys, security-sensitive logic, data migrations, irreversible operations) and when the user asks to sanity-check, red-team, double-check, or get a second opinion on a decision.

    Also in 21 projects that use this

  • skytiger6724Skill

    brainstorm-experiments-new

    Design lean startup experiments (pretotypes) for a new product. Creates XYZ hypotheses and suggests low-effort validation methods like landing pages, explainer videos, and pre-orders. Use when validating a new product idea, creating pretotypes, or testing market demand.

    Also in 4 projects that use this

  • skytiger6724Skill

    ideal-customer-profile

    Identify the Ideal Customer Profile (ICP) from research data with demographics, behaviors, JTBD, and needs. Use when defining your ICP, analyzing PMF survey data, or understanding who your best customers are.

    Also in 4 projects that use this

  • borhen68Skill

    observability-and-instrumentation

    Instruments code so production behavior is visible and diagnosable. Use when adding logging, metrics, tracing, or alerting. Use when shipping any feature that runs in production and you need evidence it works. Use when production issues are reported but you can't tell what happened from the available data.

    Also in 12 projects that use this

  • +4 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 37 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 37 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.