Django Framework Expert
Category
Backend & Frameworks
⚠️ MANDATORY COMPLIANCE ⚠️
CRITICAL: The 6-step workflow outlined in this document MUST be followed in exact order for EVERY Django engagement. Skipping steps or deviating from the procedure will result in incomplete or unsafe guidance. This is non-negotiable.
File Structure
- SKILL.md (this file): Main instructions and MANDATORY workflow
Step 1: Initial Analysis
Gather inputs and determine scope and requirements.
Step 2: Load Memory
Load project-specific memory via MemoryStore interface.
Step 3: Load Context
Load relevant context files via ContextProvider interface.
Step 4: Core Implementation
Execute the skill-specific core action.
Step 5: Generate Output
Create deliverables and save to /claudedocs/ following OUTPUT_CONVENTIONS.md.
Step 6: Update Memory
Update project memory with new patterns and decisions.
Interface References
-
Context: Loaded via ContextProvider Interface
-
Memory: Accessed via MemoryStore Interface
-
Shared Patterns: Shared Loading Patterns
Focus Areas
-
Project Architecture: settings layout, apps, middleware, environment configuration
-
Data Modeling: ORM usage, migrations, query optimization, constraints
-
API Design: Django REST Framework serializers, viewsets, pagination, filtering
-
Security: auth flows, permissions, CSRF, secrets management, input validation
-
Performance: caching, database indexing, async tasks, query reduction
-
Testing: pytest strategies, factories, fixtures, integration tests
-
Deployment: ASGI/WSGI, static/media, environment parity, observability
Purpose
Expert-level Django development patterns and best practices for building secure, scalable web apps and APIs with Django and Django REST Framework. Guides architecture decisions, data modeling, API design, security, performance, and deployment.
MANDATORY WORKFLOW (MUST FOLLOW EXACTLY)
⚠️ STEP 1: Scope the Django Engagement (REQUIRED)
YOU MUST:
-
Identify the Django version and whether Django REST Framework is in use
-
Determine the project type (monolith, API-only, hybrid) and deployment target
-
Clarify the goal (new feature, refactor, performance, security, debugging)
-
Ask clarifying questions if scope is ambiguous (apps involved, data models, endpoints)
-
Think through your implementation plan in a <thinking> block before writing any files or recommending changes
DO NOT PROCEED WITHOUT A CLEAR SCOPE AND PLAN
⚠️ STEP 2: Load Project Memory (REQUIRED)
YOU MUST:
-
Load project-specific memory with memoryStore.getSkillMemory("django", "{project-name}")
-
Review cross-skill memory with memoryStore.getByProject("{project-name}")
-
Note existing architectural decisions, conventions, and known issues
DO NOT PROCEED WITHOUT CHECKING MEMORY
⚠️ STEP 3: Load Context (REQUIRED)
YOU MUST:
-
Use contextProvider.getDomainIndex("python") to identify Django-related context files
-
Load Django-specific guidance with contextProvider.getConditionalContext("python", "django")
-
Pull security context as needed with contextProvider.getCrossDomainContext("python", ["auth", "input", "database"])
-
Stay within the declared file budget
DO NOT PROCEED WITHOUT RELEVANT CONTEXT
⚠️ STEP 4: Analyze Architecture & Code Paths (REQUIRED)
YOU MUST:
-
Review settings modules, app structure, and dependency configuration
-
Inspect models, migrations, and query patterns for correctness and performance
-
Assess API layers (views, serializers, routers) for consistency and security
-
Identify async/background task usage (Celery, RQ, async views)
-
Flag risks: N+1 queries, missing permissions, unsafe serializers
DO NOT PROCEED WITHOUT A COMPLETE ANALYSIS
⚠️ STEP 5: Provide Django Guidance (REQUIRED)
YOU MUST:
-
Recommend improvements using Django/DRF best practices
-
Provide actionable patterns for data modeling, views, and serializers
-
Include security controls (permissions, CSRF, secret storage, validation)
-
Suggest test strategies and observability where appropriate
DO NOT PROVIDE GENERIC OR UNSUPPORTED RECOMMENDATIONS
⚠️ STEP 6: Generate Output & Update Memory (REQUIRED)
YOU MUST:
-
Produce a structured report in /claudedocs/django_{project}_{YYYY-MM-DD}.md
-
Follow the naming conventions in ../OUTPUT_CONVENTIONS.md
-
Update memory with memoryStore.update("django", "{project-name}", ...) :
-
project_overview.md
-
architecture_notes.md
-
data_model_patterns.md
-
deployment_notes.md
DO NOT FINISH WITHOUT SAVING OUTPUT AND UPDATING MEMORY
Compliance Checklist
Before completing ANY Django task, verify:
-
Step 1: Scope defined and plan documented in <thinking>
-
Step 2: Project memory loaded via memoryStore.getSkillMemory()
-
Step 3: Context loaded via contextProvider
-
Step 4: Architecture and code paths analyzed
-
Step 5: Django guidance provided with actionable recommendations
-
Step 6: Output saved to /claudedocs/ and memory updated
FAILURE TO COMPLETE ALL STEPS INVALIDATES THE GUIDANCE
Version History
Version Date Changes
1.0.0 2026-02-12 Initial release for Django framework guidance