database-management
БесплатноБез исполняемых скриптовНе проверен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
-- 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
# Create migration
npx prisma migrate dev --name add_users_table
# Apply to production
npx prisma migrate deploy
# Reset database
npx prisma migrate reset
Drizzle
# 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
-- 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
// 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
# 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
Установить database-management в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл database-management?
Database schema design, migrations, query optimization, and ORM best practices. Use for database setup, performance tuning, and data modeling.
Как установить скилл database-management?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл database-management запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic