agentleFS
kienbui1995kienbui1995/magic-powers/skills/api-design/SKILL.md

api-design

Skill0 starsChanged 8 months agoMITView on GitHub

Use when designing REST or GraphQL APIs - endpoint naming, versioning, error handling, pagination, authentication patterns

125 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ci-pipeline, microservices and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • vndeeSkill

    ci-pipeline

    Use when creating or updating CI/CD pipelines with GitHub Actions or GitLab CI for Go, Python, or React projects

    Also in 4 projects that use this

  • pluginagentmarketplaceSkill

    microservices

    Microservices architecture patterns and best practices. Service decomposition, inter-service communication, and distributed data management.

    Also in 4 projects that use this

  • kevinaimonsterSkill

    typescript-strict

    TypeScript strict mode and advanced type system assistant. Helps write strictly-typed TypeScript code with generics, type guards, utility types, conditional types, mapped types, and template literal types. Trigger when user says 'TypeScript types' 'type gymnastics' 'TypeScript generics' 'strict TypeScript' 'type guard' 'TS类型' 'TypeScript严格模式' '类型体操' '泛型怎么写' 'TS type help'. Keywords: TypeScript, strict mode, generics, type guard, utility types, conditional types, mapped types, template literal types, infer, extends, keyof, typeof, type narrowing, discriminated unions, type assertion, type predicate, type gymnastics, TS, 类型体操, 泛型, 类型守卫, 严格类型

    Also in 4 projects that use this

  • InfopibeSkill

    deployment-patterns

    Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications.

    Also in 10 projects that use this

  • DatabricksSkill

    load-testing

    Load test a Databricks App to find its maximum QPS. Use when: (1) User says 'load test', 'benchmark', 'QPS', 'throughput', or 'performance test', (2) User wants to find how many queries per second their app can handle, (3) User wants to set up load testing scripts for their agent, (4) User wants to view load test results/dashboard, (5) User wants to validate results or observe latency/error rate with MLflow tracing.

    Also in 4 projects that use this

  • CloudAI-XSkill

    database-design

    Designs database schemas, indexing strategies, query optimization, and migration patterns for SQL and NoSQL databases. Use when designing tables, optimizing queries, fixing N+1 problems, planning migrations, or when asked about database performance, normalization, ORMs, or data modeling.

    Also in 15 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 104 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use standard HTTP status codes: 200, 201, 204, 400, 401, 403, 404, 409, 422, 429, 500.

    line 56
  2. Very specific:

    Use connections pattern for pagination (edges/nodes/pageInfo)

    line 71
  3. Distinctive:

    Use enums for fixed sets, not strings

    line 74

“Common” is measured: kept by at least 6 in 10 of the 104 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

API Design

Overview

Good APIs are consistent, predictable, and hard to misuse. Design for the consumer, not the implementation.

When to Use

  • Creating new API endpoints or services
  • Reviewing existing API design
  • Planning API versioning strategy
  • Designing error responses or pagination

REST Design Rules

URL Structure

GET    /api/v1/users          → List users
GET    /api/v1/users/:id      → Get user
POST   /api/v1/users          → Create user
PUT    /api/v1/users/:id      → Full update
PATCH  /api/v1/users/:id      → Partial update
DELETE /api/v1/users/:id      → Delete user
  • Nouns, not verbs (/users not /getUsers)
  • Plural resources (/users not /user)
  • Nested for relationships: /users/:id/orders
  • Max 2 levels of nesting — beyond that, use query params or top-level resource

Response Format

{
  "data": { ... },
  "meta": { "page": 1, "total": 100 },
  "errors": []
}

Error Responses

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Human-readable description",
    "details": [{ "field": "email", "issue": "invalid format" }]
  }
}

Use standard HTTP status codes: 200, 201, 204, 400, 401, 403, 404, 409, 422, 429, 500.

Pagination

GET /api/v1/users?page=2&per_page=20
GET /api/v1/users?cursor=abc123&limit=20  (preferred for large datasets)

Versioning

  • URL path: /api/v1/ (simplest, recommended)
  • Header: Accept: application/vnd.api+json;version=1 (cleaner but harder to test)

GraphQL Design Rules

  • One graph, not REST-over-GraphQL
  • Use connections pattern for pagination (edges/nodes/pageInfo)
  • Input types for mutations: createUser(input: CreateUserInput!)
  • Return affected object from mutations
  • Use enums for fixed sets, not strings

Checklist

  • Consistent naming conventions across all endpoints
  • Proper HTTP methods and status codes
  • Pagination on all list endpoints
  • Rate limiting headers (X-RateLimit-*)
  • Authentication documented (Bearer token, API key)
  • Versioning strategy defined
  • Error format standardized
  • OpenAPI/GraphQL schema documented

Integration

  • magic-powers:security-review — review auth and input validation
  • magic-powers:technical-writing — generate API documentation

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.