# Database Skill

> Design and manage relational databases including table creation, migrations, and schema design. Use for database modeling and maintenance.

- Skill: `diegosouzapw/database-skill` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add diegosouzapw/database-skill`
- Raw SKILL.md: https://api.skillmd.com/api/skills/diegosouzapw/database-skill/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: diegosouzapw (https://skillmd.com/u/diegosouzapw)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/diegosouzapw/database-skill

---


# Database Skill – Schema Design & Migrations

## Instructions

1. **Table Creation**
   - Define clear and consistent table structures
   - Use appropriate data types and constraints
   - Apply primary keys and foreign keys correctly

2. **Schema Design**
   - Normalize data where appropriate
   - Model relationships explicitly
   - Design for scalability and maintainability

3. **Migrations**
   - Create forward and backward migrations
   - Ensure migrations are idempotent and safe
   - Avoid destructive changes without backups

4. **Indexes & Constraints**
   - Add indexes for frequently queried columns
   - Enforce uniqueness and referential integrity
   - Use constraints to protect data correctness

## Best Practices
- Use consistent naming conventions
- Keep schemas simple and well-documented
- Version control all migrations
- Test migrations in non-production environments
- Follow relational database design principles

## Example Structure
```sql
CREATE TABLE users (
  id UUID PRIMARY KEY,
  email TEXT UNIQUE NOT NULL,
  password_hash TEXT NOT NULL,
  created_at TIMESTAMP DEFAULT NOW()
);

