Django
Builds, debugs, and hardens Django apps: models, the ORM, views, templates, forms, the admin, DRF APIs, and deployment. Use when a page fires one query per…
от clawic★ 23 звезды на GitHub
Установить Django в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
User preferences and memory live in ~/Clawic/data/django/ (see setup.md on first use, memory-template.md for the file format). If you have data at an old location (~/django/ or ~/clawic/django/), move it to ~/Clawic/data/django/, and say in one line that you moved it and from where.
When To Use
- Writing or reviewing Django models, migrations, views, forms, templates, admin classes, or DRF serializers
- A page is slow or the query count grows with the number of rows on screen
- A migration will not generate, will not apply, conflicts after a merge, or would lock a production table
- An exception that is Django's and not Python's:
SynchronousOnlyOperation,TransactionManagementError,AppRegistryNotReady,NoReverseMatch,DisallowedHost,ImproperlyConfigured - Hardening a project for production: settings split,
check --deploy, static and media, sessions, permissions, upload limits - Background jobs, async views, Channels, caching, or a test suite that is slow or order-dependent
- Not for plain Python semantics, packaging, or asyncio internals, and not for engine-level SQL tuning (see Related Skills)
Quick Reference
| Situation | Play |
|---|---|
| Query count grows with rows on the page | select_related for forward FK/O2O, prefetch_related for reverse FK/M2M (Core Rules 1-2, → orm.md) |
Sum/Count inflated after annotate |
Two joins multiply rows — Count("x", distinct=True) or a Subquery (→ orm.md) |
| Rows come back duplicated after filtering on a related model | Chained .filter().filter() joins twice; one .filter(a=..., b=...) requires the same related row (→ orm.md) |
makemigrations reports "No changes detected" |
App missing from INSTALLED_APPS, or models defined outside an imported module (→ migrations.md) |
| Two migration leaves after a merge | makemigrations --merge; never renumber files by hand (→ migrations.md) |
| The migration must run on a live table | Expand → backfill in batches → contract, each in its own migration (Core Rules 6, → migrations.md) |
| 403 "CSRF verification failed" | Missing {% csrf_token %}, or CSRF_TRUSTED_ORIGINS entries without a scheme behind a proxy (→ security.md) |
400 on every request once DEBUG=False |
ALLOWED_HOSTS (→ settings.md) |
| 500 with an empty response and nothing in the logs | DEBUG off with no LOGGING config — the exception exists, nothing writes it down (→ settings.md) |
| Redirect loop behind a load balancer | SECURE_SSL_REDIRECT without SECURE_PROXY_SSL_HEADER (→ deployment.md) |
SynchronousOnlyOperation |
ORM touched from an async context — sync_to_async or the a-prefixed ORM methods (→ async.md) |
Task fails with DoesNotExist, then succeeds on retry |
Queued inside atomic() and picked up before COMMIT — transaction.on_commit (Core Rules 5, → tasks.md) |
| Admin change page hangs or times out | A ForeignKey rendered as a <select> of every row — autocomplete_fields, list_select_related (→ admin.md) |
| Static files 404, or the manifest raises after deploy | collectstatic, STATIC_ROOT, and hashed-name references (→ deployment.md) |
| Tests pass alone and fail as a suite | Mutated setUpTestData objects, or a setting read at import time (→ testing.md) |
| A DRF endpoint issues N+1 or leaks a field | SerializerMethodField touching a relation; fields = "__all__" (→ drf.md) |
| Login, permissions, or a custom user model | auth.md — and set AUTH_USER_MODEL before the first migrate (Core Rules 8) |
| Starting a project, or deciding where a new app goes | startproject config ., domain-shaped apps, and a label chosen once — it is baked into every table name (→ layout.md) |
Bumping the Django version, or RemovedInDjangoXXWarning in the test output |
Clear deprecations on the current version with python -Wa manage.py test, then move one feature release at a time (→ upgrade.md) |
| Text must render in the user's language, or dates in their format | gettext_lazy at import time, {% blocktranslate %} in templates, and compilemessages — Django reads .mo, never .po (→ i18n.md) |
| Anything else | Reproduce in manage.py shell, switch the django.db.backends logger to DEBUG, and read the SQL Django actually emitted before changing any code (→ debug.md) |
Depth on demand, by phase:
- Start —
layout.mdproject skeleton, app boundaries, labels, where non-app code goes - Diagnose —
debug.mdsymptom to cause in minutes ·commands.mdthemanage.pytoolkit and what each command really does - Model the data —
models.mdfields, relations, constraints, managers, signals ·migrations.mdgenerating, merging, squashing, online schema change ·orm.mdquerysets, joins, aggregation, transactions, locking - Serve requests —
views.mdview classes, URLs, middleware, requests and responses ·forms.mdvalidation, formsets, file uploads ·templates.mdescaping, context, custom tags
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- _meta.json
- admin.md
- async.md
- auth.md
- commands.md
- debug.md
- deployment.md
- drf.md
- forms.md
- i18n.md
- layout.md
- memory-template.md
- migrations.md
- models.md
- orm.md
- performance.md
- security.md
- settings.md
- setup.md
- tasks.md
- templates.md
- testing.md
- upgrade.md
- views.md
FAQ
Что делает скилл Django?
Builds, debugs, and hardens Django apps: models, the ORM, views, templates, forms, the admin, DRF APIs, and deployment. Use when a page fires one query per row (N+1, select_related, prefetch_related, annotate double-counting); when makemigrations conflicts, a migration locks a live table, or InconsistentMigrationHistory blocks a deploy; on 403 CSRF verification failed, DEBUG=False turning every request into 400 DisallowedHost or a blank 500, or SECURE_SSL_REDIRECT looping behind a proxy; on SynchronousOnlyOperation, AppRegistryNotReady, or NoReverseMatch; when a background task runs before its transaction commits, signals fire on rows that roll back, or update() skips auto_now; when the admin times out on a big table, collectstatic breaks static files, or workers exhaust database connections; when writing serializers, formsets, a custom user model, permissions, or assertNumQueries tests; or upgrading Django across a deprecation. Not for plain Python, FastAPI or Flask services, or engine-level SQL tuning.
Как установить скилл Django?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Django запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…