with one click
api-route
Generate API route handlers for Express or Analog.js
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Generate API route handlers for Express or Analog.js
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
| name | api-route |
| description | Generate API route handlers for Express or Analog.js |
| argument-hint | <framework> <route-name> |
Create API route handlers for either Express (Angular SSR) or Analog.js.
Create handler in apps/cms-admin/src/api/<route-name>.ts:
import { Router, Request, Response } from 'express';
import type { CollectionConfig } from '@momentumcms/core';
export function create<PascalName>Routes(collections: CollectionConfig[]): Router {
const router = Router();
router.get('/<route-name>', async (req: Request, res: Response) => {
try {
// Implementation
res.json({ success: true });
} catch (error) {
res.status(500).json({ error: 'Internal server error' });
}
});
return router;
}
Register in apps/cms-admin/src/server.ts:
import { create<PascalName>Routes } from './api/<route-name>';
app.use('/api', create<PascalName>Routes(collections));
Create file-based route in src/server/routes/api/<route-name>.get.ts:
import { defineEventHandler, getQuery } from 'h3';
export default defineEventHandler(async (event) => {
const query = getQuery(event);
try {
// Implementation
return { success: true };
} catch (error) {
throw createError({
statusCode: 500,
statusMessage: 'Internal server error',
});
}
});
index.get.ts - GET requestindex.post.ts - POST request[id].get.ts - GET with dynamic param[id].patch.ts - PATCH with dynamic param[id].delete.ts - DELETE with dynamic param[...].ts - Catch-all routeimport {
defineEventHandler,
getQuery,
readBody,
getRouterParam,
createError,
setResponseStatus,
} from 'h3';
Adversarial review checklist for stateful Momentum CMS features (workflow, versions, scheduled publish, permissions inheritance, branches, anything that adds writeable state + access control). Use BEFORE merging a feature that introduces new mutating routes, new system-managed columns, new access functions, or new audit trails. Trigger phrases include "red-team this", "adversarial review", "security review of <feature>", "before merging <feature>", "/cms-feature-red-team".
Set up the Momentum CMS MCP server plugin and generate Claude Code MCP config for AI tool integration. Use when connecting Claude Code (or any MCP client) to a Momentum CMS instance.
Generate a new Momentum CMS collection with fields, access control, and hooks
Generate an Angular component with signals, OnPush, and host-based styling following Momentum CMS conventions. Use when creating new UI components in any library.
Write and validate Playwright E2E tests for Momentum CMS features. UI tests ALWAYS start from /admin dashboard and navigate via sidebar/dashboard — never go directly to deep URLs. Always starts the server and inspects the actual UI before writing assertions. Triggers include "write e2e tests for...", "add e2e tests", "test the admin UI for...", or "/e2e-test <feature>".
Run migrations, generate schemas, and manage code generation for Momentum CMS. Use when working with database migrations, Drizzle schema generation, type generation, or Angular schematics.