一键导入
add-handler
Add a new command and handler for a use case. Use when adding business logic for an existing entity.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add a new command and handler for a use case. Use when adding business logic for an existing entity.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Add a complete REST endpoint from command to controller route. Use when building new API endpoints.
Summarize the API interface changes made during THIS session for the frontend, then optionally spawn an agent to implement them in the frontend repo. Use after changing endpoints, request/response DTOs, or auth.
One-shot guided session — prunes unused code, scaffolds new entities/endpoints, updates project identity config, and replaces the init migration for a specific project.
Compress natural language memory files (CLAUDE.md, todos, preferences) into caveman format to save input tokens. Preserves all technical substance, code, URLs, and structure. Compressed version overwrites the original file. Human-readable backup saved as FILE.original.md. Trigger: /caveman-compress FILEPATH or "compress memory file"
Implement a change with a pipeline scaled to its complexity. Single entry point for all code changes — auto-detects effort or accepts small|mid|tuff override.
Run a Linear task end-to-end — creates an isolated tmux session + worktree, starts a Claude agent to implement it, opens a PR, and watches for review feedback automatically.
| name | add-handler |
| description | Add a new command and handler for a use case. Use when adding business logic for an existing entity. |
| argument-hint | <domain> <action> |
Create a Command + Handler pair for a use case.
$0 -- Domain name (e.g., users, auth, invoices)$1 -- Action name (e.g., create, archive, send, verify)!find backend/app/rest/v1/handlers -name "*.py" -not -name "__init__.py" -not -name "__pycache__" -not -path "*/base/*" 2>/dev/null | sort
File: backend/app/rest/v1/handlers/{domain}/{action}.py
from dataclasses import dataclass
from uuid import UUID
from backend.app.errors import NotFoundError
from backend.app.rest.v1 import dtos
from backend.app.rest.v1.handlers.base import Command, Handler, HandlerType
from backend.app.shared.db.database import Database
class {Action}{Entity}Command(Command):
{entity}_id: UUID
@dataclass
class {Action}{Entity}Handler(
Handler[{Action}{Entity}Command, dtos.{Entity}, None],
type_=HandlerType.WRITE,
):
db: Database
async def __call__(
self, cmd: {Action}{Entity}Command, _ctx: None = None
) -> dtos.{Entity}:
async with self.db:
entity = (await self.db.gateway.{entity}.get_by_id(cmd.{entity}_id)).some(
NotFoundError(message="{Entity} not found")
)
# ... business logic ...
entity = (await self.db.gateway.{entity}.update(entity)).some(
NotFoundError(message="{Entity} not found")
)
await self.db.commit()
return dtos.{Entity}.from_object(entity)
@dataclass
class SendInvoiceHandler(
Handler[SendInvoiceCommand, None, None],
type_=HandlerType.WRITE,
):
db: Database
dbus: DBus
email_sender: EmailSender # Port, not implementation
async def __call__(self, cmd: SendInvoiceCommand, _ctx: None = None) -> None:
async with self.db:
invoice = (await self.db.gateway.invoice.get_by_id(cmd.invoice_id)).some(
NotFoundError(message="Invoice not found")
)
# business logic
await self.dbus.publish(InvoiceSent(invoice_id=invoice.id))
await self.db.commit()
File: backend/app/rest/v1/handlers/{domain}/__init__.py
Add command and handler to imports and __all__.
If this is a new domain, create:
backend/app/rest/v1/handlers/{domain}/__init__.pybackend/app/rest/v1/handlers/__init__.pyRun just check. Handlers auto-register via __init_subclass__ and are auto-wired by create_handlers_provider() in ioc.py.