一键导入
django-idioms
Django ORM, class-based views, DRF serializers, migrations, pytest-django. For Python see python-idioms.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Django ORM, class-based views, DRF serializers, migrations, pytest-django. For Python see python-idioms.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
| name | django-idioms |
| description | Django ORM, class-based views, DRF serializers, migrations, pytest-django. For Python see python-idioms. |
| paths | ["**/views.py","**/models.py","**/urls.py","**/manage.py"] |
Django rewards convention, the ORM, and "batteries included" design. Idiomatic Django = DRY, model-centric, well-tested.
Scope: Django-specific patterns. For Python:
@.agents/skills/python-idioms/SKILL.md.
Fat models, thin views — business logic in models/managers, not views.
Custom managers for common queries:
class TaskManager(models.Manager):
def active(self):
return self.filter(status='active')
class Task(models.Model):
objects = TaskManager()
Meta class for ordering, constraints, indexes.
Class-based views for CRUD, function-based for simple/custom:
class TaskListView(LoginRequiredMixin, ListView):
model = Task
queryset = Task.objects.active()
paginate_by = 25
DRF serializers for API boundaries:
class TaskSerializer(serializers.ModelSerializer):
class Meta:
model = Task
fields = ['id', 'title', 'priority', 'created_at']
read_only_fields = ['id', 'created_at']
select_related/prefetch_related to avoid N+1 queries.F() and Q() expressions for complex queries.RunPython with reverse_code for reversibility.For universal testing principles, see
.agents/rules/testing-strategy.md. Below: language-specific patterns only.
pytest-django over unittest.TestCase:
@pytest.mark.django_db
def test_create_task():
task = Task.objects.create(title='Test', priority='high')
assert task.title == 'Test'
Factory Boy for test data (not fixtures).
| Tool | Purpose | Command |
|---|---|---|
ruff | Formatting + linting | ruff format . && ruff check . |
mypy + django-stubs | Type checking | mypy . |
bandit | Security | bandit -r . |
Structured fault tolerance for coordinator agents. 5-level escalation ladder (Retry → Replace → Skip → Redistribute → Degrade), dead-man timers, degraded completion protocol, and cross-level escalation format. Load when orchestrating agents that may fail.
Structured code review protocol for inspecting code quality against the full rule set. Use when auditing code written by yourself or another agent, during the /audit workflow, or when the user asks for a code review.
Reusable convergence protocol for coordinator agents. Defines the BRIEFING → ITERATE → GATE → CONVERGE loop, context hygiene rules, self-succession protocol, turn budget, and handoff compression. Load when orchestrating multi-iteration workflows.
Pre-flight checklist and post-implementation self-review protocol. Use before generating any code (pre-flight) and after writing code but before verification (self-review) to catch issues early.
MECE task decomposition, file ownership enforcement, DAG-based execution, and safe merge protocol for intra-domain parallel dispatch. The safety invariants that prevent merge chaos when multiple agents write in parallel. Applies recursively at every nesting depth.
Shared protocols for all agents in the multi-agent pipeline: recursive nesting, pre-implementation restatement, parallel dispatch format, and agent definition cascade. Load this skill instead of inlining these protocols in every agent file.