Database Workflow Bundle
Overview
This skill preserves the upstream database workflow while making it more useful for real engineering review and execution.
Use it when the work involves one or more of these areas:
- relational schema design
- NoSQL schema and index design
- migration planning, validation, and rollout safety
- query performance diagnosis
- backup and restore readiness
- data pipelines, freshness, and data-quality controls
This skill is especially appropriate when you must keep provenance intact while still delivering a technically credible review, remediation plan, or implementation path.
When to Use
Use this skill when the request is about database work that has operational consequences, not just syntax help.
Activate it for tasks such as:
- reviewing a schema change before implementation
- planning or validating a migration
- diagnosing slow queries or degraded throughput
- checking whether indexing matches access patterns
- evaluating backup, restore, or rollback readiness
- reviewing ETL, CDC, or analytics-model reliability
- assessing data-quality controls such as tests, freshness, and invariants
Do not use this skill as the primary workflow when:
- the user only wants a single SQL statement with no operational context
- the problem is purely application-layer and does not require database judgment
- the request is about vendor billing, licensing, or account administration rather than database engineering
Workflow
Confirm scope and provenance
- Identify the database type: PostgreSQL, MySQL, MongoDB, warehouse, or mixed stack.
- Confirm whether the task is design, migration, performance, operations, or data-pipeline review.
- Preserve upstream workflow files, copied support files, and provenance anchors before proposing edits.
- Separate facts from assumptions: engine version, table sizes, write rate, read patterns, RPO/RTO, deployment constraints.
Classify the change or incident
- Decide whether this is primarily a schema-design issue, migration-risk issue, query-plan issue, restore-readiness issue, or data-quality issue.
- For multi-part requests, split the work into tracks instead of treating all database problems as one class.
- Identify blast radius: single table/collection, cross-service dependency, replication impact, analytics downstream impact.
Gather concrete evidence before recommending action
- For SQL performance: collect the exact query shape, parameters if relevant, indexes, row counts, and planner output.
- For migrations: inspect versioned artifacts, checksums or validation status, preconditions, and rollout ordering.
- For operations: confirm backup format, retention, restore procedure, and whether restore testing has actually been performed.
- For NoSQL: map access patterns, document shapes, cardinality, and index coverage.
- For data engineering: inspect source freshness, test failures, lineage, and late-arriving or duplicate-data behavior.
Review safety before suggesting execution
- Prefer reversible or staged changes.
- Call out locking risk, backfill cost, replication lag, index build impact, and storage amplification.
- Distinguish safe read-only diagnostics from write-affecting commands.
- If the environment is production-like, avoid proposing destructive commands without explicit rollback and restore guidance.
Produce a structured recommendation
- State the current issue in operational terms.
- Provide the likely cause with evidence.
- Recommend the smallest high-confidence next action.
- Include validation criteria: what should improve, what should remain unchanged, and how to detect failure early.
- If uncertainty remains, list the exact missing evidence instead of guessing.
Add deployment and verification guidance
- For schema changes: define ordering, compatibility assumptions, and post-deploy verification.
- For performance changes: compare before/after latency, rows scanned, buffer usage, or index utilization.
- For restore readiness: require a restore test, not just backup existence.
- For data pipelines: verify tests, freshness thresholds, and reconciliation checks.
Document residual risk and handoff
- Record unresolved risks such as long-running locks, large backfills, skewed partitions, or stale statistics.
- Make it clear whether the recommendation is ready for implementation, needs DBA review, or requires a rehearsal in staging.
- Keep provenance and upstream context intact in the final handoff.
Examples
Example 1: Migration review
Input
Add a NOT NULL column to a large orders table and deploy this afternoon.
Good output
Risk: medium to high, depending on engine version and table size.
Review findings:
- A direct NOT NULL addition may trigger table rewrite or prolonged locking on some engines and versions.
- The change is not yet shown as a staged migration.
- No rollback or backfill plan is documented.
Recommended safer sequence:
1. Add the column as nullable.
2. Backfill in bounded batches.
3. Add application write path for the new field.
4. Validate null-free state.
5. Enforce NOT NULL in a separate migration.
Verification:
- No sustained lock waits above agreed threshold.
- Backfill completes without replica lag breach.
- Row counts with NULL in the new column remain at zero before constraint enforcement.
Weak output
Run ALTER TABLE to add the column and then redeploy.
Example 2: Query-performance review
Input
SELECT *
FROM orders
WHERE customer_id = 42
AND created_at >= CURRENT_DATE - INTERVAL '30 days'
ORDER BY created_at DESC
LIMIT 50;
Expected review focus
- Confirm whether an index supports filter plus ordering, such as (customer_id, created_at DESC).
- Inspect actual planner output before recommending changes.
- Check whether SELECT * causes avoidable heap access or wide-row transfer.
- Compare before/after latency and rows scanned after any index or query change.
Example 3: Backup readiness review
Input
Backups are enabled every night. Are we covered?
Good output
Not enough evidence. Backup existence is not the same as recovery readiness.
Required checks:
- backup type and retention window
- restore procedure ownership
- last successful restore rehearsal
- point-in-time recovery requirements
- time to restore compared with RTO
For a fuller worked example, open examples/review-example.md.
Best Practices
Do treat migrations as version-controlled artifacts with validation before deployment.
Do prefer expand-and-contract patterns for incompatible schema changes.
Do use evidence from planner output, runtime metrics, and row counts before tuning queries.
Do treat backup strategy as incomplete until restore testing succeeds.
Do align MongoDB schema and indexing with real access patterns rather than abstract normalization rules.
Do require explicit data-quality gates for analytics pipelines, including tests and freshness expectations.
Do not assume an index helps without checking selectivity, ordering needs, and write cost.
Do not recommend SELECT * in performance-sensitive paths when narrower projection is possible.
Do not merge destructive migration guidance without rollback, restore, or containment steps.
Do not equate a successful backup job with proven recoverability.
Do not hide uncertainty; ask for explain plans, schema details, cardinality, and workload shape when missing.
Troubleshooting
Symptoms: A migration looks simple in code review but causes deployment anxiety.
Solution: Check for hidden operational costs: table rewrite risk, long-lived locks, index build impact, backfill duration, replication lag, and whether the change is backward compatible across application versions.
Symptoms: A new index was added but the query is still slow.
Solution: Verify the query plan instead of assuming index usage. Check predicate selectivity, sort requirements, stale statistics, mismatched column order, and whether the query shape forces heap lookups or scans too many rows.
Symptoms: Backup jobs are green, but nobody is confident about recovery.
Solution: Ask for the most recent restore rehearsal, measured restore duration, point-in-time recovery procedure, and owner-responsible runbook. If none exist, mark restore readiness as unproven.
Symptoms: A MongoDB collection keeps growing and read performance degrades unpredictably.
Solution: Review access patterns, document growth, array usage, shard or partition strategy if relevant, and index fit. Look for anti-patterns such as unbounded arrays, over-denormalized hot documents, or indexes that do not match query predicates.
Symptoms: dbt or warehouse models pass sometimes and fail intermittently.
Solution: Check source freshness thresholds, late-arriving data behavior, uniqueness assumptions, incremental model predicates, and whether tests reflect business invariants rather than only schema constraints.
Additional Resources
references/review-criteria.md — Open this during real review work for migration-risk checks, performance triage, restore-readiness criteria, NoSQL anti-pattern review, and data-quality gates.
examples/review-example.md — Open this when you need a concrete example of weak vs strong database review output.
Related Skills
No related local skills were provided in the source context.
1---2name: database-43description: Database Workflow Bundle workflow skill. Use this skill when the user needs database development and operations workflow covering SQL, NoSQL, database design, migrations, optimization, and data engineering, and the operator should preserve the upstream workflow, copied support files, and provenance before merging or handing off.4license: Unknown5---67# Database Workflow Bundle89## Overview1011This skill preserves the upstream database workflow while making it more useful for real engineering review and execution.1213Use it when the work involves one or more of these areas:14- relational schema design15- NoSQL schema and index design16- migration planning, validation, and rollout safety17- query performance diagnosis18- backup and restore readiness19- data pipelines, freshness, and data-quality controls2021This skill is especially appropriate when you must keep provenance intact while still delivering a technically credible review, remediation plan, or implementation path.2223## When to Use2425Use this skill when the request is about database work that has operational consequences, not just syntax help.2627Activate it for tasks such as:28- reviewing a schema change before implementation29- planning or validating a migration30- diagnosing slow queries or degraded throughput31- checking whether indexing matches access patterns32- evaluating backup, restore, or rollback readiness33- reviewing ETL, CDC, or analytics-model reliability34- assessing data-quality controls such as tests, freshness, and invariants3536Do not use this skill as the primary workflow when:37- the user only wants a single SQL statement with no operational context38- the problem is purely application-layer and does not require database judgment39- the request is about vendor billing, licensing, or account administration rather than database engineering4041## Workflow42431. **Confirm scope and provenance**44 - Identify the database type: PostgreSQL, MySQL, MongoDB, warehouse, or mixed stack.45 - Confirm whether the task is design, migration, performance, operations, or data-pipeline review.46 - Preserve upstream workflow files, copied support files, and provenance anchors before proposing edits.47 - Separate facts from assumptions: engine version, table sizes, write rate, read patterns, RPO/RTO, deployment constraints.48492. **Classify the change or incident**50 - Decide whether this is primarily a schema-design issue, migration-risk issue, query-plan issue, restore-readiness issue, or data-quality issue.51 - For multi-part requests, split the work into tracks instead of treating all database problems as one class.52 - Identify blast radius: single table/collection, cross-service dependency, replication impact, analytics downstream impact.53543. **Gather concrete evidence before recommending action**55 - For SQL performance: collect the exact query shape, parameters if relevant, indexes, row counts, and planner output.56 - For migrations: inspect versioned artifacts, checksums or validation status, preconditions, and rollout ordering.57 - For operations: confirm backup format, retention, restore procedure, and whether restore testing has actually been performed.58 - For NoSQL: map access patterns, document shapes, cardinality, and index coverage.59 - For data engineering: inspect source freshness, test failures, lineage, and late-arriving or duplicate-data behavior.60614. **Review safety before suggesting execution**62 - Prefer reversible or staged changes.63 - Call out locking risk, backfill cost, replication lag, index build impact, and storage amplification.64 - Distinguish safe read-only diagnostics from write-affecting commands.65 - If the environment is production-like, avoid proposing destructive commands without explicit rollback and restore guidance.66675. **Produce a structured recommendation**68 - State the current issue in operational terms.69 - Provide the likely cause with evidence.70 - Recommend the smallest high-confidence next action.71 - Include validation criteria: what should improve, what should remain unchanged, and how to detect failure early.72 - If uncertainty remains, list the exact missing evidence instead of guessing.73746. **Add deployment and verification guidance**75 - For schema changes: define ordering, compatibility assumptions, and post-deploy verification.76 - For performance changes: compare before/after latency, rows scanned, buffer usage, or index utilization.77 - For restore readiness: require a restore test, not just backup existence.78 - For data pipelines: verify tests, freshness thresholds, and reconciliation checks.79807. **Document residual risk and handoff**81 - Record unresolved risks such as long-running locks, large backfills, skewed partitions, or stale statistics.82 - Make it clear whether the recommendation is ready for implementation, needs DBA review, or requires a rehearsal in staging.83 - Keep provenance and upstream context intact in the final handoff.8485## Examples8687### Example 1: Migration review8889**Input**90```text91Add a NOT NULL column to a large orders table and deploy this afternoon.92```9394**Good output**95```text96Risk: medium to high, depending on engine version and table size.9798Review findings:99- A direct NOT NULL addition may trigger table rewrite or prolonged locking on some engines and versions.100- The change is not yet shown as a staged migration.101- No rollback or backfill plan is documented.102103Recommended safer sequence:1041. Add the column as nullable.1052. Backfill in bounded batches.1063. Add application write path for the new field.1074. Validate null-free state.1085. Enforce NOT NULL in a separate migration.109110Verification:111- No sustained lock waits above agreed threshold.112- Backfill completes without replica lag breach.113- Row counts with NULL in the new column remain at zero before constraint enforcement.114```115116**Weak output**117```text118Run ALTER TABLE to add the column and then redeploy.119```120121### Example 2: Query-performance review122123**Input**124```sql125SELECT *126FROM orders127WHERE customer_id = 42128 AND created_at >= CURRENT_DATE - INTERVAL '30 days'129ORDER BY created_at DESC130LIMIT 50;131```132133**Expected review focus**134```text135- Confirm whether an index supports filter plus ordering, such as (customer_id, created_at DESC).136- Inspect actual planner output before recommending changes.137- Check whether SELECT * causes avoidable heap access or wide-row transfer.138- Compare before/after latency and rows scanned after any index or query change.139```140141### Example 3: Backup readiness review142143**Input**144```text145Backups are enabled every night. Are we covered?146```147148**Good output**149```text150Not enough evidence. Backup existence is not the same as recovery readiness.151152Required checks:153- backup type and retention window154- restore procedure ownership155- last successful restore rehearsal156- point-in-time recovery requirements157- time to restore compared with RTO158```159160For a fuller worked example, open [`examples/review-example.md`](examples/review-example.md).161162## Best Practices163164- **Do** treat migrations as version-controlled artifacts with validation before deployment.165- **Do** prefer expand-and-contract patterns for incompatible schema changes.166- **Do** use evidence from planner output, runtime metrics, and row counts before tuning queries.167- **Do** treat backup strategy as incomplete until restore testing succeeds.168- **Do** align MongoDB schema and indexing with real access patterns rather than abstract normalization rules.169- **Do** require explicit data-quality gates for analytics pipelines, including tests and freshness expectations.170171- **Do not** assume an index helps without checking selectivity, ordering needs, and write cost.172- **Do not** recommend `SELECT *` in performance-sensitive paths when narrower projection is possible.173- **Do not** merge destructive migration guidance without rollback, restore, or containment steps.174- **Do not** equate a successful backup job with proven recoverability.175- **Do not** hide uncertainty; ask for explain plans, schema details, cardinality, and workload shape when missing.176177## Troubleshooting178179**Symptoms:** A migration looks simple in code review but causes deployment anxiety.180181**Solution:** Check for hidden operational costs: table rewrite risk, long-lived locks, index build impact, backfill duration, replication lag, and whether the change is backward compatible across application versions.182183**Symptoms:** A new index was added but the query is still slow.184185**Solution:** Verify the query plan instead of assuming index usage. Check predicate selectivity, sort requirements, stale statistics, mismatched column order, and whether the query shape forces heap lookups or scans too many rows.186187**Symptoms:** Backup jobs are green, but nobody is confident about recovery.188189**Solution:** Ask for the most recent restore rehearsal, measured restore duration, point-in-time recovery procedure, and owner-responsible runbook. If none exist, mark restore readiness as unproven.190191**Symptoms:** A MongoDB collection keeps growing and read performance degrades unpredictably.192193**Solution:** Review access patterns, document growth, array usage, shard or partition strategy if relevant, and index fit. Look for anti-patterns such as unbounded arrays, over-denormalized hot documents, or indexes that do not match query predicates.194195**Symptoms:** dbt or warehouse models pass sometimes and fail intermittently.196197**Solution:** Check source freshness thresholds, late-arriving data behavior, uniqueness assumptions, incremental model predicates, and whether tests reflect business invariants rather than only schema constraints.198199## Additional Resources200201- [`references/review-criteria.md`](references/review-criteria.md) — Open this during real review work for migration-risk checks, performance triage, restore-readiness criteria, NoSQL anti-pattern review, and data-quality gates.202- [`examples/review-example.md`](examples/review-example.md) — Open this when you need a concrete example of weak vs strong database review output.203204## Related Skills205206No related local skills were provided in the source context.