Skip to content
Back to skills

Data Access And Migrations

ASecurity

Define safe persistence access, transaction boundaries, concurrency behavior, and database schema migration practices across technology stacks.

  • 200 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 29, 2026
ai-agentsapidatabase

Works with

  • api

Security analysis

A100/100

Scanned November 29, 2026

npx -y skills add sivaprasadreddy/sivalabs-agent-skills --skill data-access-and-migrations --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Data Access And Migrations?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Data Access And Migrations
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sivaprasadreddy-data-access-and-migrations/badge)](https://www.skillsdirectory.com/skills/sivaprasadreddy-data-access-and-migrations)

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

Download with Pro
SKILL.md
---
name: data-access-and-migrations
description: Define safe persistence access, transaction boundaries, concurrency behavior, and database schema migration practices across technology stacks.
---

# Data Access and Migrations

## Purpose
Keep persistence behavior correct, efficient, secure, and evolvable regardless of database or application framework.

## When to use
Use when implementing data access, multi-step writes, transactions, concurrent updates, background jobs, or schema changes.

## Data access principles
- Keep persistence concerns behind clear application boundaries; do not leak storage-specific details throughout the domain.
- Use parameterized queries or safe query APIs.
- Fetch only the data needed; avoid unbounded reads and accidental N+1 access patterns.
- Paginate potentially large result sets and define stable ordering.
- Make transaction boundaries explicit around business operations that require atomicity.
- Keep transactions short; avoid network calls or long-running work while holding locks.
- Understand isolation level, locking, optimistic concurrency, and lost-update risks.
- Make retry behavior safe; a retried operation must not accidentally duplicate side effects.
- Do not assume a transaction spans multiple databases or remote services.
- Treat caches as derived state with explicit invalidation or freshness rules.

## Migration principles
1. Treat schema changes as versioned, reviewed application changes.
2. Never rely on an undocumented manual production database edit.
3. Prefer small, deterministic, forward-only migrations unless rollback is demonstrably safe.
4. Do not rewrite migrations that may already have been applied in shared or production environments.
5. Use expand-and-contract for changes that must coexist with old and new application versions.
6. Separate large data backfills from schema changes when that improves safety and operability.
7. Test migrations against realistic prior schema states and representative data.
8. Define backup and recovery expectations for high-risk changes.

## Safe migration workflow
1. Inspect the current schema, migration history, data volume, and deployed application versions.
2. Describe the intended schema and data transformation.
3. Check compatibility with currently running and rolling-deployment versions.
4. Add compatible structures first (expand).
5. Deploy code that can work with both old and new structures where needed.
6. Backfill in bounded, observable, restartable batches.
7. Switch reads/writes to the new representation.
8. Remove obsolete structures only after compatibility is confirmed (contract).
9. Verify constraints, row counts, application behavior, and rollback/recovery options.

## Review checklist
- Are queries safe, bounded, and aligned with indexes?
- Are transaction boundaries correct?
- Can concurrent requests corrupt or overwrite state?
- Are retries idempotent?
- Can the migration run safely with existing data?
- Is it compatible with rolling deployments?
- Is the backfill restartable and observable?
- Is recovery possible if the migration fails?

For destructive or irreversible operations, require explicit risk communication and a tested recovery plan.

Attribution

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

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.