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/girijashankarj/cursor-handbook/migration-rulesgit clone --depth 1 https://github.com/girijashankarj/cursor-handbookWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/girijashankarj/cursor-handbook/migration-rules)<a href="https://agentmods.dev/rules/girijashankarj/cursor-handbook/migration-rules"><img src="https://agentmods.dev/badge/rules/girijashankarj/cursor-handbook/migration-rules.svg" alt="Measured on agentmods" height="20"></a>What 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.00000 | $0.00459 |
| Opus 5 | $0.00000 | $0.00230 |
| Sonnet 5 | $0.00000 | $0.00092 |
| Haiku 4.5 | $0.00000 | $0.00046 |
Grade A, and why
migration-rules 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 today.
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.
What it actually says
Database Migration Rules
Migration Safety
Pre-Migration Checklist
- Migration has both UP and DOWN functions
- Tested against a copy of production data
- No data loss in the migration
- Backward compatible with current code
- Performance tested for large tables
- Reviewed by another developer
Safe Migration Patterns
-- SAFE: Adding a column with a default
ALTER TABLE orders ADD COLUMN priority VARCHAR(20) DEFAULT 'normal';
-- SAFE: Adding an index concurrently (PostgreSQL)
CREATE INDEX CONCURRENTLY idx_orders_priority ON orders(priority);
-- UNSAFE: Renaming a column (breaks existing queries)
-- Instead: Add new column → migrate data → update code → remove old column
-- UNSAFE: Changing column type directly
-- Instead: Add new column → migrate data → swap columns
Migration Naming
Format: YYYYMMDDHHMMSS_descriptive_action.sql
Examples:
20260101120000_create_orders_table.sql
20260102090000_add_priority_to_orders.sql
20260103150000_create_idx_orders_user_id.sql
Zero-Downtime Migration Strategy
For production databases, follow this sequence:
- Expand: Add new columns/tables (backward compatible)
- Migrate: Backfill data to new structure
- Contract: Update code to use new structure
- Cleanup: Remove old columns/tables (after verification)
Rollback Plan
- Every migration MUST have a rollback script
- Test rollback in staging before production deployment
- Keep rollback scripts for the last 10 migrations
- Document manual steps if automated rollback isn't possible
Data Backfill
- Use batch processing for large tables (1000-5000 rows per batch)
- Include progress logging
- Implement idempotent backfills (safe to re-run)
- Run during low-traffic periods for large tables
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.
- today First seen · 62 lines · 0 tokens per session scan A dee8c90b2b85
migration-rules is a cursor rule published in the GitHub repository girijashankarj/cursor-handbook (30 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 459 tokens. 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-09-03.
Other cursor rules, from other repositories
sql
Rules for SQL files (queries, migrations, stored procs).
graphstack
GraphStack v4.7.1 — Orchestrated, graph-first, GNAP-tracked AI development (cross-platform).
mysql-auto
This rule enforces MySQL-specific best practices to enhance readability, performance, security, and maintainability. It targets MySQL features (e.g., storage engines, character sets) and common pitfalls, and adds concrete guidance for schema design and creation.
t3-stack
T3 Stack: tRPC + Prisma + NextAuth integration patterns.
database-migrations
Database migrations: safety, rollbacks, zero-downtime.
prisma
Prisma: schema modeling, queries, migrations.