database-patterns

Standardize database schema design and migration processes for relational databases and ORMs.

Updated Apr 11, 2026
One-click install
npx skills add https://github.com/bennybennison/agent-toolkit --skill database-patterns-bennybennison
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-patterns
Source: https://github.com/bennybennison/agent-toolkit/tree/main/skills/database-patterns
Command: npx skills add https://github.com/bennybennison/agent-toolkit --skill database-patterns-bennybennison

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Inconsistent database schemas, migrations, and query patterns lead to bugs, maintenance overhead, and performance issues across projects and teams.

Core Features & Use Cases

  • Naming conventions for tables, columns, foreign keys, and indexes to ensure predictability.
  • Required columns like id, created_at, and updated_at for auditability.
  • Migration patterns that enforce single‑purpose, reversible, and well‑ordered migrations.
  • Repository and transaction patterns to isolate data access logic and keep operations atomic.
  • Anti‑patterns guidance to avoid embedding business logic in SQL or using unbounded queries.

Quick Start

Ask the skill for a checklist of naming conventions to use when creating a new user_accounts table.

Frequently Asked Questions about database-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What naming conventions should I use for database schema tables and foreign keys?

Database schema naming conventions enforce predictable table, column, foreign key, and index names across any relational database engine. Applying these standards prevents bugs and reduces maintenance overhead during query construction.

How do I write reversible database migrations that don't break production?

Reversible database migrations must be single-purpose and well-ordered to avoid breaking production. Enforcing structured migration patterns ensures each schema change can be safely rolled back without losing data integrity.

Do I need required columns like id and created_at in every database table?

Required columns like id, created_at, and updated_at are necessary in every database table for auditability. Enforcing these required columns ensures consistent record tracking and primary key identification across your schema.

What's the best way to isolate data access logic using the repository pattern?

The repository pattern isolates data access logic by separating database queries from business logic. Combining repository and transaction patterns keeps database operations atomic and prevents embedding business logic directly in SQL.

Why should I avoid embedding business logic in SQL queries and using unbounded queries?

Embedding business logic in SQL queries and using unbounded queries are anti-patterns that cause maintenance overhead and performance degradation. Following anti-pattern guidance keeps query patterns clean and prevents unbounded data retrieval.