nonlinear-xyz/factory-kit/factory-api-route-engineer
Claude Code and agent skill by nonlinear-xyz/factory-kit
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Use when designing or implementing API endpoints — server actions, tRPC procedures, REST routes for external consumers. Carries the factory's API conventions — the server actions vs tRPC decision, procedure tier stacking, per-mutation Zod schemas, central router composition with manual registration, pagination (limit/offset/orderBy default; cursor only when needed), multi-field search via `ilike` + `or()`, aggregated stats in list queries, mutation lifecycle hooks, stale-time defaults, custom e…
Install
npx vskill@latest install nonlinear-xyz/factory-kit/factory-api-route-engineerSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as nonlinear-xyz/factory-kit/factory-api-route-engineer.
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)
- 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.
- What's the surface?
- Mutation — create, update, delete, custom action
- Query — list (paginated), detail (by ID), search, aggregation
- Webhook — external system → your service
- 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)
- 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
- Output shape? Three options:
- List:
{ items: T[], total?: number }— includetotalif pagination needs it - Detail:
T | null— return null on not-found, throwNotFoundErrorif the caller expected it - Mutation: the updated/created entity, or
ActionResult<T>for server actions
- Multi-tenant filter? Every query / mutation in
orgProcedurefilters byctx.orgId. This is automatic enforcement, not "remember to add WHERE."
- 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)
- 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:
``ts ctx.db.select({ ...getTableColumns(customers), vehicleCount: count(vehicles.id), }).from(customers).leftJoin(vehicles, ...).groupBy(customers.id); ``
- Error shape?
- Throw
AuthError,NotFoundError,ValidationErrorfromsrc/lib/errors.ts - For server actions, catch at the boundary and convert to
{ error: 'message' } - For tRPC, throw
TRPCError({ code, message })
- Audit log? Fire-and-forget at the mutation boundary. Never
awaitit on the critical path. Seefactory-security.md.
Reference: canonical server action
Reference: canonical tRPC router
Output format
What you do NOT do
- Don't mix tRPC and server actions in the same project. Pick a side.
- Don't write per-route HTTP handlers when tRPC exists. Use the fetch adapter.
- Don't `UPDATE` or `DELETE` without `WHERE`. ESLint Drizzle rule from
factory-data-layer.md. - Don't await audit logs on the mutation critical path. Fire-and-forget.
- Don't reach for cursor pagination by default. Offset is fine for almost everything.
- Don't make every endpoint `publicProcedure`. Auth tier explicitly per endpoint.
- Don't return raw `Error` objects to the client. Convert at the boundary.
- Don't filter by an `orgId` from the request body. Always from session.
- Don't put per-mutation schemas in a separate file unless they're shared with the client form schemas.
When the request is too small for this framework
If the user asks to add a single field to an existing input schema or change one validation rule, do it directly. The framework is for new endpoints, new routers, or substantial API surface changes.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/factory-api-route-engineer/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/nonlinear-xyz/factory-kit/factory-api-route-engineer)