# django-safe-migration

django-safe-migration is a Claude Code skill that reviews and rewrites Django migrations for PostgreSQL with deployment locks in mind, before schema changes or releases.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 822 installs · ★ 176 repo stars
- Author: vintasoftware
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/vintasoftware/django-ai-plugins/tree/HEAD/skills/django-safe-migration/SKILL.md
- Updated: 2026-07-23
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/django-safe-migration

## What it does

The skill helps assess Django migrations for PostgreSQL and rewrite risky operations. During a review, it calls for inspecting the SQL produced by Django and judging it against a rolling deployment. A lock can hold up queries to a table and cause more requests to queue behind it.

The described techniques include `AddIndexConcurrently`, adding a foreign key with `NOT VALID` before checking existing rows with `VALIDATE CONSTRAINT`, and separating database changes from Django’s recorded state. Operations that need an `ACCESS EXCLUSIVE` lock should use `lock_timeout`. The skill also asks the agent to read project instructions; Django’s version matters when considering `db_default`.

## Requirements
- Works with: PostgreSQL

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add vintasoftware/django-ai-plugins --skill django-safe-migration -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/django-safe-migration/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/django-safe-migration/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add vintasoftware/django-ai-plugins --skill django-safe-migration -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/django-safe-migration/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add vintasoftware/django-ai-plugins --skill django-safe-migration -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/django-safe-migration/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install vintasoftware/django-ai-plugins skills/django-safe-migration
```

2. **Manually: put the files in place**
- File: `.github/skills/django-safe-migration/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add vintasoftware/django-ai-plugins --skill django-safe-migration -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/vintasoftware/django-ai-plugins --path skills/django-safe-migration
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/django-safe-migration/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add vintasoftware/django-ai-plugins --skill django-safe-migration -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/vintasoftware/django-ai-plugins/tree/HEAD/skills/django-safe-migration/SKILL.md

## When to use it
- review a migration before a rolling deploy
- rewrite a schema change with PostgreSQL locks in mind
- add a foreign key and validate existing rows later
- inspect the SQL Django will run

## Example prompts
- Review this Django migration for PostgreSQL before a rolling deploy.
- Rewrite this foreign-key change so existing rows are checked in a separate step.
- Show the SQL for this migration and assess its table-lock risk.

## Similar
- [reviewing-oracle-to-postgres-migration](https://affpapa.org/en/nevibecode/skills/reviewing-oracle-to-postgres-migration.md) — skill · 1800 installs
- [django-patterns](https://affpapa.org/en/nevibecode/skills/django-patterns.md) — skill · 7100 installs
- [django-pro](https://affpapa.org/en/nevibecode/skills/django-pro.md) — skill · 103 installs
- [django-python](https://affpapa.org/en/nevibecode/skills/django-python.md) — skill · 991 installs
- [api-scaffolding-django-pro](https://affpapa.org/en/nevibecode/agents/api-scaffolding-django-pro.md) — subagent · ★ 42780 repo stars
- [planning-oracle-to-postgres-migration-integration-testing](https://affpapa.org/en/nevibecode/skills/planning-oracle-to-postgres-migration-integration-testing.md) — skill · 1800 installs

From the same set: [vintasoftware/django-ai-plugins](https://affpapa.org/en/nevibecode/by/vintasoftware/django-ai-plugins.md) — 5 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
