api-lifecycle

A set of rules for designing and maintaining application programming interfaces, the defined ways that software communicates. It covers resource-based routes, repeated-request safety, pagination, versioning, deprecation, rate limits, and documentation.

In plain words
What is it for?
Use it when designing REST or GraphQL APIs, planning breaking changes, adding rate limits, documenting endpoints, or retiring old versions.
Why use it?
It gives teams consistent decisions for changing an API without unexpectedly breaking clients or creating unsafe, hard-to-use endpoints.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/doancan/mags/api-lifecycle
Any agent
npx skills add doancan/mags --skill api-lifecycle
Clone the repo
git clone --depth 1 https://github.com/doancan/mags

Made for: Claude Code, Codex.

Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,015 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00058 $0.03015
Opus 5 $0.00029 $0.01507
Sonnet 5 $0.00012 $0.00603
Haiku 4.5 $0.00006 $0.00301

Measured 2d ago against content hash 52d0939dbb5a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

api-lifecycle scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/api-lifecycle/SKILL.md · 203 lines

How it starts

The opening of the file, as written. The whole thing — 203 lines — stays where its author put it; the contents beside it link to each section on GitHub.

API Lifecycle

API Design Principles

  • Resource-oriented design: Model APIs around resources (nouns), not actions (verbs). Use GET /orders/123 not GET /getOrder?id=123. Nest sub-resources logically: GET /users/123/orders. Keep nesting to a maximum of two levels.
  • Idempotency: GET, PUT, and DELETE must be idempotent. Repeated calls produce the same result. For POST (create) operations, support client-provided idempotency keys (Idempotency-Key header) to prevent duplicate resource creation on retries.
  • Stateless requests: Every request must contain all information needed to process it. Do not store client session state on the server between requests. Use tokens (JWT, opaque) for authentication context.
  • Pagination: Always paginate list endpoints. Choose the appropriate strategy:
    • Cursor-based (recommended): Use an opaque cursor token. Best for real-time data, large datasets, and when items can be inserted/deleted between pages. Return next_cursor in the response.
    • Offset-based: Use ?offset=20&limit=10. Simpler to implement but has consistency issues with changing datasets. Acceptable for admin UIs and static data.
    • Always include total_count (or indicate if more pages exist), next link, and the current page size in the response.
  • Consistent naming: Use snake_case for JSON fields (created_at, not createdAt). Use plural nouns for collection endpoints (/users, not /user). Use kebab-case for URL paths (/order-items, not /orderItems). Be consistent across the entire API.
  • HTTP methods and status codes: Use methods correctly: GET (read), POST (create), PUT (full replace), PATCH (partial update), DELETE (remove). Return appropriate status codes: 200 (success), 201 (created), 204 (no content), 400 (bad request), 401 (unauthorized), 403 (forbidden), 404 (not found), 409 (conflict), 422 (unprocessable entity), 429 (rate limited), 500 (server error).

Versioning Strategies

Strategy Format Pros Cons Best For
URL path /v1/users, /v2/users Explicit, easy to route, easy to document, cacheable URL pollution, clients must update all URLs Public APIs, APIs with infrequent breaking changes
Header Accept: application/vnd.api+json;version=2 Clean URLs, version is metadata not resource identity Harder to test in browser, less discoverable Internal APIs, APIs with frequent version changes
Query parameter /users?version=2 Easy to add, backward-compatible Breaks caching, pollutes query string, easy to forget Quick prototyping, transitional use only

Read the full file on GitHub · 203 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 203 lines · 58 tokens per session scan A 52d0939dbb5a

Subscribe to this mod's changes

api-lifecycle is a skill published in the GitHub repository doancan/mags (3 stars, last pushed 6mo ago), licensed MIT. It adds 58 tokens to every session and 3,015 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

agent-host-chat-contributions

Build and review cross-cutting agent-host chat behavior through lifecycle contributions. Use when adding turn lifecycle side effects, prompt or context injection, restored-history transformation, protocol-action observation, or when reviewing changes that add code to AgentSideEffects or AgentService.

microsoft/vscode · 56 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens