用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill fastapi-db-migrate命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | fastapi-db-migrate |
| description | > Use when this capability is needed. |
Automates Alembic migration creation and model import location updates.
Scope: New model creation with migration generation. For modifying existing models, manually edit the model file and run alembic revision --autogenerate. For stack-neutral migration support (Prisma, Knex, Django, etc.), use /db-migrate. After any migration, verify with /db-migrate-verify.
Note: The backend/ path is a convention. If your project uses a different layout, adjust paths accordingly.
Request: $ARGUMENTS
| Mode | Trigger | Behavior |
|---|---|---|
| new-model | Model name provided | Create model file + update import locations + generate migration |
| migrate | "run" or "migrate" | Run alembic upgrade head |
| status | "status" | Show current migration status |
| check | "check" | Verify all import locations are in sync |
Create backend/app/models/{model_name_snake}.py following existing patterns:
from sqlalchemy import Column, String, DateTime, ForeignKey, func
from sqlalchemy.dialects.postgresql UUID
app.db.base Base
uuid
():
__tablename__ =
= Column(UUID(as_uuid=), primary_key=, default=uuid.uuid4)
created_at = Column(DateTime(timezone=), server_default=func.now())
updated_at = Column(DateTime(timezone=), server_default=func.now(), onupdate=func.now())
Find all locations where models are imported and add the new one:
cd backend && grep -rn "from app.models" app/db/ app/models/__init__.py tests/conftest.py
Update each location to include the new model import.
cd backend && alembic revision --autogenerate -m "add {model_name} table"
cd backend && alembic upgrade head
cd backend && PYTHONPATH=. python -c "from app.models import *; print('All imports OK')"
Verify all model imports are in sync across required locations:
ls backend/app/models/*.py | grep -v __init__ | grep -v __pycache__
backend/app/models/__init__.pybackend/app/db/base.py (or equivalent base import file)backend/tests/conftest.py (if test fixtures reference models)Import Sync Check:
- model_name.py: ✓ __init__.py | ✓ base.py | ✗ conftest.py (MISSING)
cd backend && alembic current && alembic history --verbose | head -20
Report current head, pending migrations, and any branch divergence.
After any mode, report:
Migration Summary:
Mode: <new-model|migrate|status|check>
Model: <name or N/A>
Files changed: <list>
Migration: <generated|applied|checked|N/A>
Import sync: <all OK|N mismatches>
/db-migrate-verify if availableSource: abhayla/claude-best-practices — distributed by TomeVault.