api-and-interface-design
Skill2 starsChanged 3 days agoMITView on GitHub
API and interface design discipline (Hyrum's law, contract-first, validate at boundaries, prefer addition over modification). Use when designing a new API, module boundary, type contract between modules, REST/SSE endpoint, or schema pipeline boundary.
We split this skill into the rules it gives an agent
8 rules. 0 are common, 4 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 64 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Read and follow framework/work-principle.md before taking up work.
- Very specific: line 93
Before designing a new interface or changing an existing public one, and before writing its contract: read and follow …
- Very specific: line 100
When defining REST endpoints, an SSE event stream or Pydantic models, and before changing a model that feeds the schema pipeline: read and …
- Distinctive: line 140
Required: use case described (which resource, which operations).
- Distinctive: line 161
No implementation logic — contract-first.
- Very specific: line 163
No database schema — agents/code-data.md persona / spec authoring.
- Distinctive: line 165
No frontend code — the schema pipeline produces Zod.
- Distinctive: line 175
Every endpoint has typed input + output schemas.
“Common” is measured: kept by at least 6 in 10 of the 64 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.
Files
Read and follow framework/work-principle.md before taking up work.
Resolve this reference against the framework root; retain the consumer CWD.
Skill: api-and-interface-design
Purpose
Design stable, well-documented interfaces that are hard-to-misuse. Good interfaces make the right thing easy and the wrong thing hard. Applies to REST APIs, SSE streams, module boundaries, Pydantic models, component props, and any surface where one piece of code talks to another.
Complementary to agents/code-api-contract.md (persona
reviewer for existing APIs) — this skill is the authoring
discipline for new interfaces; the persona is the review
counterpart.
Absorbs the existing schema-pipeline reality (Pydantic → OpenAPI → Zod) as a concrete pattern.
Source
agent-skills at 19e49a0 (MIT License, © 2025 Addy Osmani); Forge's register of adopted methods.
Standalone
Distinct from:
agents/code-api-contract.md(persona) — review role for existing APIs in code_review_board L2. This skill is the authoring stage.skills/spec_authoring/SKILL.md— general spec writing. This skill specializes in interface design within the spec.skills/code_review_board/SKILL.md— the whole code review board. This skill feeds the board with consistently designed APIs.
What only this skill delivers:
- Hyrum's law as an explicit authoring requirement (hidden behaviour as a de-facto contract).
- One-version rule (diamond-dependency avoidance).
- 5 authoring requirements (contract-first / consistent errors / validate-at-boundaries / prefer-addition / predictable-naming).
- REST + SSE patterns specifically.
- Discriminated unions / input-output separation / branded types for Pydantic.
When to call
- Designing new API endpoints (REST or SSE).
- Defining module boundaries or contracts between teams.
- Creating Pydantic model schemas.
- Designing a database schema that informs the API shape.
- Changing existing public interfaces (Hyrum's-law obligation).
Do not call for
- Internal function signatures that are not a public API →
code-quality(naming axis). - DB schema without API implication →
agents/code-data.mdpersona. - Pre-existing endpoint bug fix →
fixworkflow + L1 review. - General spec writing →
spec_authoring.
Process
Before designing a new interface or changing an existing public one, and before writing its contract: read and
follow skills/api_and_interface_design/authoring.md (phases 1–7: Hyrum's law, the one-version rule, contract-first,
consistent error semantics with the status-code mapping, validate-at-boundaries, prefer addition over modification,
predictable naming).
REST, SSE and Pydantic patterns
When defining REST endpoints, an SSE event stream or Pydantic models, and before changing a model that feeds the
schema pipeline: read and follow skills/api_and_interface_design/patterns.md (REST API patterns: resource design,
pagination, filtering, PATCH; SSE patterns and obligations; Pydantic patterns: discriminated unions, input / output
separation, branded IDs, schema pipeline Pydantic → OpenAPI → Zod).
Red flags
- Endpoints that return different shapes depending on conditions.
- Inconsistent error formats across endpoints (some
raise HTTPException, some AppError, some return None). - Validation scattered in the internal code instead of at boundaries.
- Breaking changes to existing fields (type changes, removals).
- List endpoints without pagination.
- Verbs in REST URLs (
/api/createTask,/api/getUsers). - Third-party API responses without validation.
extra="ignore"(default) instead ofextra="forbid"on public request models.- SSE events without an explicit event schema.
- StreamingResponse errors thrown as HTTPException (too late).
Common rationalizations
| Rationalization | Reality |
| "We document the API later" | The Pydantic models ARE the documentation. Define them first. |
| "We don't need pagination yet" | As soon as someone has 100+ items you'll need it. Add it from the start. |
| "PATCH is complicated, let's use PUT" | PUT requires the full object every time. PATCH is what clients actually want. |
| "We version the API when needed" | Breaking changes without versioning break consumers. Design for extension from the start. |
| "Nobody uses the undocumented behaviour" | Hyrum's law: if it's observable, somebody depends on it. Treat every public behaviour as a commitment. |
| "We can just maintain two versions" | Multi-version maintenance multiplies cost and creates diamond dependencies. Cross-ref the one-version rule (authoring.md phase 2). |
| "Internal APIs don't need contracts" | Internal consumers are also consumers. Contracts prevent coupling and enable parallel work. |
| "extra=ignore is the default; that's fine" | Silent pass-through. Unknown fields are NOT recognized → drift. extra=forbid on public request models. |
Contract
INPUT
- Required: use case described (which resource, which operations).
- Required: consumer identified (frontend React, internal module, external API).
- Optional: existing schema-pipeline context (Pydantic models present?).
- Context:
framework/spec-engineering.md5 primitives,agents/code-api-contract.mdpersona,skills/code_review_board/SKILL.md(downstream review).
OUTPUT
DELIVERS:
- Pydantic model schemas (input + output + error).
- REST / SSE endpoint definitions with status-code mapping.
- Pagination schema for list endpoints.
- Discriminated union for variants.
- Naming convention applied.
- Hyrum's-law considerations documented (which behaviours expose? which internal?).
DOES NOT DELIVER:
- No implementation logic — contract-first; implementation follows separately.
- No database schema —
agents/code-data.mdpersona / spec authoring. - No frontend code — the schema pipeline produces Zod; frontend code follows separately.
ENABLES:
- A stable public API with clear boundaries.
- A backward-compatible extension path.
- Schema-pipeline consistency (Pydantic → OpenAPI → Zod).
- code-api-contract persona can review consistently.
DONE
- Every endpoint has typed input + output schemas.
- Error responses follow one consistent form (AppError + ErrorResponse).
- Validation only at system boundaries.
- List endpoints support pagination.
- New fields are additive + optional (backward compatible).
- Naming follows consistent conventions across every endpoint.
- API doc or types committed with the implementation.
- SSE events explicitly defined (when applicable).
FAIL
- Retry: schema inconsistency detected → fix, then re-review.
- Escalate: Hyrum's-law consequence unclear → solution-expert or council for an architectural decision.
- Abort: replacement not designed but the old API
should be deprecated → build the replacement first, then
deprecate (cross-ref
deprecation_and_migration).
See also
agents/code-api-contract.md— persona reviewer (counterpart to this skill).skills/deprecation_and_migration/SKILL.md— when a breaking change is needed.skills/code_review_board/SKILL.md— downstream review of the API implementation.framework/spec-engineering.md— 5 primitives (spec writing); applies to API specs.skills/spec_authoring/SKILL.md— when an API is part of a larger spec.
Other versions69 projects use a version of this.
Word for word · 0
None found.
Edited · 32
- shashankswe2020-ux/whoop-mcp★ 17411% same
- jmxt3/gitscape.ai★ 3311% same
- sampleXbro/agentsmesh★ 2411% same
- HK-hub/AgentSkills★ 611% same
- lza6/claw-code-tingfeng★ 511% same
- Envy-7z/katalyst★ 411% same
- PenceZHR/stagepass★ 411% same
- LLl0k0laD/agent-skills★ 312% same
- SrejonKhan/agent-skills★ 311% same
- Adhamxon/claude-code-skills★ 211% same
22 more not listed
Wrote their own version · 37
- addyosmani/agent-skills★ 112ksame name
- ollaya-dev/ollaya★ 1.4ksame name
- rizqinrr/viserys-agent★ 556same name
- drvoss/everything-copilot-cli★ 49same name
- vinvcn/addyosmani-agent-skills-zh★ 46same name
- jaskirat1616/grok-skills★ 22same name
- JPeetz/agent-skills★ 14same name
- ddddjaak/ae-skills★ 4same name
- dzevs/zynk★ 4same name
- Marvellbrazil/my-agentic-skills★ 4same name
27 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use constraint-driven-development, observability-and-instrumentation and 9 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.
MrCipherSmithSkillconstraint-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 14 projects that use this
HK-hubSkillobservability-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 32 projects that use this
seikaikyoSkilldoubt-driven-development
對非平凡決策啟動新鮮 context 對抗審查(找碴不背書),在修正還便宜的時候抓出錯誤方向。適用:高風險改動(production、資安敏感邏輯、不可逆操作)、不熟的程式碼、要宣稱「這樣是安全的 / 可行的」之前。機械性操作與一行修改不適用。
Also in 41 projects that use this
HK-hubSkillsource-driven-development
Grounds every implementation decision in official documentation. Use when you want authoritative, source-cited code free from outdated patterns. Use when building with any framework or library where correctness matters.
Also in 39 projects that use this
skytiger6724Skillprioritize-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
skytiger6724Skillbrainstorm-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
- +1 more from HK-hub
- +2 more from skytiger6724
In this repository85 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- adversary-test-planSkill
- api-and-interface-designSkill
- architecture-coherence-reviewSkill
- bedrock-drillSkill
- cavemanSkill
- code-review-boardSkill
- consistency-checkSkill
- councilSkill
- cross-spec-consistency-checkSkill
- deprecation-and-migrationSkill
- documentation-and-adrsSkill
- frameSkill
- frontend-design-ttySkill
- frontend-ui-engineeringSkill
- get-api-docsSkill
- impl-plan-reviewSkill
- improve-codebase-architectureSkill
- knowledge-captureSkill
- knowledge-processorSkill
- pre-build-spec-auditSkill
- retroactive-spec-updateSkill
- root-cause-fixSkill
- scopingSkill
- sectional-deep-reviewSkill
- security-and-hardeningSkill
- session-diagnosisSkill
- shipping-and-launchSkill
- show-open-tasksSkill
- source-spec-reduceSkill
- spec-authoringSkill
- spec-boardSkill
- task-creationSkill
- task-status-updateSkill
- testingSkill
- transparency-headerSkill
- ux-authoringSkill
- workflow-routerSkill
- youtube-subtitlesSkill
- adversary-test-planSkill
- architecture-coherence-reviewSkill
- bedrock-drillSkill
- cavemanSkill
- close-retroSkill
- code-review-boardSkill
- consistency-checkSkill
- convergence-loopSkill
- councilSkill
- cross-spec-consistency-checkSkill
- deprecation-and-migrationSkill
- documentation-and-adrsSkill
- frameSkill
- frontend-design-ttySkill
- frontend-ui-engineeringSkill
- get-api-docsSkill
- impl-plan-reviewSkill
- improve-codebase-architectureSkill
- knowledge-captureSkill
- knowledge-processorSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

