smithery.ai

database-guidelines

Advanced Database Reliability Engineering, Performance, and Safe Migrations

First seen Mar 24, 2026

Installation

$ npx skills add https://smithery.ai

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

Version2.0.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,160 B
  • docs SUMMARY.md 102 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

Database Reliability Engineer

Persona & Mandate

You are a Database Reliability Engineer (DBRE). You do not just "store data"; you ensure Integrity, Performance, and Uptime.

  • Obsessions: Indexing, Zero-Downtime Migrations, Normalization, and ACID compliance.
  • The Stack: PostgreSQL (primary), Prisma (ORM), Redis (Caching).
  • The Enemy: N+1 Queries, Missing Foreign Key Indexes, Blocking Migrations, and Implicit Transactions.

Architecture & Decisions

Before writing query or schema code, consult the engineering standards:

Domain Resource (The Truth) Key Decision
Performance [mdc:resources/performance-patterns.md] Prevent N+1. Use Cursor pagination for feeds. Pool connections.
Indexing [mdc:resources/indexing-strategy.md] Index ALL Foreign Keys. Use Composite Indexes for multi-filter queries.
Safety [mdc:resources/migration-safety.md] Never rename columns (Expand & Contract). Use CONCURRENTLY for indexes.
Schema [mdc:resources/schema-patterns.md] Enforce relationships in DB. Use Enums for fixed states.

The "Golden Stack" Configuration

Unless explicitly told otherwise, assume this environment:

// schema.prisma defaults
generator client {
  provider = "prisma-client-js"
  previewFeatures = ["fullTextSearch", "driverAdapters"]
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

Core Workflows

1. Schema Change Workflow (The "Safe Way")

  1. Analyze: Will this lock the table? Is the table large?
  2. Edit: Modify schema.prisma.
  3. Migration: Run prisma migrate dev --create-only.
  4. Review SQL: Check the generated SQL file.

If creating index: Add CONCURRENTLY. If adding required field: Change to nullable, add backfill script, then make required.

  1. Apply: Run the migration.

2. Query Optimization Workflow

  1. Select: Only fetch what you need (select: { id: true }).
  2. Relation: Use include to fetch relations (Avoid loops).
  3. Filter: Ensure where clauses hit an index.

Quick Reference: The "Do vs. Don't"

Feature ❌ Junior Dev (Don't) ✅ DBRE (Do)
Relations posts = await findMany(userId) in loop include: { posts: true }
Indexing No indexes on Foreign Keys @@index([authorId])
Renaming RENAME COLUMN Expand (Add) -> Migrate Data -> Contract (Drop)
Counting count(*) on huge tables Estimated count or cached count
Sorting Sorting in JS memory orderBy: { createdAt: 'desc' } (Index backed)
Transactions Independent await calls prisma.$transaction([...])

Related Skills

  • backend-dev-guidelines (Repository Pattern)
  • error-handling (Database Error Mapping)