api-design
Skill3 starsChanged 4 months agoMITView on GitHub
Use when designing APIs or interfaces — REST/GraphQL contracts, request/response shapes, versioning, error models, and interface ergonomics. Triggers on "design API", "REST contract", "GraphQL schema", "接口设计", "API 契约", "API 设计".
125 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- AllThingsSmitty/proven-skillstheir own version, first seen Oct 6, 2026
- Lukk17/agent-standardstheir own version, first seen Oct 5, 2026
- SkillMedev/api-integration-engineeringtheir own version, first seen Oct 5, 2026
- SkillMedev/full-stack-web-devtheir own version, first seen Oct 5, 2026
- cellrishi-code/claude-skills-atlastheir own version, first seen Oct 4, 2026
- mnzralee/claude-multi-agent-architecturetheir own version, first seen Oct 3, 2026
Used with
Projects with it also use data-modeling, ci-pipeline and 6 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.
mmondoraSkilldata-modeling
Schema design, multi-tenant data isolation, and migration management. Firestore and PostgreSQL patterns, RLS, UUID v7 conventions. Use when designing database schemas, writing migrations, or implementing multi-tenant data access.
Also in 7 projects that use this
vndeeSkillci-pipeline
Use when creating or updating CI/CD pipelines with GitHub Actions or GitLab CI for Go, Python, or React projects
Also in 4 projects that use this
pluginagentmarketplaceSkillmicroservices
Microservices architecture patterns and best practices. Service decomposition, inter-service communication, and distributed data management.
Also in 4 projects that use this
kevinaimonsterSkilltypescript-strict
TypeScript strict mode and advanced type system assistant. Helps write strictly-typed TypeScript code with generics, type guards, utility types, conditional types, mapped types, and template literal types. Trigger when user says 'TypeScript types' 'type gymnastics' 'TypeScript generics' 'strict TypeScript' 'type guard' 'TS类型' 'TypeScript严格模式' '类型体操' '泛型怎么写' 'TS type help'. Keywords: TypeScript, strict mode, generics, type guard, utility types, conditional types, mapped types, template literal types, infer, extends, keyof, typeof, type narrowing, discriminated unions, type assertion, type predicate, type gymnastics, TS, 类型体操, 泛型, 类型守卫, 严格类型
Also in 4 projects that use this
InfopibeSkilldeployment-patterns
Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications.
Also in 10 projects that use this
CloudAI-XSkilldatabase-design
Designs database schemas, indexing strategies, query optimization, and migration patterns for SQL and NoSQL databases. Use when designing tables, optimizing queries, fixing N+1 problems, planning migrations, or when asked about database performance, normalization, ORMs, or data modeling.
Also in 15 projects that use this
Other versions125 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- byshahriar/skill-forge★ 019% same
Wrote their own version · 124
- xu-xiang/everything-claude-code-zh★ 2ksame name
- Aaronontheweb/dotnet-skills★ 1.2ksame name
- nth5693/gemini-kit★ 373same name
- loulanyue/awesome-claude-notes★ 272same name
- KbWen/agentic-os★ 206same name
- margelo/react-native-skills★ 173same name
- tpavanipradeep/everything-claude-code★ 134same name
- templetongroup/radiant★ 113same name
- cohen-liel/hivemind★ 110same name
- microsoft/haste★ 106same name
114 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.
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- brainstormSkill
- oss-strategySkill
- specSkill
- researchSkill
- architectureSkill
- codebase-designSkill
- design-researchSkill
- domain-modelingSkill
- frontend-designSkill
- imagegenSkill
- image-to-codeSkill
- prompt-engineeringSkill
- prototypeSkill
- schema-designSkill
- auth-implementationSkill
- breakdownSkill
- context-engineeringSkill
- error-handlingSkill
- i18nSkill
- implementSkill
- multi-agent-orchestrationSkill
- cost-optimizationSkill
- performanceSkill
- refactoringSkill
- simplifySkill
- api-testingSkill
- e2e-testingSkill
- load-testingSkill
- tddSkill
- test-generationSkill
- a11y-reviewSkill
- code-reviewSkill
- debuggingSkill
- lintingSkill
- security-reviewSkill
- ci-cdSkill
- deprecation-migrationSkill
- git-workflowSkill
- oss-polishSkill
- shippingSkill
- documentation-auditSkill
- handoffSkill
- incident-responseSkill
- observabilitySkill
- purity-auditSkill
- skill-authoringSkill
- using-skillsSkill
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 104 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
- Distinctive: line 37
The One-Version Rule: Avoid forcing consumers to choose between multiple versions.
- Very specific: line 47
Every error response follows the same shape.
“Common” is measured: kept by at least 6 in 10 of the 104 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
API and Interface Design
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, GraphQL schemas, module boundaries, component props, and any surface where one piece of code talks to another.
When to use
- Designing new REST or GraphQL endpoints
- Defining module boundaries or contracts between teams
- Creating component prop interfaces or type contracts
- Establishing database schema that informs API shape
- Changing existing public interfaces
- Triggers on "API design", "interface design", "REST", "GraphQL", "contract", "接口设计", "API 契约", "API 设计"
Not for: system-level architecture decisions (use architecture); deep-module or codebase
structure (use codebase-design).
Steps
1. Define the contract first
The contract is the spec — implementation follows. Define typed input and output schemas before writing handlers. The types ARE the documentation.
2. Apply core principles
Hyrum's Law: With enough users, all observable behaviors become de-facto contracts — including undocumented quirks, error text, timing, and ordering. Be intentional about what you expose; don't leak implementation details; plan for deprecation at design time.
The One-Version Rule: Avoid forcing consumers to choose between multiple versions. Design for a world where only one version exists at a time — extend rather than fork. Multiple versions multiply maintenance cost and create diamond dependency problems.
Addition Over Modification: Extend interfaces without breaking consumers — add optional fields, never change existing field types or remove fields. Breaking changes without versioning break consumers.
3. Pick one error strategy and use it everywhere
Every error response follows the same shape. Don't mix patterns — if some endpoints throw, others
return null, and others return { error }, the consumer can't predict behavior.
interface APIError {
error: {
code: string; // Machine-readable: "VALIDATION_ERROR"
message: string; // Human-readable: "Email is required"
details?: unknown; // Additional context when helpful
};
}Status code mapping: 400 malformed request (can't parse — bad JSON, wrong content-type), 401 not authenticated, 403 not authorized, 404 not found, 409 conflict (duplicate, version mismatch), 422 well-formed but semantically invalid (fails business validation), 500 server error (never expose internal details).
4. Validate at boundaries
Trust internal code. Validate at system edges where external input enters: API route handlers, form submissions, external service response parsing (third-party data is always untrusted), and environment variable loading. Do NOT validate between internal functions that share type contracts, in utility functions called by already-validated code, or on data from your own database.
5. Follow predictable naming
| Pattern | Convention | Example |
| REST endpoints | Plural nouns, no verbs | GET /api/tasks, POST /api/tasks |
| Query params | camelCase | ?sortBy=createdAt&pageSize=20 |
| Response fields | camelCase | { createdAt, updatedAt, taskId } |
| Boolean fields | is/has/can prefix | isComplete, hasAttachments |
| Enum values | UPPER_SNAKE | "IN_PROGRESS", "COMPLETED" |
6. Apply REST resource patterns
GET /api/tasks → List tasks (with query params for filtering)
POST /api/tasks → Create a task
GET /api/tasks/:id → Get a single task
PATCH /api/tasks/:id → Update a task (partial)
DELETE /api/tasks/:id → Delete a task (idempotent)
GET /api/tasks/:id/comments → List comments for a task (sub-resource)Paginate every list endpoint from the start — you will need it the moment someone has 100+ items. Accept partial objects on PATCH (only update what's provided), not full objects on PUT.
7. Use discriminated unions for variants
type TaskStatus =
| { type: 'pending' }
| { type: 'in_progress'; assignee: string; startedAt: Date }
| { type: 'completed'; completedAt: Date; completedBy: string }
| { type: 'cancelled'; reason: string; cancelledAt: Date };Consumer gets type narrowing — each variant is explicit, no optional fields that don't apply.
Separate input types (what the caller provides) from output types (what the system returns,
including server-generated fields). Use branded types for IDs to prevent accidentally passing a
UserId where a TaskId is expected.
Output: docs/API/*.md — one file per endpoint group, with full request/response shapes, parameters, errors, and examples.
Verify
- Every endpoint has typed input and output schemas
- Error responses follow a single consistent format across all endpoints
- Validation happens at system boundaries only, not scattered through internal code
- List endpoints support pagination
- New fields are additive and optional (backward compatible)
- Naming follows consistent conventions across all endpoints
- API documentation or types are committed alongside the implementation
Red flags: endpoints that return different shapes depending on conditions; inconsistent error
formats; validation scattered through internal code; breaking changes to existing fields; list
endpoints without pagination; verbs in REST URLs (/api/createTask); third-party API responses
used without validation.
Common rationalizations: "We'll document later" — the types ARE the documentation, define them first. "We don't need pagination for now" — add it from the start. "PATCH is complicated, use PUT" — PATCH is what clients actually want. "We'll version when we need to" — design for extension from the start. "Nobody uses that undocumented behavior" — Hyrum's Law says someone does.
References
- ${CLAUDE_PLUGIN_ROOT}/references/engineering-principles.md — shared discipline (enforce simplicity, surgical scope, verify don't assume)
- references/versioning-strategy.md — when breaking change is unavoidable: URI/header versioning, sunset/deprecation headers (RFC 8594), dual-version coexistence, sunset timeline
- references/openapi-lifecycle.md — design-first vs code-first, Spectral/Redocly linting, openapi-generator SDK generation, spec versioning, CI pipeline
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
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.

