Skip to content
Skills Library
Programming · Planning

api-design-patterns

/api-design-patterns

RESTful API design, error handling, versioning, and best practices. Use when designing APIs, reviewing endpoints, implementing error responses, or setting up API structure. Triggers on "design API", "review API", "REST best practices", or "API patterns".

Licence
MIT
Last repository change
27.08.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
44
Scripts
0
HTML comments
0
URLs in SKILL.md
5
Deprecation

No signals detected. Repository changed on 27.08.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

RESTful API design, error handling, versioning, and best practices. Use when designing APIs, reviewing endpoints, implementing error responses, or setting up API structure. Triggers on "design API", "review API", "REST best practices", or "API patterns".

Triggers from the description

design APIreview APIREST best practicesAPI patterns
Original author description

RESTful API design, error handling, versioning, and best practices. Use when designing APIs, reviewing endpoints, implementing error responses, or setting up API structure. Triggers on "design API", "review API", "REST best practices", or "API patterns".

How it works

  1. Metadata
  2. When to Apply
  3. Rule Categories by Priority
  4. Quick Reference
  5. Essential Guidelines
  6. How to Use
  7. References
  8. Full Compiled Document
Original SKILL.md headings · 186 lines, 685 words
SKILL.md preview
---
name: api-design-patterns
description: RESTful API design, error handling, versioning, and best practices. Use when designing APIs, reviewing endpoints, implementing error responses, or setting up API structure. Triggers on "design API", "review API", "REST best practices", or "API patterns".
license: MIT
metadata:
  author: agent-skills
  version: "2.0.0"
---

# API Design Patterns

RESTful API design principles for building consistent, developer-friendly APIs. Contains 38 rules across 7 categories covering resource design, error handling, security, pagination, versioning, response format, and documentation.

## Metadata

- **Version:** 2.0.0
- **Rule Count:** 38 rules across 7 categories
- **License:** MIT

## When to Apply

Reference these guidelines when:
- Designing new API endpoints
- Reviewing existing API structure
- Implementing error handling and validation
- Setting up pagination, filtering, and sorting
- Planning API versioning strategy
- Configuring API security (auth, CORS, rate limiting)
- Writing API documentation (OpenAPI/Swagger)

## Rule Categories by Priority

| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | Resource Design | CRITICAL | `rest-` |
| 2 | Error Handling | CRITICAL | `error-` |
| 3 | Security | CRITICAL | `sec-` |
| 4 | Pagination & Filtering | HIGH | `page-`, `filter-`, `sort-` |
| 5 | Versioning | HIGH | `ver-` |
| 6 | Response Format | MEDIUM | `resp-` |
| 7 | Documentation | MEDIUM | `doc-` |

## Quick Reference

### 1. Resource Design (CRITICAL)

- `rest-nouns-not-verbs` - Use nouns for endpoints, not verbs
- `rest-plural-resources` - Use plural resource names
- `rest-http-methods` - Correct HTTP method usage (GET, POST, PUT, PATCH, DELETE)
- `rest-nested-resources` - Proper resource nesting (max 2 levels)
- `rest-status-codes` - Appropriate HTTP status codes
- `rest-idempotency` - Idempotent operations with idempotency keys
- `rest-hateoas` - Hypermedia links for discoverability
- `rest-resource-actions` - Non-CRUD actions as sub-resources

### 2. Error Handling (CRITICAL)

- `error-consistent-format` - Consistent error response structure
- `error-meaningful-messages` - Helpful, actionable error messages
- `error-validation-details` - Field-level validation errors
- `error-error-codes` - Machine-readable error codes
- `error-no-stack-traces` - Never expose stack traces in production
- `error-request-id` - Include request IDs for debugging

### 3. Security (CRITICAL)

- `sec-authentication` - Proper auth implementation (OAuth2/JWT)
- `sec-authorization` - Resource-level permissions (RBAC)
- `sec-rate-limiting` - Prevent abuse with rate limiting
- `sec-input-validation` - Validate and sanitize all input
- `sec-cors-config` - CORS configuration with whitelists
- `sec-https-only` - Enforce HTTPS for all traffic
- `sec-sensitive-data` - Protect passwords, tokens, PII

### 4. Pagination & Filtering (HIGH)

- `page-cursor-based` - Cursor pagination for large datasets
- `page-offset-based` - Offset pagination for simple cases
- `page-consistent-params` - Consistent parameter naming
- `page-metadata` - Include pagination metadata in responses
- `filter-query-params` - Filter via query parameters
- `sort-flexible` - Flexible sorting with `-` prefix for descending

### 5. Versioning (HIGH)

- `ver-url-path` - Version in URL path (/api/v1/)
- `ver-header-based` - Version via Accept header
- `ver-backward-compatible` - Maintain backward compatibility
- `ver-deprecation` - Deprecation strategy with Sunset header

### 6. Response Format (MEDIUM)

- `resp-consistent-structure` - Consistent response envelope
- `resp-json-conventions` - JSON naming conventions
- `resp-partial-responses` - Field selection (sparse fieldsets)
- `resp-compression` - Response compression (gzip/Brotli)

### 7. Documentation (MEDIUM)

- `doc-openapi` - OpenAPI/Swagger specification
- `doc-examples` - Request/response examples
- `doc-changelog` - API changelog

## Essential Guidelines

### Resource Naming

```
# ❌ Verbs in URLs
GET    /getUsers
POST   /createUser

# ✅ Nouns with HTTP methods
GET    /users          # List users
POST   /users          # Create user
GET    /users/123      # Get user
PUT    /users/123      # Update user (full)
PATCH  /users/123      # Update user (partial)
DELETE /users/123      # Delete user
```

### Error Response Format

```json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "The request contains invalid data",
    "details": [
      {
        "field": "email",
        "code": "INVALID_FORMAT",
        "message": "Please provide a valid email address"
      }
    ],
    "request_id": "req_abc123"
  }
}
```

### Pagination

```json
{
  "data": [...],
  "meta": {
    "current_page": 2,
    "per_page": 20,
    "total_pages": 10,
    "total_count": 195
  },
  "links": {
    "first": "/users?page=1&per_page=20",
    "prev": "/users?page=1&per_page=20",
    "next": "/users?page=3&per_page=20",
    "last": "/users?page=10&per_page=20"
  }
}
```

### Rate Limiting Headers

```
HTTP/1.1 200 OK
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 998
X-RateLimit-Reset: 1640995200
```

## How to Use

Read individual rule files for detailed explanations:

```
rules/rest-http-methods.md
rules/error-consistent-format.md
rules/page-cursor-based.md
rules/sec-authentication.md
rules/ver-url-path.md
rules/doc-openapi.md
```

## References

- [RESTful API Guidelines](https://restfulapi.net)
- [Zalando RESTful API Guidelines](https://zalando.github.io/restful-api-guidelines)
- [Microsoft API Guidelines](https://github.com/microsoft/api-guidelines)
- [Google API Design Guide](https://cloud.google.com/apis/design)
- [OpenAPI Specification](https://swagger.io/specification)

## Full Compiled Document

For the complete guide with all rules expanded: `AGENTS.md`
Files in this package (44)
  • AGENTS.md 190 KB
  • README.md 2 KB
  • SKILL.md 6 KB
  • metadata.json 2 KB
  • rules/_sections.md 2 KB
  • rules/_template.md 1 KB
  • rules/doc-changelog.md 5 KB
  • rules/doc-examples.md 5 KB
  • rules/doc-openapi.md 7 KB
  • rules/error-consistent-format.md 8 KB
  • rules/error-error-codes.md 8 KB
  • rules/error-meaningful-messages.md 8 KB
  • rules/error-no-stack-traces.md 7 KB
  • rules/error-request-id.md 7 KB
  • rules/error-validation-details.md 8 KB
  • rules/filter-query-params.md 2 KB
  • rules/page-consistent-params.md 2 KB
  • rules/page-cursor-based.md 2 KB
  • rules/page-metadata.md 2 KB
  • rules/page-offset-based.md 2 KB
  • rules/resp-compression.md 4 KB
  • rules/resp-consistent-structure.md 3 KB
  • rules/resp-json-conventions.md 3 KB
  • rules/resp-partial-responses.md 4 KB
  • rules/rest-hateoas.md 7 KB
  • rules/rest-http-methods.md 5 KB
  • rules/rest-idempotency.md 6 KB
  • rules/rest-nested-resources.md 5 KB
  • rules/rest-nouns-not-verbs.md 3 KB
  • rules/rest-plural-resources.md 3 KB
  • rules/rest-resource-actions.md 7 KB
  • rules/rest-status-codes.md 6 KB
  • rules/sec-authentication.md 8 KB
  • rules/sec-authorization.md 8 KB
  • rules/sec-cors-config.md 7 KB
  • rules/sec-https-only.md 7 KB
  • rules/sec-input-validation.md 8 KB
  • rules/sec-rate-limiting.md 7 KB
  • rules/sec-sensitive-data.md 7 KB
  • rules/sort-flexible.md 2 KB
  • rules/ver-backward-compatible.md 2 KB
  • rules/ver-deprecation.md 3 KB
  • rules/ver-header-based.md 3 KB
  • rules/ver-url-path.md 2 KB

Versions

RepositoryScoreLicence
This page · AsyrafHussin/agent-skills100MIT
sabahattink/antigravity-fullstack-hq100MIT
ils15/copilot-global-config100MIT
organvm-iv-taxis/a-i--skills95Apache-2.0
NickCrew/Claude-Cortex95MIT

Database snapshot: 13.11.2026 · package version 394ce2e72d6f (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100api
    RESTful API design patterns and best practices. Use when creating endpoints, designing APIs, or implementing routes.
  • 100api-design
    Professional API design skill covering RESTful APIs, GraphQL, API versioning, authentication, idempotency, and API documentation best practices. Use this skill when designing RESTful APIs, creating GraphQL schemas, implementing API versioning strategies, or need guidance on…
  • 100api-design
    Professional API design skill covering RESTful APIs, GraphQL, API versioning, authentication, idempotency, and API documentation best practices. Use this skill when designing RESTful APIs, creating GraphQL schemas, implementing API versioning strategies, or need guidance on…
  • 100api-design
    RESTful API design standards: resource naming, HTTP methods, status codes, pagination, versioning. TRIGGER when: designing new API endpoints, defining error response shapes, or adding pagination/filtering. SKIP: implementing FastAPI route code (use python-patterns);…
  • 100api-design
    Guidelines for designing RESTful APIs and TypeScript interfaces. Use when designing new endpoints, reviewing API contracts, or structuring data models.
  • 100restful-api-design-best-practices
    Use this skill when designing, reviewing, or standardizing RESTful HTTP APIs adhering to strict resource modeling, status codes, and JSON conventions.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.