一键导入
metaboost-api-patterns
Common patterns for the Metaboost HTTP API (Express)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Common patterns for the Metaboost HTTP API (Express)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Canonical linear DB migrations under infra/k8s/base/ops/source/database/linear-migrations, ops bundles, env keys, and runners. Use when adding or changing SQL migrations, K8s DB bootstrap, or scripts/database in this repo.
When an E2E test verifies a specific element, pass it to the capture helper so the step screenshot is taken with that element vertically centered.
Create and use Metaboost git worktrees in sibling directories named metaboost_<branch_slug> (underscores). Use when starting feature work, moving WIP off the main checkout, or opening the correct worktree path for a branch.
Distributed tracing and OTLP export patterns. Use when adding trace context, log correlation, or Observability env — after Metaboost adopts a shared observability package.
When you finish a plan file in active/, automatically move it to completed/. If it's the last plan in its set, move the whole set. Use when completing any plan under .llm/plans/active/.
User vocabulary abcmemory and abcremember — where Cursor guidance lives and how to persist new instructions. Use when the user says abcmemory or abcremember.
| name | metaboost-api-patterns |
| description | Common patterns for the Metaboost HTTP API (Express) |
| version | 1.0.0 |
apps/api/When you add or change an API route, update these together:
import { Router, type Request, type Response } from 'express';
const router = Router();
router.get('/health', (_req: Request, res: Response): void => {
res.json({ status: 'ok', message: 'The server is running.' });
});
export default router;
lib/startup/validation.ts runs after loadEnv() and before importing config. It validates required env vars (e.g. API_PORT), logs results by category, and throws if any required are missing or invalid. WEB_BRAND_NAME is required only when ACCOUNT_SIGNUP_MODE uses email flows (with mailer vars), for transactional email copy. Pattern aligned with Podverse’s API startup validation.config/index.ts only after validation has passed..env.example for documented variables; non-empty values in .env use double quotes; empty/unset use no value after =..env files (including infra/config/local/*.env) must match the organization, section comments, and variable order of their authoritative .env.example; only values may differ. Generated files are filled by make local_env_setup (auto-generated secrets plus overrides from local override files when present). WEB_BRAND_NAME is set from dev/env-overrides/local/info.env (template contract workload info). See docs/development/env/LOCAL-ENV-OVERRIDES.md.Wrap async route handlers to avoid unhandled rejections (e.g. try/catch and pass errors to Express error middleware, or use a small asyncHandler wrapper).
validateBody(schema) middleware (Joi) on any route that accepts a JSON body. Validation runs before the controller; invalid requests get 400 with details and never reach the controller.CreateAdminBody for createAdminSchema). Use .default() in Joi so optional fields have a known shape after validation.apps/management-api: schemas in schemas/*.ts with exported body types, routes using validateBody(schema), controllers using the types and no redundant presence/type checks for validated fields.npm run dev – Build and run (from apps/api)npm run dev:api – From repo rootconfig.apiVersionPath), and clean-slate/requirements.