一键导入
new-route
Scaffold an HTTP API route in app/routes on the Elysia server. Use when asked to add an HTTP endpoint, REST route, or webhook receiver.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scaffold an HTTP API route in app/routes on the Elysia server. Use when asked to add an HTTP endpoint, REST route, or webhook receiver.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Scaffold a new slash command in app/commands. Use when asked to add or create a slash command, a subcommand, or an autocomplete option.
Scaffold a persistent button, modal, or select-menu handler in app/components. Use when asked to handle a component interaction by customId.
Scaffold a right-click context-menu command (on a user or message) in app/context. Use when asked to add a context-menu or right-click command.
Scaffold a gateway event handler in app/events. Use when asked to react to a Discord event like GuildMemberAdd, MessageCreate, or Ready.
Scaffold a new text (prefix) command in app/prefixes, e.g. ".ping". Use when asked to add a message-based or prefix command.
Scaffold a scheduled task (cron or interval) in app/tasks. Use when asked to run something periodically, on a timer, or on a schedule.
| name | new-route |
| description | Scaffold an HTTP API route in app/routes on the Elysia server. Use when asked to add an HTTP endpoint, REST route, or webhook receiver. |
.agents/context.md (HTTP routes section) if not already loaded.app/routes/<name>.ts. The URL comes from @Route(pattern), not the file path: [id] is a dynamic segment, [...path] a catch-all.BaseRoute with one async method per HTTP verb (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS).import { Route, BaseRoute, RouteContext, RouteSchemas, z } from "engine";
@Route("/guilds/[id]")
export default class GuildInfo extends BaseRoute {
schema: RouteSchemas = {
GET: { params: z.object({ id: z.string().regex(/^\d+$/) }) },
};
async GET({ params, set }: RouteContext<{ id: string }>) {
const guild = this.client.guilds.cache.get(params.id);
if (guild === undefined) {
set.status = 404;
return { error: "Guild not found" };
}
return { id: guild.id, name: guild.name, members: guild.memberCount };
}
}
schema field per verb (body, query, params); the engine returns a structured 400 on failure. z is re-exported from "engine".config.server; never re-implement them in a route. Opt out per route with auth = false or rate_limit = false | { window, max } only when explicitly required.config.server.enabled is true, mounted under config.server.prefix. Do not stand up a second server or use express.Add or extend an integration test in tests/ driving the route with app.handle(new Request(...)) (see .agents/tests.md), then run bun test, bun run typecheck, and bun run lint.