一键导入
add-port
Add a new port (Protocol interface) and its adapter implementation with DI wiring. Use when adding external capabilities.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add a new port (Protocol interface) and its adapter implementation with DI wiring. Use when adding external capabilities.
用 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-port |
| description | Add a new port (Protocol interface) and its adapter implementation with DI wiring. Use when adding external capabilities. |
| argument-hint | <category> <port-name> |
Create a Protocol interface (port) and its concrete implementation (adapter).
$0 -- Port category (e.g., auth, security, storage, outreach, events)$1 -- Port name (e.g., sms_sender, payment_gateway, cache)!find backend/app/shared/ports -name "*.py" -not -name "__init__.py" -not -name "__pycache__" 2>/dev/null | sort
File: backend/app/shared/ports/{category}/{name}.py
from typing import Protocol
class {PortName}(Protocol):
async def send(self, *, to: str, message: str) -> None: ...
async def check_status(self, id_: str) -> str: ...
File: backend/infra/external/adapters/{name}.py (or backend/infra/security/{name}.py for security-related ports)
from typing import final
from backend.app.shared.ports.{category}.{name} import {PortName}
@final
class Impl{Detail}{PortName}({PortName}):
def __init__(self, client: {ServiceClient}, config: {ServiceConfig}) -> None:
self._client = client
self._config = config
async def send(self, *, to: str, message: str) -> None:
await self._client.send_message(to=to, body=message)
async def check_status(self, id_: str) -> str:
result = (await self._client.get_status(id_)).raise_()
return result.status
File: backend/entry/rest/main/ioc.py
Add to an existing provider or create a new one:
def create_{category}_provider(config: {ServiceConfig}) -> Provider:
provider = Provider(scope=Scope.APP)
provider.provide(lambda: config, provides={ServiceConfig})
# Create client factory if needed
provider.provide(_create_{service}_client, provides={ServiceClient})
# Bind adapter to port
provider.provide(Impl{Detail}{PortName}, provides={PortName})
return provider
Add the provider to create_container().
@dataclass
class SomeHandler(Handler[...]):
{port_name}: {PortName} # inject the port, not the adapter
async def __call__(self, cmd, _ctx=None):
await self.{port_name}.send(to=cmd.recipient, message=cmd.body)
Run just check.