一键导入
add-entity
Add a new domain entity with SQLAlchemy mixins and generate an Alembic migration. Use when defining new database tables.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add a new domain entity with SQLAlchemy mixins and generate an Alembic migration. Use when defining new database tables.
用 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-entity |
| description | Add a new domain entity with SQLAlchemy mixins and generate an Alembic migration. Use when defining new database tables. |
| argument-hint | <entity-name> <fields-comma-separated> |
Create a new SQLAlchemy ORM model with appropriate mixins and generate a migration.
$0 -- Entity name in PascalCase (e.g., Invoice, Subscription)$1 -- Comma-separated fields (e.g., amount:int,currency:str,status:str,due_at:datetime)!find backend/domain/entities -name "*.py" -not -name "__init__.py" -not -name "__pycache__" -not -path "*/base/*" 2>/dev/null | sort
File: backend/domain/entities/{name}.py
from __future__ import annotations
from typing import TYPE_CHECKING
from sqlalchemy import String
from sqlalchemy.orm import Mapped, mapped_column
from .base import Base, WithActive, WithTenant, WithTime, WithUUIDID
if TYPE_CHECKING:
pass # relationship type imports here
class {Name}(WithUUIDID, WithActive, WithTime, WithTenant, Base):
# columns here
title: Mapped[str] = mapped_column(String(255), nullable=False)
Does it need a UUID primary key? -> WithUUIDID (almost always yes)
Does it need is_active flag? -> WithActive
Does it need created_at/updated_at? -> WithTime
Does it belong to a tenant? -> WithTenant
Mixin order: WithUUIDID, WithActive, WithTime, WithTenant, Base
| Python Type | SQLAlchemy | Notes |
|---|---|---|
str | String or String(N) | Use String(N) for bounded length |
int | Integer | |
float | Float | |
bool | Boolean | |
datetime | DateTime(timezone=True) | Always use timezone=True |
UUID | Uuid (from sqlalchemy) | For foreign keys |
str | None | String, nullable=True | Mapped[str | None] |
if TYPE_CHECKING:
from .user import User
class Invoice(WithUUIDID, WithActive, WithTime, WithTenant, Base):
user_id: Mapped[UUID] = mapped_column(ForeignKey("user.id"), nullable=False)
user: Mapped[User] = relationship(lazy="raise")
File: backend/domain/entities/__init__.py
Add import of the new entity so Alembic picks it up.
just migration "add {name} table"
Read the generated file in backend/infra/database/alembic/migrations/versions/. Check for correct column types, indexes, and constraints.
just migrate
Run just check.