一键导入
add-service
Add an application service for complex business logic shared across handlers. Use when logic is too complex for a single handler or is reused.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add an application service for complex business logic shared across handlers. Use when logic is too complex for a single handler or is reused.
用 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-service |
| description | Add an application service for complex business logic shared across handlers. Use when logic is too complex for a single handler or is reused. |
| argument-hint | <domain> <service-name> |
Create an application-layer service for complex or reusable business logic.
$0 -- Domain name (e.g., auth, billing, notifications)$1 -- Service name (e.g., identity, payment, delivery)!find backend/app/rest/v1/services -name "*.py" -not -name "__init__.py" -not -name "__pycache__" 2>/dev/null | sort
Is this logic used by multiple handlers?
├── Yes -> Service
└── No
Is this logic complex enough to obscure the handler's intent?
├── Yes -> Service
└── No -> Keep it in the handler
File: backend/app/rest/v1/services/{name}.py
from dataclasses import dataclass
from backend.app.errors import AuthenticationRequiredError, ValidationFailedError
from backend.app.shared.ports.auth.password_hasher import PasswordHasher
from backend.domain.enums import IdentityProvider
from backend.app.shared.db.database import Database
@dataclass
class {Name}Service:
db: Database
password_hasher: PasswordHasher
async def verify_password(
self, provider: IdentityProvider, identifier: str, password: str
) -> Identity:
async with self.db:
identity = (
await self.db.gateway.identity.get_by_provider_and_identifier(
provider, identifier
)
).some(AuthenticationRequiredError(message="Invalid credentials"))
if not self.password_hasher.verify(password, identity.credential):
raise AuthenticationRequiredError(message="Invalid credentials")
return identity
File: backend/entry/rest/main/ioc.py
Add to an appropriate provider:
provider.provide({Name}Service, provides={Name}Service, scope=Scope.REQUEST)
@dataclass
class LoginHandler(Handler[LoginCommand, AuthContext[dtos.User], None], type_=HandlerType.WRITE):
db: Database
{name}_service: {Name}Service
async def __call__(self, cmd: LoginCommand, _ctx: None = None) -> AuthContext[dtos.User]:
identity = await self.{name}_service.verify_password(...)
...
Run just check.
@dataclass classes with DI-injected dependenciesbackend/app/rest/v1/services/infra/ implementationsDatabase context manager for transactionsScope.REQUEST in the DI container