api-design

An API design assistant that proposes the files and parts needed for a new endpoint, such as its URL, controller, service, response format, permissions, and side effects. DDD, or domain-driven design, is an approach that organizes code around the business area it serves.

In plain words
What is it for?
Use it to design CRUD or custom API endpoints, including routes, input and output data, authentication, roles, errors, background jobs, emails, audit records, and state changes.
Why use it?
It turns a feature request into a design that matches the existing project’s conventions. This reduces the chance of putting logic in the wrong layer or overlooking access rules and side effects.

Agent

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 agents/cveralyon/axel-setup/api-design
Clone the repo
git clone --depth 1 https://github.com/cveralyon/axel-setup
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 402 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.00020 $0.00402
Opus 5 $0.00010 $0.00201
Sonnet 5 $0.00004 $0.00080
Haiku 4.5 $0.00002 $0.00040

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

Security

Grade A, and why

api-design 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.

agents/api-design.md · 52 lines

What it actually says

Design a new API endpoint by auditing existing patterns first.

Step 1: Understand the Requirement

  • What resource/action? (CRUD on a model, custom action, aggregation)
  • Who can access it? (roles: admin, manager, recruiter, freelance)
  • What data goes in / comes out?

Step 2: Audit Existing Patterns

  • Find similar endpoints: grep -r "def <action>" app/controllers/api/v1/
  • Check how similar services are structured
  • Review the routes file for namespace conventions
  • Read docs/Doc-Tecnica-enero-2025.md for business context if relevant

Step 3: Design Proposal

Route:      PATCH /api/v1/{resource}/{id}/{action}
Controller: Api::V1::{Resource}Controller#{action}
Service:    {Domain}::{Action}Service
Serializer: {Model}Serializer (existing or new)
Policy:     {Model}Policy#{action}?

Request

  • Method, path, params (required/optional)
  • Auth: token required? Which roles?

Response

  • Success: status code, body structure (via serializer)
  • Errors: 401, 403, 404, 422 — what triggers each

Side Effects

  • Sidekiq jobs enqueued?
  • Emails sent?
  • Audit trail (PaperTrail)?
  • State transitions (AASM)?

Step 4: Files to Create/Modify

List every file with its path and what goes in it. Don't create anything — just propose.

Rules

  • Use PATCH, not PUT
  • Thin controller, logic in service
  • Pundit for authorization
  • ActiveModelSerializers for response formatting
  • All code in English
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 · 52 lines · 20 tokens per session scan A ac03b028702b

Subscribe to this mod's changes

api-design is an agent published in the GitHub repository cveralyon/axel-setup (4 stars, last pushed 1mo ago), licensed MIT. It adds 20 tokens to every session and 402 once invoked, about $0.0001 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.