django-patterns
Skill4 starsChanged 4 months agoMITView on GitHub
Django/DRF project conventions: service-layer structure, serializers, thin views, URL namespacing, the canonical /api/v1 API contract, Celery tasks, and testing. Apply when writing or reviewing Django/Python backend code.
19 other projects use a version of this.
Adopted by
Most recently taken up by
- ku5ic/claude-kittheir own version, first seen Oct 6, 2026
- templetongroup/radianttheir own version, first seen Sep 17, 2026
- SamuelNDCE/claude-super-skill-librarytheir own version, first seen Aug 1, 2026
- JunMystery/Agent-Guidance-Pythontheir own version, first seen Jul 21, 2026
- Lukasbrujula/claude-code-frameworktheir own version, first seen Jul 6, 2026
- skateddu/claude-code-python-setuptheir own version, first seen Jun 2, 2026
Used with
Projects with it also use django-verification, springboot-tdd and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
FaisalAlqarniSkilldjango-verification
Verification loop for Django projects: migrations, linting, tests with coverage, security scans, and deployment readiness checks before release or PR.
Also in 9 projects that use this
FaisalAlqarniSkillspringboot-tdd
Test-driven development for Spring Boot using JUnit 5, Mockito, MockMvc, Testcontainers, and JaCoCo. Use when adding features, fixing bugs, or refactoring.
Also in 8 projects that use this
johnrtiptonSkilldjango-security
This skill should be used when conducting security reviews, auditing Django applications, hardening security settings, implementing OWASP Top 10 protections, managing secrets, or ensuring multi-tenant security isolation. Provides automated security auditor that scans settings, code, dependencies, and multi-tenant configurations with auto-fix capabilities.
Also in 9 projects that use this
yanhaoluo0Skilljava-coding-standards
阿里巴巴Java开发手册编程规约,包含命名风格、常量定义、代码格式、OOP规约、日期时间、集合处理、并发处理、控制语句、注释规约等。Use when writing Java code, reviewing code, or following Alibaba Java coding standards.
Also in 7 projects that use this
joneqianSkillcontinuous-learning-v2
Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents.
Also in 8 projects that use this
WorldFlowAISkillclickhouse-io
ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
Also in 7 projects that use this
- +4 more from FaisalAlqarni
Other versions19 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 19
- rohitg00/awesome-claude-code-toolkit★ 2.7ksame name
- xu-xiang/everything-claude-code-zh★ 2ksame name
- loulanyue/awesome-claude-notes★ 272same name
- tpavanipradeep/everything-claude-code★ 134same name
- templetongroup/radiant★ 113same name
- Jamkris/everything-gemini-code★ 87same name
- tranhieutt/software_development_department★ 72same name
- codelably/harmony-claude-code★ 43same name
- skateddu/claude-code-python-setup★ 28same name
- FaisalAlqarni/sp-ecc★ 9same name
9 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository52 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- actionableSkill
- astro-bootstrapSkill
- astro-patternsSkill
- autopilotSkill
- axon-code-intelSkill
- brainstormingSkill
- commit-conventionsSkill
- cross-repo-contextSkill
- django-bootstrapSkill
- executeSkill
- flutter-bootstrapSkill
- flutter-patternsSkill
- full-featureSkill
- intelSkill
- nextjs-bootstrapSkill
- nextjs-fullstack-bootstrapSkill
- nextjs-fullstack-patternsSkill
- nextjs-mui-bootstrapSkill
- nextjs-patternsSkill
- nextjs-shadcn-bootstrapSkill
- orchestratorSkill
- phase-breakdownSkill
- plan-and-scopeSkill
- prdSkill
- reactSkill
- recallSkill
- reflectSkill
- relaySkill
- rememberSkill
- scaffoldSkill
- scratchSkill
- tailwindSkill
- ux-specSkill
- ux-to-promptsSkill
- verify-astroSkill
- verify-djangoSkill
- verify-flutterSkill
- verify-nextjs-fullstackSkill
- verify-nextjs-muiSkill
- verify-nextjs-shadcnSkill
- verify-nextjsSkill
- verifySkill
- visual-feedbackSkill
- work-disciplineSkill
- worktreesSkill
- wrapSkill
- write-as-friendSkill
- write-as-humanSkill
- writing-clearlySkill
- writing-skillsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
24 rules. About 0 are common, 7 are distinctive, and 17 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
17
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
All models inherit from AbstractModel (provides uuid, metadata, created_at, updated_at, silent_save())
- Very specific: line 20
Use the inherited uuid field for public-facing IDs, keep integer PKs internal
- Very specific: line 21
Add __str__ methods to every model
- Very specific: line 22
Use Meta.ordering to define default ordering
- Very specific: line 23
Keep models thin — business logic goes in services.py
- Very specific: line 33
Use SerializerMethodField sparingly — prefer annotations at the queryset level
- Very specific: line 35
Always define fields explicitly (never use __all__)
- Distinctive: line 38
Prefer ViewSets for CRUD, APIView for custom actions
- Very specific: line 39
Use select_related / prefetch_related on querysets to avoid N+1
- Very specific: line 41
Use permission_classes explicitly on every view
- Distinctive: line 46
Use DRF routers for ViewSets
- Very specific: line 52
Prefix: every endpoint lives under /api/v1 with a trailing slash on every path.
- Very specific: line 70
Resource endpoints: follow REST collection/detail conventions under the prefix, keyed by uuid:
- Very specific: line 98
Keep tasks in each app's tasks.py
- Very specific: line 102
Add RunPython data migrations when needed alongside schema changes
- Distinctive: line 103
Never edit a migration that's been pushed to main
- Very specific: line 106
Use pytest-django with @pytest.mark.django_db
- Distinctive: line 107
Use factory_boy for test data (not fixtures)
- Very specific: line 108
Test API endpoints via APIClient — test the contract, not internals
- Distinctive: line 109
Test services independently with unit tests (no HTTP layer)
- Very specific: line 113
All commands run via make (Docker Compose under the hood) — never run python manage.py directly
- Very specific: line 114
Use /django-bootstrap when setting up a new project from scratch
- Distinctive: line 117
After completing a backend feature, generate an integration summary:
- Distinctive: line 121
Document error response shapes
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: Django Patterns
Purpose
Guide Claude Code when implementing Django/DRF features. Follow these conventions unless the project's CLAUDE.md overrides them.
Project Structure
- Project settings module is always named
project/(not the service name) - Apps live in their own top-level directories
- Each app has:
admin.py,apps.py,models.py,serializers.py,services.py,tasks.py,urls.py,views.py,tests/ - Tests use a
tests/directory with files per concern:test_models.py,test_views.py,test_services.py
Models
- All models inherit from
AbstractModel(providesuuid,metadata,created_at,updated_at,silent_save()) - Use the inherited
uuidfield for public-facing IDs, keep integer PKs internal - Add
__str__methods to every model - Use
Meta.orderingto define default ordering - Keep models thin — business logic goes in
services.py
Service Layer
- Each app has a
services.py— all business logic lives here, not in views or models - Services are classes with external dependencies injected via
__init__ - Views call services; services call models and external APIs
- This keeps views thin and business logic testable without HTTP
Serializers (DRF)
- Separate read vs write serializers when shapes differ
- Use
SerializerMethodFieldsparingly — prefer annotations at the queryset level - Validate at the serializer level, not the view level
- Always define
fieldsexplicitly (never use__all__)
Views
- Prefer ViewSets for CRUD, APIView for custom actions
- Use
select_related/prefetch_relatedon querysets to avoid N+1 - Views should only: parse request, call service, return serialized response
- Use
permission_classesexplicitly on every view
URLs
- Each app exports
urlpatternsfromurls.py project/urls.pyaggregates with namespacing:path("api/v1/{app}/", include(({app}_urlpatterns, "{app}")))- Use DRF routers for ViewSets
Canonical API Contract
This is the source of truth for the cross-stack API. The Django backend ships exactly this; every decoupled client (Next.js, Flutter) consumes exactly this. Keep paths, identifiers, and payload shapes byte-for-byte consistent with this section — do not restate them differently elsewhere.
Prefix: every endpoint lives under /api/v1 with a trailing slash on every path.
Identifiers: clients only ever see uuid. Models keep an internal integer primary key for FK/index efficiency, but URLs and payloads expose the public uuid field only — never the integer id. Detail routes are keyed on it: path("<uuid:uuid>/", ...).
Auth endpoints:
| Method | Path | Request | Response |
| POST | /api/v1/auth/login/ | {email, password} | {access, refresh} |
| POST | /api/v1/auth/refresh/ | {refresh} | {access} |
| GET | /api/v1/auth/me/ | — (Bearer access token) | user object |
| POST | /api/v1/auth/register/ | {username, email, password, first_name, last_name} | {user, tokens: {access, refresh}} |
- Login returns the token pair directly:
{access, refresh}. - Refresh returns
{access}(a new access token from a valid refresh token). - Register wraps the created user and its tokens:
{user, tokens: {access, refresh}}. - The user object (from
/api/v1/auth/me/and inside register'suser) is{uuid, username, email, first_name, last_name}— no integerid.
Resource endpoints follow REST collection/detail conventions under the prefix, keyed by uuid:
| Method | Path | Purpose |
| GET | /api/v1/{resource}/ | list (paginated) |
| POST | /api/v1/{resource}/ | create |
| GET | /api/v1/{resource}/<uuid>/ | retrieve |
| PATCH | /api/v1/{resource}/<uuid>/ | update |
| DELETE | /api/v1/{resource}/<uuid>/ | delete |
(The self-contained full-stack Next.js app applies the same prefix, uuid, and pagination shape to its own route handlers — e.g. /api/v1/posts — though Next.js route paths omit the trailing slash.)
Pagination: list endpoints are page-number paginated. Query params: page and page_size. Response shape:
{
"page": 1,
"count": 42,
"num_pages": 5,
"results": [ ... ]
}count is the total item count across all pages, num_pages the total page count, page echoes the current page, and results holds the current page's items. (This is a custom paginator — not DRF's default {count, next, previous, results}.)
Celery Tasks
- Use
@shared_task(bind=True, max_retries=3, default_retry_delay=60) - Tasks call services — no business logic in the task itself
- Keep tasks in each app's
tasks.py
Migrations
- Review auto-generated migrations before committing
- Add
RunPythondata migrations when needed alongside schema changes - Never edit a migration that's been pushed to main
Testing
- Use
pytest-djangowith@pytest.mark.django_db - Use factory_boy for test data (not fixtures)
- Test API endpoints via
APIClient— test the contract, not internals - Test services independently with unit tests (no HTTP layer)
- Aim for: service logic tests, serializer validation tests, endpoint integration tests
Development Environment
- All commands run via
make(Docker Compose under the hood) — never runpython manage.pydirectly - Use
/django-bootstrapwhen setting up a new project from scratch
Integration Summaries
After completing a backend feature, generate an integration summary:
- List all new/modified endpoints with method, path, auth requirements
- Include request/response shapes as JSON examples
- Note any pagination, filtering, or ordering parameters
- Document error response shapes
- Save to
docs/integration/[feature-name].md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

