api-design-principles
Skill36 starsChanged 4 months agoMITView on GitHub
Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewing API specifications, or establishing API design standards.
We split this skill into the rules it gives an agent
7 rules. 5 are common, 0 are distinctive, and 2 are very specific to this project.
5
Common
Most of the 24 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Common: line 27
Use HTTP methods for actions (GET, POST, PUT, PATCH, DELETE)
- Very specific: line 84
Consistent Naming: Use plural nouns for collections (/users, not /user)
- Common: line 88
Pagination: Always paginate large collections
- Common: line 90
Documentation: Use OpenAPI/Swagger for interactive docs
- Common: line 95
Avoid N+1: Use DataLoaders for efficient data fetching
- Common: line 98
Pagination: Use cursor-based pagination (Relay spec)
- Very specific: line 99
Deprecation: Use @deprecated directive for gradual migration
“Common” is measured: kept by at least 6 in 10 of the 24 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 Design Principles
Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers and stand the test of time.
When to Use This Skill
- Designing new REST or GraphQL APIs
- Refactoring existing APIs for better usability
- Establishing API design standards for your team
- Reviewing API specifications before implementation
- Migrating between API paradigms (REST to GraphQL, etc.)
- Creating developer-friendly API documentation
- Optimizing APIs for specific use cases (mobile, third-party integrations)
Core Concepts
1. RESTful Design Principles
Resource-Oriented Architecture
- Resources are nouns (users, orders, products), not verbs
- Use HTTP methods for actions (GET, POST, PUT, PATCH, DELETE)
- URLs represent resource hierarchies
- Consistent naming conventions
HTTP Methods Semantics:
GET: Retrieve resources (idempotent, safe)POST: Create new resourcesPUT: Replace entire resource (idempotent)PATCH: Partial resource updatesDELETE: Remove resources (idempotent)
2. GraphQL Design Principles
Schema-First Development
- Types define your domain model
- Queries for reading data
- Mutations for modifying data
- Subscriptions for real-time updates
Query Structure:
- Clients request exactly what they need
- Single endpoint, multiple operations
- Strongly typed schema
- Introspection built-in
3. API Versioning Strategies
URL Versioning:
/api/v1/users
/api/v2/usersHeader Versioning:
Accept: application/vnd.api+json; version=1Query Parameter Versioning:
/api/users?version=1Detailed patterns and worked examples
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
Best Practices
REST APIs
- Consistent Naming: Use plural nouns for collections (
/users, not/user) - Stateless: Each request contains all necessary information
- Use HTTP Status Codes Correctly: 2xx success, 4xx client errors, 5xx server errors
- Version Your API: Plan for breaking changes from day one
- Pagination: Always paginate large collections
- Rate Limiting: Protect your API with rate limits
- Documentation: Use OpenAPI/Swagger for interactive docs
GraphQL APIs
- Schema First: Design schema before writing resolvers
- Avoid N+1: Use DataLoaders for efficient data fetching
- Input Validation: Validate at schema and resolver levels
- Error Handling: Return structured errors in mutation payloads
- Pagination: Use cursor-based pagination (Relay spec)
- Deprecation: Use
@deprecateddirective for gradual migration - Monitoring: Track query complexity and execution time
Common Pitfalls
- Over-fetching/Under-fetching (REST): Fixed in GraphQL but requires DataLoaders
- Breaking Changes: Version APIs or use deprecation strategies
- Inconsistent Error Formats: Standardize error responses
- Missing Rate Limits: APIs without limits are vulnerable to abuse
- Poor Documentation: Undocumented APIs frustrate developers
- Ignoring HTTP Semantics: POST for idempotent operations breaks expectations
- Tight Coupling: API structure shouldn't mirror database schema
Other versions32 projects use a version of this.
Word for word · 3
- idexal/idexal-skills★ 2100% same
- roshankodi/agent-skills★ 2100% same
- enes9103/my-claude-agents-skills★ 0100% same
Edited · 26
- coco-research/coco★ 79725% same
- chendongqi/OPB-Skills★ 12526% same
- jh941213/ADLC-harness★ 12525% same
- jh941213/my-cc-harness★ 12525% same
- jh941213/my-claude-code-asset★ 12525% same
- The-AIOS/aios★ 9326% same
- Bbar0n234/learnflow-ai★ 3527% same
- nilecui/SkillsBase★ 2726% same
- JuankCadavid/akili-specs★ 925% same
- xfstudio/skills★ 949% same
16 more not listed
Wrote their own version · 3
- myths-labs/muse★ 37same name
- kumaran-is/claude-code-onboarding★ 35same name
- wpank/ai★ 11same name
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 docs-ci, docs-interfaces and 10 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.
jh941213Skilldocs-ci
문서 CI(링크·OpenAPI lint·breaking 게이트·mermaid 검증)나 문서 드리프트 감지(docs.yaml 신선도 검사)를 설치하거나 돌릴 때 사용. 문서 내용 작성은 docs-architecture·docs-interfaces·docs-manuals.
Also in 3 projects that use this
jh941213Skilldocs-interfaces
API·이벤트 인터페이스 문서(OpenAPI·swagger·AsyncAPI 명세, 엔드포인트 레퍼런스, API 구성도·시퀀스, API CHANGELOG)를 만들거나 코드와 맞출 때 사용. 시스템 구성도는 docs-architecture, API 설계 원칙은 api-design-principles.
Also in 3 projects that use this
RachaelQuiselSkillclient-docs
Client documentation. Use when a build needs documentation updates or missing project documents need to be identified.
Also in 3 projects that use this
xfstudioSkillerror-handling-patterns
Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.
Also in 7 projects that use this
AJBcodingSkillpython-performance-optimization
Profile and optimize Python code using cProfile, memory profilers, and performance best practices. Use when debugging slow Python code, optimizing bottlenecks, or improving application performance.
Also in 7 projects that use this
planailabsSkilldocs-architecture
Layout, build pipeline, and structural gotchas for this dual-Astro repo. Read before changing structure, routing, or adding content. Operational/dev-server questions → dev-build skill.
Also in 3 projects that use this
- +4 more from jh941213
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/architecture.mdcCursor rule
- .cursor/rules/conventions.mdcCursor rule
- add-middlewareSkill
- add-openapi-docsSkill
- add-testSkill
- find-skillsSkill
- improveSkill
- multi-stage-dockerfileSkill
- new-resourceSkill
- nodejs-best-practicesSkill
- prisma-client-apiSkill
- prisma-database-setupSkill
- prisma-postgresSkill
- security-auditSkill
- typescript-magicianSkill
- update-schemaSkill
- vitestSkill
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.

