.claude/skills/add-api-endpoint/SKILL.md
Add a new REST API endpoint to the Express server. Use when creating routes for markets, strategies, signals, orders, trades, positions, risk, bankroll, AI, alerts, analytics, or backtest.
npx skillsauth add HadiAlizade77/poly add-api-endpointInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create endpoint: $ARGUMENTS[0] $ARGUMENTS[1] — $ARGUMENTS[2]
packages/backend/src/server.tspackages/backend/src/routes/{resource}.routes.tspackages/backend/src/controllers/{resource}.controller.tsRoute file ({resource}.routes.ts):
Controller ({resource}.controller.ts):
req.body / req.params / req.query{ success: true, data: ... } or { success: false, error: ... }audit_log tableZod schemas (in route or shared schemas):
Register route in packages/backend/src/routes/index.ts
Integration test in packages/backend/tests/integration/api/{resource}.test.ts:
// Success
{ success: true, data: T }
{ success: true, data: T[], pagination: { total, page, pageSize, totalPages } }
// Error
{ success: false, error: { code: string, message: string, details?: any } }
import { z } from 'zod';
const createSchema = z.object({
body: z.object({ /* fields */ }),
params: z.object({ id: z.string().uuid() }),
query: z.object({ page: z.coerce.number().optional() }),
});
development
Wire up a new WebSocket event channel between backend and frontend. Use when adding real-time events like price updates, order fills, alerts, regime changes, etc.
development
Validate risk governor checks and risk configuration changes. Use when modifying risk parameters, adding new risk checks, or reviewing risk logic.
development
Scaffold a new backend service/process for the Polymarket platform. Use when creating a new PM2-managed service like market-scanner, data-ingestion, strategy-runner, etc.
testing
Run tests for the Polymarket platform. Supports unit, integration, and E2E tests. Use after implementing features or fixing bugs.