API Patterns
API design principles and decision-making for 2025.
Learn to THINK, not copy fixed patterns.
🎯 Selective Reading Rule
Read ONLY files relevant to the request! Check the content map, find what you need.
📑 Content Map
| File |
Description |
When to Read |
api-style.md |
REST vs GraphQL vs tRPC decision tree |
Choosing API type |
rest.md |
Resource naming, HTTP methods, status codes |
Designing REST API |
response.md |
Envelope pattern, error format, pagination |
Response structure |
graphql.md |
Schema design, when to use, security |
Considering GraphQL |
trpc.md |
TypeScript monorepo, type safety |
TS fullstack projects |
versioning.md |
URI/Header/Query versioning |
API evolution planning |
auth.md |
JWT, OAuth, Passkey, API Keys |
Auth pattern selection |
rate-limiting.md |
Token bucket, sliding window |
API protection |
documentation.md |
OpenAPI/Swagger best practices |
Documentation |
security-testing.md |
OWASP API Top 10, auth/authz testing |
Security audits |
🔗 Related Skills
| Need |
Skill |
| API implementation |
@[skills/backend-development] |
| Data structure |
@[skills/database-design] |
| Security details |
@[skills/security-hardening] |
✅ Decision Checklist
Before designing an API:
❌ Anti-Patterns
DON'T:
- Default to REST for everything
- Use verbs in REST endpoints (/getUsers)
- Return inconsistent response formats
- Expose internal errors to clients
- Skip rate limiting
DO:
- Choose API style based on context
- Ask about client requirements
- Document thoroughly
- Use appropriate status codes
Script
| Script |
Purpose |
Command |
scripts/api_validator.py |
API endpoint validation |
python scripts/api_validator.py <project_path> |
When to Use
API design principles and decision-making. REST vs GraphQL vs tRPC selection, response formats, versioning, pagination.
Covers: 🎯 Selective Reading Rule, 📑 Content Map, 🔗 Related Skills, ✅ Decision Checklist, ❌ Anti-Patterns.
1---2name: api-patterns3description: API design principles and decision-making. REST vs GraphQL vs tRPC selection,4 response formats, versioning, pagination.5allowed-tools: Read, Write, Edit, Glob, Grep6risk: safe7source: community8license: MIT9metadata:10 source: https://skillmd.com/skills/jantoniofc/api-patterns11---1213# API Patterns1415> API design principles and decision-making for 2025.16> **Learn to THINK, not copy fixed patterns.**1718## 🎯 Selective Reading Rule1920**Read ONLY files relevant to the request!** Check the content map, find what you need.2122---2324## 📑 Content Map2526| File | Description | When to Read |27|------|-------------|--------------|28| `api-style.md` | REST vs GraphQL vs tRPC decision tree | Choosing API type |29| `rest.md` | Resource naming, HTTP methods, status codes | Designing REST API |30| `response.md` | Envelope pattern, error format, pagination | Response structure |31| `graphql.md` | Schema design, when to use, security | Considering GraphQL |32| `trpc.md` | TypeScript monorepo, type safety | TS fullstack projects |33| `versioning.md` | URI/Header/Query versioning | API evolution planning |34| `auth.md` | JWT, OAuth, Passkey, API Keys | Auth pattern selection |35| `rate-limiting.md` | Token bucket, sliding window | API protection |36| `documentation.md` | OpenAPI/Swagger best practices | Documentation |37| `security-testing.md` | OWASP API Top 10, auth/authz testing | Security audits |3839---4041## 🔗 Related Skills4243| Need | Skill |44|------|-------|45| API implementation | `@[skills/backend-development]` |46| Data structure | `@[skills/database-design]` |47| Security details | `@[skills/security-hardening]` |4849---5051## ✅ Decision Checklist5253Before designing an API:5455- [ ] **Asked user about API consumers?**56- [ ] **Chosen API style for THIS context?** (REST/GraphQL/tRPC)57- [ ] **Defined consistent response format?**58- [ ] **Planned versioning strategy?**59- [ ] **Considered authentication needs?**60- [ ] **Planned rate limiting?**61- [ ] **Documentation approach defined?**6263---6465## ❌ Anti-Patterns6667**DON'T:**68- Default to REST for everything69- Use verbs in REST endpoints (/getUsers)70- Return inconsistent response formats71- Expose internal errors to clients72- Skip rate limiting7374**DO:**75- Choose API style based on context76- Ask about client requirements77- Document thoroughly78- Use appropriate status codes7980---8182## Script8384| Script | Purpose | Command |85|--------|---------|---------|86| `scripts/api_validator.py` | API endpoint validation | `python scripts/api_validator.py <project_path>` |8788## When to Use8990API design principles and decision-making. REST vs GraphQL vs tRPC selection, response formats, versioning, pagination.9192Covers: 🎯 Selective Reading Rule, 📑 Content Map, 🔗 Related Skills, ✅ Decision Checklist, ❌ Anti-Patterns.