agent-instructions
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when building Django applications. Covers ORM query performance, model design, migrations, Django REST Framework, security defaults, and testing.
$ npx -y skills add nimadorostkar/Claude-Skills-collection --skill django --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/djangoContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when building Django applications. Covers ORM query performance, model design, migrations, Django REST Framework, security defaults, and testing.
name: django description: Use when building Django applications. Covers ORM query performance, model design, migrations, Django REST Framework, security defaults, and testing. metadata: category: backend version: 1.0.0 tags: [django, orm, drf, migrations, python]
Build Django applications that use the ORM efficiently and the framework's security defaults correctly. Most Django performance problems are one missing `select_related` away from being fixed.
1. **Count the queries** — `assertNumQueries` in tests, `django-debug-toolbar` in development. An N+1 is invisible until you count. 2. **Fix them at the queryset** — `select_related` for forward foreign keys (a join), `prefetch_related` for reverse and many-to-many (a second query). Not both, not neither. 3. **Push work into the database** — `annotate`, `aggregate`, `bulk_create`, `update`. A loop that saves each object issues one query per iteration. 4. **Constrain at the database** — `UniqueConstraint`, `CheckConstraint`. Application-level validation does not survive concurrency or a shell script. 5. **Migrate safely** — On a large table, adding a column with a default rewrites it. Add nullable, backfill in batches, then set the default. 6. **Check the deploy settings** — `DEBUG = False`, `ALLOWED_HOSTS`, `SECURE_*`, `SECRET_KEY` from the environment.
**Removing an N+1 and pushing aggregation into the database:**
# Before: 1 query for orders + 1 per customer + 1 per line-item count = ~2N+1.
orders = Order.objects.filter(status="open")
for order in orders:
print(order.customer.name, order.items.count())
# After: 2 queries total, count computed by the database.
orders = (
Order.objects
.filter(status="open")
.select_related("customer") # join
.annotate(item_count=Count("items")) # aggregate in SQL
)
for order in orders:
print(order.customer.name, order.item_count)**Database-level constraint rather than a hopeful `clean()`:**
class Subscription(models.Model):
tenant = models.ForeignKey(Tenant, on_delete=models.CASCADE)
period_start = models.DateField()
period_end = models.DateField()
class Meta:
constraints = [
models.UniqueConstraint(
fields=["tenant", "period_start"],
name="uniq_subscription_period",
),
models.CheckConstraint(
check=models.Q(period_end__gt=models.F("period_start")),
name="period_end_after_start",
),
]A curated library of 137 production-grade skills for Claude and other AI coding agents. Every skill follows one structure, speaks with one voice, and earns its place by changing what the agent does.
Repo: nimadorostkar/Claude-Skills-collection
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when an agent needs state that survives a session or a context compaction. Covers what to persist, file-based memory, structuring notes for retrieval, and…
Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should not be trusted to remember,…
Use when packaging skills, commands, hooks, and MCP servers into a distributable plugin. Covers manifest structure, bundling, versioning, testing, and…
Use when writing a new skill for an AI agent. Covers scoping, description writing for reliable triggering, progressive disclosure, and the difference between a…
Use when reviewing or improving an existing agent skill. Covers triggering accuracy, content quality, redundancy with the base model, and measuring whether the…