fixture-seed-debug

Diagnose and fix Django fixture loading and seed data failures.

Updated May 11, 2026
One-click install
npx skills add https://github.com/thachrocky12345/local-agent-train-workstation --skill fixture-seed-debug-thachrocky12345
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fixture-seed-debug
Source: https://github.com/thachrocky12345/local-agent-train-workstation/tree/main/.claude/skills/fixture-seed-debug
Command: npx skills add https://github.com/thachrocky12345/local-agent-train-workstation --skill fixture-seed-debug-thachrocky12345

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Django fixture loading with loaddata frequently fails with cryptic errors like null constraint violations, foreign key violations, and deserialization errors, leaving developers stuck when seeding development databases. ## Core Features & Use Cases - Failure Pattern Diagnosis: Identifies five common failure modes including auto_now_add null violations, FK ordering issues, duplicate keys, field name mismatches, and empty fixture files. - ORM-Based Seeding Guidance: Recommends management commands with update_or_create for idempotent seeding when loaddata cannot work. - Container-Based Testing: Provides docker exec commands to inspect model fields, test fixture loads, and generate migrations inside the backend container. - Use Case: When loaddata fails with "null value in column created_at", use this Skill to learn that auto_now_add bypasses raw inserts and get a working ORM-based seed command instead. ## Quick Start Ask the AI to debug why your Django fixture fails to load with a null constraint or foreign key error and get the correct fix.

Frequently Asked Questions about fixture-seed-debug

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix null value in column created_at when loading Django fixtures?

This error occurs because loaddata uses raw=True, which bypasses auto_now_add and auto_now fields, inserting NULL. Instead of loaddata, create an ORM-based management command using update_or_create so Django populates the timestamp fields normally.

How to fix foreign key constraint violation with Django loaddata?

FK violations happen when fixtures load in the wrong order and child records reference parent PKs that do not exist yet. Load parent fixtures first, then child fixtures, or use an entrypoint script that handles multiple ordered passes.

Why does Django loaddata fail with duplicate key value violates unique constraint?

This happens when the data already exists, such as re-running loaddata on a populated database. Use the --ignorenonexistent flag, wrap the load in try/except, or switch to a management command using update_or_create for idempotency.

Can I add timestamps to fixture JSON to fix auto_now_add errors?

No. Fields with auto_now_add have editable=False, and deserializers like djmoney's reject unknown fields, so adding timestamps to fixture JSON does not work. The reliable fix is an ORM-based seed command instead of loaddata.

Why does Django fixture deserialization fail with field does not exist?

The fixture contains a field name that does not match the model, such as updated_at versus modified_at. Inspect actual field names via a Django shell command iterating over Model._meta.get_fields() and correct the fixture.