Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Data Migration Best Practices

ASecurity

Operational data migration guidance. Use when moving or transforming persisted data between schemas, databases, services, or storage technologies; running large backfills; applying expand-and-contract schema changes; combining snapshots with live CDC/events; designing resumable batches and checkpoints; reconciling source and target; or planning cutover, rollback, and repair.

3 stars
0 votes
0 copies
0 views
Added 9/20/2026
ai-agentssqltestingrefactoringdatabase

Security Analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned 9/20/2026

$npx -y skills add OKHP3/skillz --skill data-migration-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Data Migration Best Practices?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Data Migration Best Practices
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/okhp3-data-migration-best-practices-skillz/badge)](https://www.skillsdirectory.com/skills/okhp3-data-migration-best-practices-skillz)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: data-migration-best-practices
description: Operational data migration guidance. Use when moving or transforming persisted data between schemas, databases, services, or storage technologies; running large backfills; applying expand-and-contract schema changes; combining snapshots with live CDC/events; designing resumable batches and checkpoints; reconciling source and target; or planning cutover, rollback, and repair.
---

# Data Migration Best Practices

Treat migration as a temporary production system with explicit correctness, capacity, observability, and retirement criteria. It changes persisted behavior and is not automatically a refactoring.

## Workflow

1. Define source authority, target contract, transformations, invariants, data classification, and tolerated downtime/staleness.
2. Choose a stable snapshot boundary or high-water mark and start durable capture of live changes before they can escape the snapshot.
3. Expand the target schema compatibly; keep old and new application versions interoperable during rolling deployment.
4. Backfill in bounded, idempotent, resumable batches with deterministic progress and explicit bad-row handling.
5. Apply captured deltas without allowing stale snapshot data to overwrite newer writes.
6. Reconcile availability, counts, identities, values, and domain invariants against a declared watermark.
7. Cut over only when freshness and discrepancy gates pass; monitor and retain a reversal or forward-repair path.
8. Contract old fields, code paths, capture infrastructure, and temporary permissions only after an observation window.

## Decision Rules

- Prefer direct transactional SQL for small same-database transformations that fit the lock and deployment budget.
- Prefer an offline bulk importer for heterogeneous stores or transformations that need application code.
- Prefer lazy/on-read migration only when incomplete migration is acceptable indefinitely and concurrent misses use atomic upsert.
- Combine a bounded snapshot with Outbox, CDC, or event capture when writes must continue during a long migration.
- Use expand-and-contract for online schema changes: add compatible shape, deploy tolerant readers/writers, populate, validate, switch authority, then remove legacy shape.
- Use forward repair rather than destructive rollback once new writes cannot be losslessly represented by the old model.

## Safety Invariants

- Preserve a stable source identity and transformation version for every target row.
- Make reruns harmless through upserts, compare-and-set/version guards, or processed-range records.
- Advance checkpoints only after the batch transaction commits; never use offset pagination over a changing source.
- Order by an immutable key and use keyset/range batches. Multiple workers need disjoint ranges or durable claims.
- Bound reads, writes, concurrency, retries, memory, and lock time against live-traffic capacity.
- Quarantine malformed or constraint-violating rows with redacted diagnostics; never convert infrastructure failure into valid empty data.
- Parameterize queries and keep credentials out of commands, source files, logs, and process arguments.
- Record who approved cutover, the exact watermark, artifacts, checksums, code/schema versions, and repair decisions.

## Gates

Do not cut over on row-count equality alone. Require:

- source and target dependencies are healthy;
- migration lag is within the agreed threshold at the watermark;
- missing, extra, duplicate, and changed identities are measured separately;
- value checksums or full comparisons pass for critical fields;
- target constraints and domain invariants pass;
- quarantined rows are resolved or explicitly accepted;
- rollback/forward-repair and operator runbooks have been rehearsed.

## Related Skills

- Use `infrastructure-design` for Outbox, Inbox, CDC, broker delivery, transactions, locking, and capacity mechanics.
- Use `tdd-best-practices` and its `references/migration-testing.md` for failure, restart, race, reconciliation, and cutover verification.
- Use `refactoring-best-practices` only for introducing code seams and compatibility paths without changing existing behavior.
- Use `ddd-best-practices` to decide whether transformed data changes domain meaning or bounded-context ownership.

## Reference

Read `references/operational-migrations.md` for snapshot/delta handoff, batching, reconciliation, observability, cutover, repair, and course caveats.

Attribution

OKHP3OKHP3
View sourceSee grades on GitHubMore from OKHP3 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →