# Detect Database Schema Drift

Database schemas and application models can diverge, causing runtime errors and failed deployments. This skill compares migrations, schemas, and ORM models to produce prioritized alignment reports.

## Install

```bash
npx skillstore add consiliency/schema-alignment
```

## Metadata

- Status: approved
- Slug: consiliency-schema-alignment
- Skillstore revision: r1
- Version status: missing
- Tree hash: f6259f068cd9e6220435f0d24aa0d3fb00e2ead58142d9561a0279d5db3ebc1e
- Author: Consiliency
- GitHub username: Consiliency
- License: MIT
- Repository: https://github.com/Consiliency/treesitter-chunker/tree/main/.ai-dev-kit/skills/schema-alignment
- Ref: 635f69fb8d2f4e6330ba47a4e5a0fb239c04d110
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: env\_access, external\_commands, network
- Quality score: 78
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/consiliency-schema-alignment
- Manifest: https://skillstore.pages.dev/api/skills/consiliency-schema-alignment/manifest

## Capabilities

- Detect ORM and migration technologies from common project indicators.
- Compare database columns with ORM fields for missing definitions.
- Identify type, nullability, naming, foreign key, and migration mismatches.
- Map SQLAlchemy and Prisma model types to common database types.
- Produce severity-ranked reports with locations and suggested fixes.

## Use Cases

- Validate model changes: Compare edited ORM models with migrations before opening a pull request.
- Audit database drift: Find mismatched columns, constraints, relationships, and types across the application and database.
- Check deployment readiness: Review pending schema differences and missing migrations before a release reaches production.

## Prompt Templates

### Run a basic alignment check

```
Inspect this project for schema drift. Detect the ORM, compare models with migrations, and report medium or higher issues.
```

### Check selected tables

```
Compare the users and orders tables with their ORM models. Include missing fields, type mismatches, nullability, defaults, and foreign keys.
```

### Review migration coverage

```
Compare recent model changes with Alembic or Prisma migrations. Identify missing migrations and propose fixes without applying database changes.
```

### Perform a release audit

```
Use migrations as the baseline and compare models plus the read-only live schema. Rank drift, explain impact, and propose reversible remediation steps.
```

## Limitations

- Live database comparison requires existing access and should use read-only credentials.
- Detailed parsing guidance centers on SQLAlchemy, Prisma, and Alembic.
- Generated migration suggestions may miss custom SQL or framework-specific behavior.
- The skill does not replace migration tests, backups, or human review before deployment.

## Best Practices

- Prefer migration history as the baseline when it is complete and authoritative.
- Use read-only database credentials for live schema inspection.
- Review generated fixes and test migrations in an isolated environment.

## Anti Patterns

- Do not apply generated migrations directly to production.
- Do not infer the live schema only from ORM models.
- Do not dismiss type or nullability mismatches because tests currently pass.

## Security Audit

- Audited at: 2026-07-13T16:56:50.59\+00:00
- Summary: All 50 static findings are false positives caused by Markdown fences, inline code, schema examples, and ordinary ORM identifiers. No prompt injection, credential exfiltration, network request, or executable implementation was found in the documentation-only skill.

## Stats

- Views: 226
- Downloads: 8
- Favorites: 0
- Popularity score: 0
