About api-patterns
api-patterns is a decision guide for API designers, covering API styles, response structures, security, and evolution. It also includes a script for validating API endpoints.
Key features
- 01REST, GraphQL, and tRPC selection
- 02Resource naming and HTTP status guidance
- 03Response formats and pagination
- 04Versioning and authentication options
- 05Rate limiting, security testing, and documentation
- 06API endpoint validation script
Use cases
- 01Choose an API style for a project
- 02Plan consistent responses and versioning
- 03Assess authentication, rate limiting, and security testing
- 04Validate API endpoints with the script
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ vudovn/ ag-kit --skill api-patternsAfter installing, type/api-patternsin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
api-style.mdauth.mddocumentation.mdgraphql.mdrate-limiting.mdresponse.mdrest.mdsecurity-testing.mdtrpc.mdversioning.mdscripts/api_validator.pyDetails
From the project READMEAPI Patterns
API design principles and decision-making. 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/nodejs-best-practices] |
| Data structure | @[skills/database-design] |
| Security details | @[skills/vulnerability-scanner] |
✅ Decision Checklist
Before designing an API:
- Asked user about API consumers?
- Chosen API style for THIS context? (REST/GraphQL/tRPC)
- Defined consistent response format?
- Planned versioning strategy?
- Considered authentication needs?
- Planned rate limiting?
- Documentation approach defined?
❌ 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> |
Comments
Markdown supported