Skip to content
Back to skills

Api Design

ASecurity

REST/gRPC API design, versioning strategies, error codes, request/response contracts, backward compatibility, rate limiting, OpenAPI specifications. Use when designing APIs, defining contracts, planning versioning, or ensuring API consistency.

  • 5 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 6, 2026
developmentgoapi

Works with

  • api

Security analysis

A100/100

Scanned September 6, 2026

npx -y skills add saitarrun/Devforge-ai --skill api-design --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Api Design?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Api Design
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/saitarrun-api-design/badge)](https://www.skillsdirectory.com/skills/saitarrun-api-design)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: api-design
description: REST/gRPC API design, versioning strategies, error codes, request/response contracts, backward compatibility, rate limiting, OpenAPI specifications. Use when designing APIs, defining contracts, planning versioning, or ensuring API consistency.
version: 1.0.0
---

# Skill: API Design

Design APIs as contracts. Versions matter. Backward compatibility is non-negotiable.

## REST Principles

- **Noun-based URLs**: `/users` not `/getUsers`
- **HTTP methods**: GET (read), POST (create), PUT (update), DELETE (remove)
- **Status codes**: 200 (OK), 201 (created), 400 (bad request), 401 (auth), 404 (not found), 500 (error)
- **Consistency**: Same patterns across all endpoints

## Versioning Strategy

**URL path** (explicit, clear):
```
GET /api/v1/users   # v1 API
GET /api/v2/users   # v2 API (breaking change)
```

**Header** (less visible, prefer path):
```
GET /api/users
Header: API-Version: 2
```

## Breaking Changes = Major Version

```
v1.0 → v2.0: User response format changed
v1.1 → v1.2: New optional field added (backward-compatible)
v1.0 → v1.1: Bug fix (patch)
```

## API Contract (OpenAPI/Swagger)

```yaml
paths:
  /users/{id}:
    get:
      summary: Get user
      parameters:
        - name: id
          in: path
          required: true
          schema: { type: string }
      responses:
        '200':
          description: User found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '404':
          description: Not found
```

## Error Responses

```json
{
  "error": "not_found",
  "message": "User not found",
  "code": 404,
  "details": {
    "resource": "user",
    "id": "user-123"
  }
}
```

## Rate Limiting

```
Header: X-RateLimit-Limit: 1000
Header: X-RateLimit-Remaining: 999
Header: X-RateLimit-Reset: 1640000000
```

## Pagination

```
GET /users?page=2&page_size=10

Response:
{
  "items": [...],
  "total": 245,
  "page": 2,
  "page_size": 10,
  "has_next": true
}
```

## Deprecation Plan

```
1. Announce: Email, docs, API response header
2. Timeline: 6 months before removal
3. Header: X-API-Warn: "endpoint deprecated, use /v2/..."
4. Support: v1 and v2 endpoints run in parallel
5. Remove: After timeline expires
```

---

**Status**: Ready for API design  
**Best for**: API contracts, versioning, error handling

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…