KS
Killer-Skills

add-router — Categories.community

v1.0.0
GitHub

About this Skill

Perfect for Full Stack Agents needing automated CRUD procedure generation for Next.js, React Native, Electron, and Hono.js applications. A mono repo for Next.js, React Native, Electron, and Hono.js with lots of bells and whistles.

corbanb corbanb
[0]
[0]
Updated: 2/23/2026

Quality Score

Top 5%
57
Excellent
Based on code quality & docs
Installation
SYS Universal Install (Auto-Detect)
Cursor IDE Windsurf IDE VS Code IDE
> npx killer-skills add corbanb/x4-mono/add-router

Agent Capability Analysis

The add-router MCP Server by corbanb is an open-source Categories.community integration for Claude and other AI agents, enabling seamless task automation and capability expansion.

Ideal Agent Persona

Perfect for Full Stack Agents needing automated CRUD procedure generation for Next.js, React Native, Electron, and Hono.js applications.

Core Value

Empowers agents to create new tRPC routers with OpenAPI meta and test files, streamlining API development with features like ownership checks and customizable auth levels, utilizing languages like TypeScript.

Capabilities Granted for add-router MCP Server

Generating tRPC routers for resource management
Automating CRUD procedure creation with OpenAPI documentation
Implementing ownership checks and auth levels for secure API endpoints

! Prerequisites & Limits

  • Requires mono repository setup with Next.js, React Native, Electron, or Hono.js
  • Limited to TypeScript and tRPC framework
Project
SKILL.md
4.3 KB
.cursorrules
1.2 KB
package.json
240 B
Ready
UTF-8

# Tags

[No tags]
SKILL.md
Readonly

Add Router Skill

Create a new tRPC router with CRUD procedures, OpenAPI meta, and test file for x4-mono.

Arguments

The user describes the resource. If unclear, ask for:

  • Resource name (singular, camelCase for router, e.g., comment)
  • Which procedures: list, get, create, update, delete (default: all)
  • Auth level: public, protected, or admin
  • Whether it needs ownership checks

File Locations

  • Router: apps/api/src/routers/{name}.ts
  • Registration: apps/api/src/routers/index.ts
  • Tests: apps/api/src/__tests__/{name}.test.ts
  • Schemas: packages/shared/utils/validators.ts (if not already there)

Router Template

Reference: apps/api/src/routers/projects.ts

typescript
1import { eq, sql } from 'drizzle-orm'; 2import { router, publicProcedure, protectedProcedure } from '../trpc'; 3import { Errors } from '../lib/errors'; 4import { tableName } from '@x4/database'; 5import { 6 CreateEntitySchema, 7 UpdateEntitySchema, 8 EntityResponseSchema, 9 EntityListResponseSchema, 10 IdParamSchema, 11 PaginationSchema, 12} from '@x4/shared/utils'; 13 14export const entityRouter = router({ 15 list: publicProcedure 16 .meta({ openapi: { method: 'GET', path: '/entities', tags: ['Entity'] } }) 17 .input(PaginationSchema) 18 .output(EntityListResponseSchema) 19 .query(async ({ ctx, input }) => { 20 const items = await ctx.db.select().from(tableName).limit(input.limit).offset(input.offset); 21 return { items, total: items.length, limit: input.limit, offset: input.offset }; 22 }), 23 24 get: publicProcedure 25 .meta({ openapi: { method: 'GET', path: '/entities/{id}', tags: ['Entity'] } }) 26 .input(IdParamSchema) 27 .output(EntityResponseSchema) 28 .query(async ({ ctx, input }) => { 29 const [record] = await ctx.db.select().from(tableName).where(eq(tableName.id, input.id)); 30 if (!record) throw Errors.notFound('Entity').toTRPCError(); 31 return record; 32 }), 33 34 create: protectedProcedure 35 .meta({ openapi: { method: 'POST', path: '/entities', tags: ['Entity'], protect: true } }) 36 .input(CreateEntitySchema) 37 .output(EntityResponseSchema) 38 .mutation(async ({ ctx, input }) => { 39 const [record] = await ctx.db 40 .insert(tableName) 41 .values({ ...input, ownerId: ctx.user.userId }) 42 .returning(); 43 return record; 44 }), 45 46 update: protectedProcedure 47 .meta({ openapi: { method: 'PATCH', path: '/entities/{id}', tags: ['Entity'], protect: true } }) 48 .input(UpdateEntitySchema) 49 .output(EntityResponseSchema) 50 .mutation(async ({ ctx, input }) => { 51 const { id, ...data } = input; 52 const [existing] = await ctx.db.select().from(tableName).where(eq(tableName.id, id)); 53 if (!existing) throw Errors.notFound('Entity').toTRPCError(); 54 if (existing.ownerId !== ctx.user.userId && ctx.user.role !== 'admin') { 55 throw Errors.forbidden('Not the owner').toTRPCError(); 56 } 57 const [updated] = await ctx.db 58 .update(tableName) 59 .set(data) 60 .where(eq(tableName.id, id)) 61 .returning(); 62 return updated; 63 }), 64 65 delete: protectedProcedure 66 .meta({ 67 openapi: { method: 'DELETE', path: '/entities/{id}', tags: ['Entity'], protect: true }, 68 }) 69 .input(IdParamSchema) 70 .output(z.object({ success: z.boolean() })) 71 .mutation(async ({ ctx, input }) => { 72 const [existing] = await ctx.db.select().from(tableName).where(eq(tableName.id, input.id)); 73 if (!existing) throw Errors.notFound('Entity').toTRPCError(); 74 if (existing.ownerId !== ctx.user.userId && ctx.user.role !== 'admin') { 75 throw Errors.forbidden('Not the owner').toTRPCError(); 76 } 77 await ctx.db.delete(tableName).where(eq(tableName.id, input.id)); 78 return { success: true }; 79 }), 80});

Registration

Add to apps/api/src/routers/index.ts:

typescript
1import { entityRouter } from './entity'; 2 3export const appRouter = router({ 4 // ... existing routers 5 entity: entityRouter, 6});

Workflow

  1. Ensure Zod schemas exist (use /add-schema first if needed)
  2. Ensure database table exists (use /add-table first if needed)
  3. Create router file at apps/api/src/routers/{name}.ts
  4. Register in apps/api/src/routers/index.ts
  5. Run bun turbo type-check to verify AppRouter updates
  6. Create test file at apps/api/src/__tests__/{name}.test.ts (use /add-test or bun-test-gen)
  7. Run bun test --cwd apps/api to verify

Related Skills

Looking for an alternative to add-router or building a Categories.community AI Agent? Explore these related open-source MCP Servers.

View All

widget-generator

Logo of f
f

widget-generator is an open-source AI agent skill for creating widget plugins that are injected into prompt feeds on prompts.chat. It supports two rendering modes: standard prompt widgets using default PromptCard styling and custom render widgets built as full React components.

149.6k
0
Design

chat-sdk

Logo of lobehub
lobehub

chat-sdk is a unified TypeScript SDK for building chat bots across multiple platforms, providing a single interface for deploying bot logic.

73.0k
0
Communication

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
Communication

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
Communication