AgentStack
SKILL verified MIT Self-run

Database

skill-kreek-consult-database · by kreek

Use for databases, schemas, migrations, indexes, transactions, query plans, and locking.

No reviews yet
0 installs
4 views
0.0% view→install

Install

$ agentstack add skill-kreek-consult-database

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Database? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Database

Iron Law

PROTECT PRODUCTION DATA FIRST: PROVE ROLLOUT, LOCKING, AND RECOVERY BEFORE CHANGE.

When to Use

  • Schema design, migrations, indexes, query plans, isolation levels,

connection pools, soft delete, N+1 fixes, online DDL, transactional outbox/CDC, or production data changes.

When NOT to Use

  • API contract design; use api.
  • Rollout sequencing outside the database; pair with release.
  • Cache freshness and invalidation; use performance.

Core Ideas

  1. Schema, migration, and destructive data changes are the user's call.

Route schema and migration changes through contract-first; data deletion and non-reversible backfills need the same approval for data safety. An approving design or RFC is not that approval; the concrete schema, migration, or destructive change gets its own sign-off before landing.

  1. Use the project's existing database unless the task is choosing a store.

For greenfield defaults and store-selection caveats, use architecture.

  1. Expand, migrate, verify, switch, then contract in separate

deployable steps.

  1. Review SQL and lock behavior, not just ORM code.
  2. Backfills are batched, resumable, observable, and reversible.
  3. Constraints enforce invariants. Every uniqueness invariant needs a DB-level

UNIQUE, EXCLUDE, composite, or partial equivalent. Application-layer checks race under concurrency.

  1. Indexes and plans follow real access paths. New foreign keys and known

WHERE, JOIN, or ORDER BY predicates need supporting indexes in the same migration, or a stated reason they do not; query changes need EXPLAIN/ANALYZE plans on production-shaped data.

  1. Isolation level is a design decision; retries are part of

serializable correctness.

  1. State changes and durable publication need atomicity through

transactional outbox, CDC, or an equivalent handoff when the two cannot silently diverge.

  1. Data recovery is part of the change: backup/PITR must cover the

blast radius.

Workflow

  1. Classify the change as schema, data, query, index, constraint,

transaction, or operational tuning. Identify table size, write rate, lock risk, rollback path, and deploy order.

  1. Review migration files directly for destructive operations and lock

behavior. Capture EXPLAIN/ANALYZE for important query changes on representative data.

  1. Split unsafe changes into expand-contract phases. Document

verification and rollback in the PR or deploy note.

Verification

  • [ ] Migration SQL was reviewed for destructive changes and locking.
  • [ ] Destructive or tightening changes are split across expand-contract

phases.

  • [ ] Backfills are batched and resumable; each batch holds locks

briefly.

  • [ ] Every uniqueness invariant in the change is enforced by a DB constraint

or equivalent engine-specific mechanism, not application-layer logic.

  • [ ] New FK columns and known query predicates (WHERE, JOIN, ORDER BY)

have supporting indexes in the same migration, or the omission is explicitly justified.

  • [ ] Index/constraint creation uses the online mechanism for the

target database.

  • [ ] Engine-specific DDL uses references/online-ddl.md and was verified

against the target engine before claiming done. SQLite passing is not proof of Postgres behavior.

  • [ ] Important query changes include representative EXPLAIN/ANALYZE

evidence.

  • [ ] Isolation level and retry behavior are explicit for transactional

changes.

  • [ ] State changes and event/job publication cannot diverge silently

when the workflow depends on both.

  • [ ] Rollback and backup/PITR coverage are documented.
  • [ ] Schema and migration changes were routed through contract-first,

and destructive data operations (deletion, non-reversible backfills) had explicit user approval before landing.

  • [ ] An approving design or RFC did not stand in for sign-off on the concrete

schema, migration, or destructive data change. Each got explicit approval before landing.

Tripwires

Use these when the shortcut thought appears:

  • Use the target engine's online mechanism or document why production size and

write rate cannot matter.

  • Measure lock behavior on representative load or assume the worst case.
  • Ship the backfill plan now or leave the schema expand-only.
  • Decide soft-delete lifecycle once and enforce reads, indexes, and schema

around it.

  • Observe a full traffic cycle before dropping an index.
  • Enforce correctness invariants with DB constraints, not application checks.
  • Add supporting indexes in the same migration when access paths are known.
  • Check target-engine semantics for partial, expression, deferrable, exclusion,

and specialized indexes before relying on them.

  • Load security before adding password, token, API key, MFA, recovery-code, or

sensitive-PII storage.

Handoffs

  • contract-first: schema, migration, or stored-shape approval before

implementation locks the change.

  • release: deploy ordering, rollback rehearsal, feature flags.
  • performance: measured query latency or throughput change.
  • observability: migration and query dashboards/alerts.
  • async-systems: stream or worker consumers after durable handoff.
  • security: credentials, secrets, tokens, MFA factors, sensitive PII.

References

  • references/online-ddl.md: online migration patterns.
  • references/explain-and-isolation.md: EXPLAIN and isolation notes.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.