factory-api-route-engineer

factory-api-route-engineer is a skill for Claude Code, Codex from nonlinear-xyz/factory-kit. It costs 130 tokens per session (1,936 once invoked), scanned A, original, MIT.

A specialist guide for designing and implementing API endpoints, which are program interfaces that let applications request or change data.

In plain words
What is it for?
Use it to build server actions, typed remote procedures, REST endpoints, queries, mutations, and webhooks according to the project’s existing conventions.
Why use it?
It helps choose a suitable API style and apply consistent rules for authentication, validation, pagination, and routing.

Skill for Claude CodeCodex

Part of the factory-kit plugin — 37 skills, 8 commands, 12 agents, 1 MCP server shipped together

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/nonlinear-xyz/factory-kit/factory-api-route-engineer
Any agent
npx skills add nonlinear-xyz/factory-kit --skill factory-api-route-engineer
Clone the repo
git clone --depth 1 https://github.com/nonlinear-xyz/factory-kit

Made for: Claude Code, Codex.

Or install factory-kit, the plugin that ships this one along with the rest of its 37 skills, 8 commands, 12 agents, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for factory-api-route-engineer

README.md
[![agentmods](https://agentmods.dev/badge/skills/nonlinear-xyz/factory-kit/factory-api-route-engineer.svg)](https://agentmods.dev/skills/nonlinear-xyz/factory-kit/factory-api-route-engineer)
Your own site
<a href="https://agentmods.dev/skills/nonlinear-xyz/factory-kit/factory-api-route-engineer"><img src="https://agentmods.dev/badge/skills/nonlinear-xyz/factory-kit/factory-api-route-engineer.svg" alt="Measured on agentmods" height="20"></a>
Per session 130 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,936 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.00130 $0.01936
Opus 5 $0.00065 $0.00968
Sonnet 5 $0.00026 $0.00387
Haiku 4.5 $0.00013 $0.00194

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

Security

Grade A, and why

factory-api-route-engineer 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 5d 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/factory-api-route-engineer/SKILL.md · 182 lines

How it starts

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

Apply the api-route-engineer specialist workflow. Build endpoints grounded in the factory's API conventions, not bespoke per-route handlers. Load the canonical factory-api and factory-auth skills through the host's skill capability when needed.

How to think (in order)

  1. API style? Apply the decision matrix from factory-api.md:

    • Server actions — default. One frontend consumer. Feature-folder colocation matters.
    • tRPC — ≥3 entities with cross-feature queries. Multiple consumers. Typed RPC.
    • REST / OpenAPI — only for external system callers.

    If the project already commits to one, use it. Don't mix.

  2. What's the surface?

    • Mutation — create, update, delete, custom action
    • Query — list (paginated), detail (by ID), search, aggregation
    • Webhook — external system → your service
  3. Auth tier?

    • publicProcedure — only for genuinely public endpoints (signup, public docs)
    • protectedProcedure — authed user, no org context
    • orgProcedure — authed user + org context (default for app endpoints)
  4. Input shape? Per-endpoint Zod schema. For paginated lists:

    • limit: number().int().min(1).max(100).default(50)
    • offset: number().int().min(0).default(0)
    • orderBy: enum([...]).default('createdAt')
    • orderDir: enum(['asc','desc']).default('desc')
    • Plus per-feature filter object
  5. Output shape? Three options:

    • List: { items: T[], total?: number } — include total if pagination needs it
    • Detail: T | null — return null on not-found, throw NotFoundError if the caller expected it
    • Mutation: the updated/created entity, or ActionResult<T> for server actions
  6. Multi-tenant filter? Every query / mutation in orgProcedure filters by ctx.orgId. This is automatic enforcement, not "remember to add WHERE."

  7. Pagination shape?

    • Offset — default for everything (admin tables, settings, normal CRUD)
    • Cursor — only for real-time feeds, append-only logs, or pagination-stable-under-inserts requirements (chat messages, audit log)
  8. Aggregations in list? If the list view needs counts (e.g. "customer with vehicle count"), use a subquery / leftJoin + groupBy rather than a per-row round-trip:

    ctx.db.select({
      ...getTableColumns(customers),
      vehicleCount: count(vehicles.id),
    }).from(customers).leftJoin(vehicles, ...).groupBy(customers.id);
    
  9. Error shape?

    • Throw AuthError, NotFoundError, ValidationError from src/lib/errors.ts
    • For server actions, catch at the boundary and convert to { error: 'message' }
    • For tRPC, throw TRPCError({ code, message })
  10. Audit log? Fire-and-forget at the mutation boundary. Never await it on the critical path. See factory-security.md.

Read the full file on GitHub · 182 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. 5d ago First seen · 182 lines · 130 tokens per session scan A 7011bc0542b5

Subscribe to this mod's changes

factory-api-route-engineer is a skill published in the GitHub repository nonlinear-xyz/factory-kit (9 stars, last pushed 1mo ago), licensed MIT. It adds 130 tokens to every session and 1,936 once invoked, about $0.0006 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