.claude/skills/saleor-django-migration/SKILL.md
Generate Django schema migrations for the Saleor codebase using manage.py makemigrations. Use when (1) a new Django model is created, (2) model fields are added/altered/removed, (3) user explicitly asks to create a migration. This skill covers ONLY synchronous schema migrations (CreateModel, AddField, AlterField, RemoveField, etc.) — NOT data migrations with RunPython or RunSQL. If unsure whether the migration is schema-only, ask the user.
npx skillsauth add saleor/saleor saleor-django-migrationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill handles schema-only migrations: CreateModel, AddField, AlterField, RemoveField, AddIndex, AddConstraint, etc. It does NOT cover:
If the change requires data transformation, stop and ask the user.
./manage.py makemigrations to generate migrations.. .venv/bin/activate before any manage.py command.Edit the Django model file(s) as needed. Do not touch any migration files.
. .venv/bin/activate && python manage.py makemigrations
If Django asks interactive questions (e.g. "Did you rename field X to Y?"), answer based on the model changes you made.
Read every generated migration file. Verify:
Apply these rules to the generated migration(s):
Rule A — One model per migration for new models:
If the migration creates MORE THAN ONE new model (multiple CreateModel operations), split them. Generate each separately:
python manage.py makemigrations <app>
If Django generates them together, delete the combined migration, then create models one at a time (add one model to models.py, run makemigrations, repeat).
Rule B — One field change per migration:
If the migration alters MORE THAN ONE field within a single model (e.g. two AddField or two AlterField operations on the same model), split into separate migrations — one per field. Delete the combined migration, make one field change at a time, and run makemigrations after each.
Exceptions (do NOT split):
CreateModel with all its fields is one operation — do not split the fields of a new modelRun the check command to confirm no pending migrations remain:
python manage.py makemigrations --check --dry-run
Expected output: No changes detected — meaning all model changes are captured in migrations.
| Error | Action |
|-------|--------|
| django.db.utils.OperationalError: could not connect | Ask user to start the database |
| Conflicting migrations detected | Stop and let user decide |
| ModuleNotFoundError | Virtual environment not activated — run . .venv/bin/activate |
ls saleor/<app>/migrations/ | tail -5) before generating, so you can confirm the new migration number is sequential.development
Commit changes in the Saleor codebase with pre-commit hook error handling. Use when asked to "commit", "commit changes", "make a commit", or any git commit task in the Saleor project. Handles virtual env activation, staging, commit message writing, and automatic resolution of pre-commit hook failures (ruff, mypy, schema, migrations).
testing
Run pytest tests with automatic virtual environment activation. Use this skill whenever running tests, executing pytest, or when asked to "run tests", "test this", or any test execution task. Ensures venv is always activated before pytest runs.
development
Benchmark and performance-test Django ORM filters on large datasets. Use this skill whenever the user wants to test filter performance, check query plans with EXPLAIN ANALYZE, generate bulk test data for filters, verify index usage, or benchmark any queryset filter in the Saleor codebase. Trigger this even when the user says things like "test the filter on a big dataset", "check if the index is used", "generate data for performance testing", "run explain analyze on this filter", or "benchmark this query".
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.