API Patterns

SkillMedia

api-patterns is a skill that gives an AI agent reference guides for API design decisions. It covers choosing between REST, GraphQL and tRPC, plus resource naming, response formats, versioning, authentication, rate limiting, documentation and security testing. The agent reads only the guide relevant to the task, follows a pre-design checklist, and can run a validator script against a project.

Available today. Use it from your connected AI after setup.

Have an agent setup that supports skills and the tools the skill uses: Read, Write, Edit, Glob and Grep.

Then ask your AI: use the API Patterns skill

What your AI can do with it

  • Decides between REST, GraphQL and tRPC using a decision tree in api-style.md
  • Guides REST design: resource naming, HTTP methods and status codes
  • Covers response structure: envelope pattern, error format and pagination
  • Explains versioning options: URI, Header and Query versioning
  • Reviews auth patterns including JWT, OAuth, Passkey and API keys
  • Runs scripts/api_validator.py to validate API endpoints in a project

Getting started

  1. Have an agent setup that supports skills and the tools the skill uses: Read, Write, Edit, Glob and Grep.
  2. Add the api-patterns skill to your agent's skills.
  3. Ask the agent about an API design task, such as choosing an API style or planning versioning.
  4. The agent reads only the relevant guide file, applies the decision checklist, and can optionally run the validator script against your project path.

What this skill tells your AI

The instructions your AI receives, as published by davila7/claude-code-templates in cli-tool/components/skills/development/api-patterns/SKILL.md and read by ahel’s review.

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

FileDescriptionWhen to Read
api-style.mdREST vs GraphQL vs tRPC decision treeChoosing API type
rest.mdResource naming, HTTP methods, status codesDesigning REST API
response.mdEnvelope pattern, error format, paginationResponse structure
graphql.mdSchema design, when to use, securityConsidering GraphQL
trpc.mdTypeScript monorepo, type safetyTS fullstack projects
versioning.mdURI/Header/Query versioningAPI evolution planning
auth.mdJWT, OAuth, Passkey, API KeysAuth pattern selection
rate-limiting.mdToken bucket, sliding windowAPI protection
documentation.mdOpenAPI/Swagger best practicesDocumentation
security-testing.mdOWASP API Top 10, auth/authz testingSecurity audits

🔗 Related Skills

NeedSkill
API implementation@[skills/backend-development]
Data structure@[skills/database-design]
Security details@[skills/security-hardening]

✅ 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

ScriptPurposeCommand
scripts/api_validator.pyAPI endpoint validationpython scripts/api_validator.py <project_path>

Signals

GitHub stars
32k
Forks
4k
Last commit
Sep 2026

Questions

Does it help choose between REST, GraphQL and tRPC?
Yes. The api-style.md guide provides a decision tree for selecting the API style that fits the context, and the skill instructs the agent to ask about API consumers before choosing.
Does it cover authentication?
Yes. The auth.md guide covers JWT, OAuth, Passkey and API Keys for auth pattern selection.
Can it check an existing project?
Yes. The skill includes scripts/api_validator.py, which the agent can run with a project path to validate API endpoints.
Advanced
Item type
skill
Key
api-patterns-davila7
Source
github.com/davila7/claude-code-templates