API Pattern Decision Guide
Paste the following prompt into your AI chat to install this skill:
Please follow the guide at https://skillhub.cn/install/skillhub.md to install the @org-02qudk26/api-patterns skill into your AI assistant.
About this skill
Problem
Many API projects default to REST or copy resource naming without checking who consumes the API. That often produces inconsistent response shapes, missing versioning, late security decisions, and unclear rate-limiting behavior. This skill treats API design as a scenario decision problem: confirm the client first, choose between REST, GraphQL, and tRPC, then define response structure, versioning, auth, rate limiting, documentation, and security testing.
How It Works
It does not push one fixed style guide. Instead, it provides a content map so readers can pull the relevant file for the task. Key areas include:
- api-style.md: decision guidance for REST, GraphQL, and tRPC.
- rest.md: resource naming, HTTP methods, and status codes.
- response.md: envelope patterns, error formats, and pagination.
- auth.md and rate-limiting.md: JWT, OAuth, Passkeys, API keys, token buckets, and sliding windows.
- security-testing.md: checks aligned with OWASP API Top 10, including authentication and authorization tests.
In practice, the workflow is checklist-driven: confirm API consumers, select a style, standardize responses, plan versioning, define auth, add rate limits, and write documentation. It also flags anti-patterns such as /getUsers, inconsistent responses, exposed internal errors, and missing rate limiting, and references scripts/api_validator.py for endpoint validation.
Boundaries
This is useful before API design, review, or migration, especially for TypeScript full-stack projects, internal APIs, and public platforms. It is not a backend framework and does not replace database design, security hardening, or organization-specific standards. If your team already has mandatory standards, use them as the source of truth and treat this skill as a decision rationale and checklist.
Use Cases
- When building an internal admin platform, choose REST, GraphQL, or tRPC and record the rationale.
- When designing customer query endpoints, define resource names, HTTP methods, status codes, pagination, and error shape.
- Before launching a public API, choose API key, JWT, or OAuth auth and configure token-bucket rate limits and docs.
- During an API security audit, check authentication, authorization, IDOR, and rate-limit coverage against OWASP API Top 10.
Best For
- Full-stack engineers designing B2B platform APIs who need to choose an API style and response contract early.
- Backend owners maintaining public APIs who need auth, rate limiting, versioning, and docs review checklists.
- Application security engineers auditing APIs against OWASP API Top 10 for authz, authn, and rate-limit gaps.
- TypeScript monorepo team engineers deciding whether internal services should use tRPC or REST.
Related Skills
Guides Java Spring Boot backend development across REST APIs, data access, security, microservices, testing, deployment, and troubleshooting.
A systematic code error fixing skill that follows a five-step workflow: Reproduce, Isolate, Understand, Fix, Verify, to help developers resolve code errors.
Restores Lanhu designs to target framework code using schema JSON, design tokens, and image assets.
Automatically detects engineering or competition code, analyzes bugs, vulnerabilities, algorithm complexity, and edge cases, then produces risk-level findings with before/after fixes.