Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Api Design

ASecurity

Design clean and consistent APIs. Use when the user says "design an API", "API design review", "design these endpoints", "REST API for X", "GraphQL schema", "API contract", "how should this endpoint work", "review my API design", or wants to create or improve an API interface - even if they don't explicitly say "API design".

20 stars
0 votes
0 copies
0 views
Added 10/4/2026
ai-agentsgoapidatabase

Works with

cursorcliapi

Security Analysis

A100/100

Scanned 10/4/2026

$npx -y skills add qa-aman/claude-skills --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 automatically with every re-scan.

Security grade badge for Api Design
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/qa-aman-api-design/badge)](https://www.skillsdirectory.com/skills/qa-aman-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
Files
SKILL.md
---
name: api-design
description: >
  Design clean and consistent APIs. Use when the user says "design an API",
  "API design review", "design these endpoints", "REST API for X", "GraphQL schema",
  "API contract", "how should this endpoint work", "review my API design",
  or wants to create or improve an API interface
  - even if they don't explicitly say "API design".
---

## Overview

Based on **"A Philosophy of Software Design"** by John Ousterhout. Ousterhout's key principle: modules should be deep - simple interface, powerful implementation. Applied to APIs: the surface area exposed to callers should be as small as possible, while the behavior provided should be as rich as possible. A leaky abstraction (where callers need to understand implementation details) is a design failure.

## Workflow

### Step 1: Define the API's job
Before designing any endpoint, state what the API enables:
- What is the caller trying to accomplish?
- What information does the caller have?
- What should the API hide from the caller?

Ousterhout: if callers need to know how the API works internally to use it correctly, the API is leaky.

### Step 2: Design resources (REST) or schema (GraphQL)
**REST:**
- Resources are nouns, not verbs: `/users`, `/orders` not `/getUsers`, `/createOrder`
- Use HTTP verbs for actions: GET (read), POST (create), PUT (replace), PATCH (update), DELETE (remove)
- Nest for ownership: `/users/{id}/orders` (orders owned by a user)
- Don't nest beyond 2 levels deep

**GraphQL:**
- Types model your domain, not your database schema
- Queries fetch data, mutations change it, subscriptions stream it
- Design the schema from the client's perspective: what does the UI need?

### Step 3: Design request and response contracts
For each endpoint:
```
Endpoint: [METHOD] /path/{param}
Purpose: [one sentence]
Auth: [required scope or token type]

Request:
  Path params: [required identifiers]
  Query params: [optional filters, pagination]
  Body: [JSON schema with required/optional fields]

Response (200):
  [JSON schema]

Errors:
  400 - [validation failure - which fields, why]
  401 - [unauthenticated]
  403 - [unauthorized - caller lacks permission]
  404 - [resource not found]
  409 - [conflict - e.g. duplicate]
  422 - [unprocessable entity - valid syntax, invalid semantics]
  500 - [internal error]
```

### Step 4: Apply consistency rules
Pick conventions and apply them everywhere:
- Naming: snake_case or camelCase for fields (pick one)
- Dates: ISO 8601 (`2026-03-03T14:30:00Z`)
- IDs: UUID or integer (pick one, apply everywhere)
- Pagination: cursor-based or page/limit (pick one)
- Errors: consistent error response shape `{ error: { code, message, details } }`

Inconsistency is the top complaint from API consumers.

### Step 5: Design for the caller's mental model
Ousterhout's information hiding principle: don't expose implementation artifacts.
- Don't expose database table names or internal IDs in API paths
- Don't return internal error codes that callers can't act on
- Don't require callers to make multiple requests for data they logically need together

### Step 6: Version the API
Every public API needs a versioning strategy before it ships:
- URL versioning: `/v1/users` (most common, most visible)
- Header versioning: `API-Version: 2026-01-01`
- Pick a strategy before v1 ships - changing it later breaks all callers

## Anti-Patterns

**1. Verbs in resource paths**
Bad: `POST /createUser`, `GET /getUserById`
Good: `POST /users`, `GET /users/{id}`

**2. Inconsistent error shapes**
Bad: Some endpoints return `{ error: "message" }`, others return `{ message: "error" }`.
Good: One error schema, applied everywhere.

**3. Leaking implementation details**
Bad: `/api/db/users_table/row/42`
Good: `/api/users/42`

**4. No versioning plan on day 1**
Bad: Ship v1 with no versioning, then break callers when you need to change the contract.
Good: Version from the first public release. Breaking changes require a new version.

## Quality Checklist

- [ ] Resources are nouns, HTTP verbs are the actions
- [ ] Request and response contracts documented for every endpoint
- [ ] All error codes documented with when each occurs
- [ ] Naming convention consistent across all endpoints (snake_case or camelCase)
- [ ] Dates in ISO 8601, IDs consistent type throughout
- [ ] No implementation details exposed to callers
- [ ] Versioning strategy defined before first public release
- [ ] Pagination strategy defined and consistent

Attribution

qa-amanqa-aman
View sourceSee grades on GitHubMore from qa-aman →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

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 (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698461 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →