Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Api Design?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/sivaprasadreddy-api-design)
---
name: api-design
description: Design consistent, secure, evolvable APIs and contracts for web, mobile, partner, and service-to-service applications.
---
# API Design
## Purpose
Create APIs that are predictable for consumers, aligned with business capabilities, and safe to evolve.
## When to use
Use when creating or changing HTTP APIs, RPC interfaces, public contracts, internal service interfaces, or client-facing operations.
## Principles
- Design around business capabilities and consumer workflows, not direct database table exposure.
- Use consistent resource and operation naming.
- Choose interaction style and protocol based on use case, latency, streaming, tooling, and consumer constraints.
- Keep request and response contracts explicit and minimal.
- Distinguish identifiers from display labels and internal implementation details.
- Define validation, error semantics, pagination, filtering, sorting, and idempotency consistently.
- Use appropriate HTTP semantics when designing HTTP APIs.
- Make compatibility and versioning strategy explicit; prefer additive evolution where practical.
- Do not expose internal exception messages, storage schemas, or secrets.
- Document authentication, authorization, rate limits, and operational expectations.
## HTTP API guidance
- Use methods and status codes consistently with their semantics.
- Use nouns for resource paths; use action endpoints only when an operation is not naturally represented as resource state.
- Validate path, query, header, and body inputs.
- Define a consistent error representation with a stable machine-readable code and safe human-readable message.
- Use pagination for collections that may grow; define limits and stable ordering.
- Define filtering and sorting explicitly; do not expose arbitrary query languages without controls.
- Use conditional requests or concurrency tokens where lost updates matter.
- Use idempotency keys or equivalent safeguards for retryable operations that create consequential side effects.
- Set request and response size limits.
- Avoid leaking whether sensitive resources exist when that information itself is confidential.
## Contract evolution
- Prefer adding optional fields or new operations over changing existing meanings.
- Do not repurpose a field or silently change units, null semantics, or default behavior.
- Define how unknown fields and enum values are handled by consumers.
- Measure usage before removing deprecated behavior.
- Publish deprecation timelines and migration guidance for external consumers.
- Test compatibility between supported client and server versions.
## Workflow
1. Identify consumers and their use cases.
2. Define operations, resource identity, and business semantics.
3. Specify request/response schemas, validation, and error behavior.
4. Define authorization and data exposure rules.
5. Decide pagination, filtering, sorting, and concurrency behavior.
6. Define idempotency and retry expectations.
7. Review compatibility and versioning impact.
8. Document examples and test success, validation, authorization, and failure cases.
## Review checklist
- Is the API intuitive and consistent?
- Does it expose only necessary data?
- Are errors stable and actionable?
- Are collections bounded?
- Are retry and concurrency semantics clear?
- Can existing clients continue to work?
- Are security and rate limits addressed?
Do not prescribe REST, GraphQL, or RPC universally. Choose based on actual consumers and interaction needs.