Agent Skillsstella/stella › new-handler

new-handler

GitHub

根据 Stella 规范,依据参数生成 Elysia API 处理器。解析资源名与操作,参照现有结构创建目录文件,包含验证、鉴权及 ORM 逻辑,注册路由并运行检查测试。

.agents/skills/new-handler/SKILL.md stella/stella

Trigger Scenarios

需要创建新的 Elysia API 处理器 根据资源名称和操作生成标准 API 代码 遵循 Stella 规范进行后端路由开发

Install

npx skills add stella/stella --skill new-handler -g -y
More Options

Non-standard path

npx skills add https://github.com/stella/stella/tree/main/.agents/skills/new-handler -g -y

Use without installing

npx skills use stella/stella@new-handler

指定 Agent (Claude Code)

npx skills add stella/stella --skill new-handler -a claude-code -g -y

安装 repo 全部 skill

npx skills add stella/stella --all -g -y

预览 repo 内 skill

npx skills add stella/stella --list

SKILL.md

Frontmatter
{
    "name": "new-handler",
    "description": "Scaffold a new Elysia API handler following Stella's conventions."
}

New Handler

Scaffold a new Elysia API handler following Stella's conventions.

Arguments

$ARGUMENTS — The resource name and operations, e.g. "matters CRUD" or "invoices list,create".

Instructions

  1. Parse the arguments to determine:

    • Resource name (singular, e.g. matter, invoice, document)
    • Operations needed (create, read, update, delete—use -by-id for singular-item actions, e.g. read-by-id, update-by-id, delete-by-id; or "CRUD" for all)
  2. Read existing handlers to understand patterns:

    ls apps/api/src/handlers/
    

    Pick one handler directory and read its structure as a reference.

  3. Create the handler directory and files at apps/api/src/handlers/{resource}/:

    • index.ts — Elysia plugin exporting all routes
    • One file per operation (e.g., create.ts, read.ts, read-by-id.ts, update-by-id.ts, delete-by-id.ts)
  4. Each handler must include:

    • Input validation with Zod/Valibot schema
    • Authentication check
    • Workspace ownership verification (where applicable)
    • Drizzle ORM for database access
    • Proper error responses (not generic 500s)
  5. Follow these patterns:

    • Route prefix: /{resources} (plural)
    • GET /:id for single resource
    • GET / for list (with query params for filtering)
    • POST / for create
    • PATCH /:id for update
    • DELETE /:id for delete
    • Return consistent response shapes
  6. Register the handler in apps/api/src/index.ts:

    Add the import and .use() call following the existing pattern.

  7. Add tests for functions that transform the data inside the route handler if they are complex enough. Do not add tests for database queries, Elysia route handlers, or macros.

  8. Run checks:

    bun run typecheck && bun run lint && bun run test
    

Version History

  • 85792bd Current 2026-07-24 16:11

Same Skill Collection

.agents/skills/click-around/SKILL.md
.agents/skills/conventions-ai/SKILL.md
.agents/skills/conventions-db/SKILL.md
.agents/skills/conventions-i18n/SKILL.md
.agents/skills/conventions-ingestion/SKILL.md
.agents/skills/conventions-perf/SKILL.md
.agents/skills/conventions-scale/SKILL.md
.agents/skills/conventions-security/SKILL.md
.agents/skills/conventions-use-effect/SKILL.md
.agents/skills/conventions-ux/SKILL.md
.agents/skills/dev/SKILL.md
.agents/skills/finish-pr/SKILL.md
.agents/skills/open-pr/SKILL.md
.agents/skills/plan/SKILL.md
.agents/skills/product-deep-think/SKILL.md
.agents/skills/product-think/SKILL.md
.agents/skills/rabbit-round/SKILL.md
.agents/skills/regression-hunt/SKILL.md
.agents/skills/security-audit/SKILL.md
.agents/skills/update-deps/SKILL.md
.ai/local-skills/click-around/SKILL.md
.ai/local-skills/conventions-ai/SKILL.md
.ai/local-skills/conventions-db/SKILL.md
.ai/local-skills/conventions-i18n/SKILL.md
.ai/local-skills/conventions-ingestion/SKILL.md
.ai/local-skills/conventions-perf/SKILL.md
.ai/local-skills/conventions-scale/SKILL.md
.ai/local-skills/conventions-security/SKILL.md
.ai/local-skills/conventions-use-effect/SKILL.md
.ai/local-skills/conventions-ux/SKILL.md
.ai/local-skills/dev/SKILL.md
.ai/local-skills/new-handler/SKILL.md
.ai/local-skills/open-pr/SKILL.md
.ai/local-skills/plan/SKILL.md
.ai/local-skills/product-deep-think/SKILL.md
.ai/local-skills/rabbit-round/SKILL.md
.ai/local-skills/security-audit/SKILL.md
.ai/local-skills/update-deps/SKILL.md
packages/cli/skills/stella-cli/SKILL.md
packages/skills/blueprints/answer-from-sources/SKILL.md
packages/skills/blueprints/blank/SKILL.md
packages/skills/blueprints/check-against-rules/SKILL.md
packages/skills/blueprints/intake-to-draft/SKILL.md
.agents/skills/conventions-testing/SKILL.md
.ai/local-skills/conventions-testing/SKILL.md

Metadata

Files
0
Version
85792bd
Hash
bb05da42
Indexed
2026-07-24 16:11

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 20:11
浙ICP备14020137号-1 $mapa de visitantes$