Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

tortoise-dev

БесплатноБез исполняемых скриптовНе проверен

Use when the user asks to "create a tortoise model", "new tortoise project", "tortoise orm", "async orm", "aerich migration", "fastapi tortoise", "tortoise…

sergio-bershadskyот sergio-bershadsky★ 15 звёзд на GitHub

Об этом скилле

Tortoise ORM Enterprise Patterns

Opinionated, production-grade development patterns for Tortoise ORM (async Python ORM). Apply these to every Tortoise codebase unless the project's own CLAUDE.md overrides them.

Rule Priority (read first, every time)

When advice conflicts, resolve in this order:

  1. User's project rules (this repo's CLAUDE.md, explicit instructions in the conversation) — highest priority
  2. Official Tortoise ORM docs (https://tortoise.github.io/)
  3. Context7-sourced patterns (/tortoise/tortoise-orm)
  4. Other internet consensus (projectrules.ai, blog posts)

If the user states a rule (e.g. "use UUID primary keys"), it wins over everything below.

Check the LATEST version first (always)

Tortoise ORM moves fast and its tooling has changed across versions — most notably, schema migrations moved from the separate Aerich tool to a built-in tortoise migration CLI in ≥ 1.1. So before relying on any version-specific behaviour (migrations above all), verify the current version and confirm against the live docs — do not trust this skill's version numbers blindly:

  • Check the installed + latest release: python -c "import tortoise; print(tortoise.__version__)", pip index versions tortoise-orm (or PyPI https://pypi.org/project/tortoise-orm/).
  • Read the live docs/changelog: https://tortoise.github.io/ and the migration page https://tortoise.github.io/migration.html. Cross-check with Context7 /tortoise/tortoise-orm.
  • Prefer the latest stable, pin a known-good version, and when the live docs disagree with this skill, the live docs win (Rule Priority #2). If a newer version changes a workflow here, follow the new docs and flag the drift.

The Five Hard Rules (non-negotiable)

These come straight from the user's ruleset and override any pattern below. Never break them.

# Rule Why it matters
0 Models live in a models/ subpackage of the sub-application (never models.py) Lets the package grow without refactor; mirrors Django/FastAPI conventions
1 One file == one model Stable git blame, trivial review diffs, no circular-import games
2 Every concrete model has an abstract Base* interface usable as a mock base or transition model Makes business logic testable without a DB; supports zero-downtime model rewrites
3 class Meta is ALWAYS the first member of any model class Reader sees table/index/ordering before any field
4 Class member order is enforced: Meta → fields → class/private methods → public methods Predictable scan order; reduces review friction

Rule 2 is the one most teams skip. Don't. See references/models.md for the full pattern, including how Base* doubles as a Protocol-like interface for service-layer mocking.

When to Use

  • Bootstrapping a new Tortoise ORM project (FastAPI, Starlette, Sanic, Quart, AIOHTTP, Nexios).
  • Adding a model, refactoring an existing single-file models.py.
  • Wiring Tortoise's built-in migrations into CI.
  • Writing tests that need DB isolation without slow integration fixtures.
  • Reviewing a PR that touches Tortoise models.

Project Layout

project/
├── pyproject.toml                # uv + dependency groups
├── uv.lock
├── docker/                       # all docker artifacts live here
│   ├── Dockerfile
│   ├── docker-compose.yml
│   └── entrypoint.sh
├── config/
│   ├── __init__.py
│   ├── settings.py               # Dynaconf or pydantic-settings
│   └── tortoise.py               # TORTOISE_ORM dict (the `tortoise` CLI reads this via -c)
├── apps/
│   └── billing/                  # one sub-application
│       ├── __init__.py
│       ├── models/               # SUBPACKAGE — Rule 0
│       │   ├── __init__.py       # re-exports
│       │   ├── base.py           # cross-cutting abstract base (BaseModel) — never `_base.py`
│       │   ├── invoice.py        # one file == one model — Rule 1
│       │   │                      # contains BaseInvoice + Invoice — Rule 2
│       │   └── payment.py
│       ├── schemas/              # Pydantic v2 in/out DTOs
│       ├── services/             # business logic (depends on Base* interfaces)
│       ├── repositories/         # optional: data-access abstraction
│       └── routers/              # FastAPI / framework routes
├── migrations/                   # `tortoise makemigrations` output (built-in, not Aerich)
└── tests/

Pin versions

pyproject.toml:

[project]
name = "myproject"
requires-python = ">=3.12"
dependencies = [
    "tortoise-orm[asyncpg]>=1.1",      # asyncpg for postgres; >=1.1 ships the built-in `tortoise` migration CLI
    "fastapi>=0.115",
    "pydantic>=2.7",
]

[dependency-groups]
dev = ["ruff>=0.5", "mypy>=1.10", "ipython"]
test = ["pytest>=8", "pytest-asyncio>=0.23", "asynctest", "freezegun"]

No aerich. Tortoise ≥ 1.1 has a built-in migration syste

Полный SKILL.md на GitHub

Установить tortoise-dev в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/fastapi.mdreferences/migrations.mdreferences/models.mdreferences/queries.mdreferences/testing.md

FAQ

Что делает скилл tortoise-dev?

Use when the user asks to "create a tortoise model", "new tortoise project", "tortoise orm", "async orm", "aerich migration", "fastapi tortoise", "tortoise model abstract", "tortoise base class", or mentions Tortoise ORM project structure, model organization, querysets, signals, transactions, or testing. Provides opinionated enterprise patterns: model-per-file, abstract Base interfaces for mocks/transitions, strict class member ordering, FastAPI lifespan, built-in Tortoise migrations (never Aerich), Pydantic v2, pytest.

Как установить скилл tortoise-dev?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл tortoise-dev запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить tortoise-dev с