Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Database Management

ASecurity

Database schema design, migrations, query optimization, and ORM best practices. Use for database setup, performance tuning, and data modeling.

33 stars
0 votes
0 copies
0 views
Added 2/10/2026
databasesjavascriptgojavabashsqldatabaseperformance

Security Analysis

A100/100

Scanned 2/12/2026

$npx -y skills add lovedragonball/power-ranger-toolkit --skill database-management --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Database Management?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Database Management
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/lovedragonball-database-management/badge)](https://www.skillsdirectory.com/skills/lovedragonball-database-management)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: database-management
description: Database schema design, migrations, query optimization, and ORM best practices. Use for database setup, performance tuning, and data modeling.
---

# 🗄️ Database Management Skill

## Schema Design Patterns

### Normalization Levels
| Level | Description | When to Use |
|-------|-------------|-------------|
| 1NF | No repeating groups | Always |
| 2NF | No partial dependencies | Transactional data |
| 3NF | No transitive dependencies | Most applications |
| Denormalized | Redundant data | Read-heavy workloads |

### Common Patterns
```sql
-- One-to-Many
CREATE TABLE users (id SERIAL PRIMARY KEY, name VARCHAR(100));
CREATE TABLE posts (
  id SERIAL PRIMARY KEY,
  user_id INTEGER REFERENCES users(id),
  content TEXT
);

-- Many-to-Many (Junction Table)
CREATE TABLE tags (id SERIAL PRIMARY KEY, name VARCHAR(50));
CREATE TABLE post_tags (
  post_id INTEGER REFERENCES posts(id),
  tag_id INTEGER REFERENCES tags(id),
  PRIMARY KEY (post_id, tag_id)
);
```

---

## Migration Strategies

### Prisma
```bash
# Create migration
npx prisma migrate dev --name add_users_table

# Apply to production
npx prisma migrate deploy

# Reset database
npx prisma migrate reset
```

### Drizzle
```bash
# Generate migration
npx drizzle-kit generate:pg

# Push to database
npx drizzle-kit push:pg
```

### Safe Migration Checklist
- [ ] Backup database first
- [ ] Test on staging environment
- [ ] Plan rollback strategy
- [ ] Run during low-traffic hours
- [ ] Monitor after deployment

---

## Query Optimization

### Index Strategies
```sql
-- Single column index
CREATE INDEX idx_users_email ON users(email);

-- Composite index (order matters!)
CREATE INDEX idx_posts_user_date ON posts(user_id, created_at);

-- Partial index
CREATE INDEX idx_active_users ON users(email) WHERE active = true;
```

### Common N+1 Problem
```javascript
// Bad ❌ - N+1 queries
const users = await User.findAll();
for (const user of users) {
  user.posts = await Post.findAll({ where: { userId: user.id } });
}

// Good ✅ - Eager loading
const users = await User.findAll({
  include: [{ model: Post }]
});
```

---

## ORM Best Practices

| Practice | Description |
|----------|-------------|
| Use Transactions | Wrap related operations |
| Connection Pooling | Reuse connections |
| Soft Deletes | Use `deleted_at` instead of DELETE |
| Audit Fields | Always add `created_at`, `updated_at` |
| Use Migrations | Never modify schema manually |

---

## Backup & Recovery

```bash
# PostgreSQL backup
pg_dump -U user -d database > backup.sql

# PostgreSQL restore
psql -U user -d database < backup.sql

# MySQL backup
mysqldump -u user -p database > backup.sql
```

Attribution

lovedragonballlovedragonball
View sourceSee grades on GitHubMore from lovedragonball →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Mysql Best Practices

MySQL development best practices for schema design, query optimization, and database administration

2481 votes

Jpa Patterns

Spring Boot中的JPA/Hibernate实体设计、关系、查询优化、事务、审计、索引、分页和连接池模式。

2456590 votes

Clickhouse Io

ClickHouse数据库模式、查询优化、分析和数据工程最佳实践,适用于高性能分析工作负载。

2456590 votes

Postgres Patterns

基于Supabase最佳实践的PostgreSQL数据库模式,用于查询优化、架构设计、索引和安全。

2456590 votes

Sql Pro

Master modern SQL with cloud-native databases, OLTP/OLAP

458250 votes
View all in databases →