一键导入
new-route
Scaffold a new Express API route with validation, auth middleware, test, and server.js registration
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scaffold a new Express API route with validation, auth middleware, test, and server.js registration
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Run the universal button emulator simulator with preset scenarios for testing elevator integration logic
Pre-flight validation checklist before deploying Accelerate Robotics to production
Preview a SQLite schema change and its impact before applying it to a production database
| name | new-route |
| description | Scaffold a new Express API route with validation, auth middleware, test, and server.js registration |
User says something like "add a /api/<thing> endpoint" or "I need a new route for X."
/api/reportsIf the user hasn't specified, ask before scaffolding.
Read existing routes — src/routes/inquiries.js is the canonical example for a route that handles both public and admin methods with validation and rate limiting.
Create the route file at src/routes/<name>.js:
const express = require('express') + routerdb from ../db/database if neededrequireAuth from ../middleware/auth for admin routesRegister in src/server.js:
const reportRoutes = require('./routes/reports');
app.use('/api/reports', reportRoutes);
Place near the other app.use('/api/...') calls.
If rate-limited, wrap the public verbs only — see how inquiries handles POST-only rate limiting.
If the route writes to the DB and needs a new table, update src/db/database.js and docs/20-architecture/database-schema.md. Follow .claude/rules/database-migrations.md.
Write tests in tests/integration/<name>.test.js:
Run tests — they must pass before committing.
Update docs — add the new endpoint to docs/20-architecture/api-reference.md.
Wiring verification — follow .claude/rules/wiring-verification.md. Actually hit the endpoint with curl or the browser, not just "it compiles."
server.js — the file exists but is unreachable/api/... that's not rate-limited even though it's public-facingescapeHtml()