一键导入
create-handler
Create a new API handler following the handler pattern. Use when the user asks to create an endpoint, handler, or route.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create a new API handler following the handler pattern. Use when the user asks to create an endpoint, handler, or route.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generate a mock API server from OpenAPI specs, TypeScript interfaces, or endpoint descriptions for frontend development and testing. Use when the user asks to create a mock server, fake API, or stub endpoints.
Map and visualize module dependencies, detect circular imports, and identify coupling hotspots. Use when the user asks to analyze dependencies, find circular imports, or understand module relationships.
Generate typed error classes, error handling middleware, and HTTP error mapping following project conventions. Use when the user asks to set up error handling, create error classes, or implement error middleware.
Create, manage, and clean up feature flags for gradual rollouts and safe deployments. Use when the user asks to add a feature flag, toggle, or manage feature gating.
Generate docker-compose.yml files for local development with application services, databases, caches, and queues. Use when the user asks to set up a local dev environment or create docker-compose configuration.
Generate OpenSearch Dashboards (Kibana) saved objects — index patterns, visualizations, and dashboards as JSON. Use when the user asks to create dashboards, charts, or visualizations for OpenSearch/Elasticsearch/Kibana.
| name | create-handler |
| description | Create a new API handler following the handler pattern. Use when the user asks to create an endpoint, handler, or route. |
Step-by-step workflow for creating a new API handler following the {{CONFIG.patterns.handlerFlowSteps}}-step handler pattern.
This skill includes a scripts/ folder. The agent can run these scripts as part of the workflow:
./scripts/scaffold-handler-dirs.sh <entity> <operation> (e.g. order create).When the user asks to create a new API endpoint, handler, or route.
{{CONFIG.paths.handlerBasePath}} exists)mkdir -p {{CONFIG.paths.handlerBasePath}}/{entity}/{operation}/logic
mkdir -p {{CONFIG.paths.handlerBasePath}}/{entity}/{operation}/schemas
Expected structure:
{{CONFIG.paths.handlerBasePath}}/{entity}/{operation}/
├── {{CONFIG.fileNames.handlerEntry}}
├── logic/
│ ├── validate-request.ts
│ ├── validate-business.ts
│ ├── pre-processing.ts
│ ├── operation.ts
│ ├── post-operation.ts
│ └── response.ts
└── schemas/
├── {{CONFIG.fileNames.requestSchema}}
└── {{CONFIG.fileNames.responseSchema}}
schemas/{{CONFIG.fileNames.requestSchema}}schemas/{{CONFIG.fileNames.responseSchema}}{ data, meta }For each file in logic/:
validate-request.ts — Validate request against schemavalidate-business.ts — Check business rules and entity statepre-processing.ts — Transform and enrich dataoperation.ts — Execute core business logicpost-operation.ts — Trigger side effects (events, notifications)response.ts — Format response with envelope{entity}/{operation}/__tests__/handler.test.ts{{CONFIG.testing.typeCheckCommand}}Handler is created, tested, and type-checked. Ready for code review.
{{CONFIG.paths.handlerBasePath}} exists. Run mkdir -p from project root.{{CONFIG.paths.commonPath}} and handler structure.{{CONFIG.testing.typeCheckCommand}} first. Fix type errors before test logic.