Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/nedcodes-ok/cursorrules-collection/djangogit clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collectionWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.01072 | $0.01072 |
| Opus 5 | $0.00536 | $0.00536 |
| Sonnet 5 | $0.00214 | $0.00214 |
| Haiku 4.5 | $0.00107 | $0.00107 |
Grade A, and why
django scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
Copies of this mod
1 near-identical copy found in the catalogue:
- django — 100% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 52 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Django Cursor Rules
You are an expert Django developer (v4.2+/v5+). Follow these rules:
Structure
- App-based architecture — each app is independently testable and has a clear domain boundary
- Thin views — business logic belongs in service functions or model methods, not in view code. Views handle HTTP concerns only: parse request, call service, return response
- CBVs (Class-Based Views) for standard CRUD patterns, FBVs (Function-Based Views) for custom logic that doesn't fit CRUD
- Separate settings:
base.py→development.py/production.pythat import from base. Never put secrets in settings files — useenvironordjango-environ - URL patterns: use
path()with named URLs everywhere.reverse('app:name')in code,{% url 'app:name' %}in templates — never hardcode URLs
Models
db_index=Trueon fields you filter, order, or join on frequently. Missing indexes are the #1 performance issue in Django appsCharFieldwithTextChoicesenum, not raw strings — catches typos at the Python level and gives you.labelfor display- Override
__str__on every model — admin, shell, and logging become usable.UUIDFieldfor public-facing IDs, auto-incrementpkstays internal - Always create data migrations when schema changes need data transformations —
RunPythonin migrations, not management commands that may not run constraintsin Meta for database-level validation:UniqueConstraint,CheckConstraint— model-levelunique_togetheris legacy, useMeta.constraints- Set
default_auto_field = 'django.db.models.BigAutoField'in settings — the defaultAutoFieldmaxes out at ~2.1B rows
QuerySets
select_related()for ForeignKey/OneToOne (SQL JOIN).prefetch_related()for ManyToMany and reverse FKs (separate query). Forgetting these is the N+1 problemF()for database-level field references (avoids race conditions in updates).Q()for complex OR/NOT filters.exists()notlen(qs) > 0(stops at first row)..count()notlen(qs)(SQL COUNT vs loading all objects into memory).only()/.defer()for models with large text/JSON fields you don't need — but accessing a deferred field triggers another query, so be deliberate.iterator()for processing large querysets — without it, Django caches the entire result set in memory- Never evaluate querysets in loops that trigger more queries:
for obj in queryset: obj.related.nameis N+1. Profile withdjango-debug-toolbarornplusone
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 52 lines · 1,072 tokens per session scan A aa501b6f1a3e
django is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (37 stars, last pushed 6mo ago), licensed MIT. It adds 1,072 tokens to every session, about $0.0054 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.