
Database Design
This is a solid reference for PostgreSQL schema design and migrations, with practical examples for indexing strategies, normalization tradeoffs, and zero-downtime deployments. The code snippets are actually useful, showing things like partial indexes, covering indexes, and the right way to use EXPLAIN ANALYZE. The migration patterns section is probably the most valuable part, walking through the five-step process for changing columns without downtime. It focuses heavily on Postgres with some general SQL principles, so if you're deep in MySQL or NoSQL you'll need to adapt. The query optimization section covers the classics like EXISTS over IN and cursor-based pagination. Good for mid-level developers who know SQL basics but haven't spent years optimizing production databases.
- skills.sh installs
- 394
- GitHub stars
- 1.1K
- last updated
- Jun 3, 2026
Install
$ npx -y skills add skillcreatorai/ai-agent-skills --skill database-design --agent claude-codeInstalls into .claude/skills of the current project.
Files
Database Design
Schema Design Principles
Normalization Guidelines
-- 1NF: Atomic values, no repeating groups
-- 2NF: No partial dependencies on composite keys
-- 3NF: No transitive dependencies
-- Users table (normalized)
CREATE TABLE users (
id SERIAL PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Addresses table (separate entity)
CREATE TABLE addresses (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
street VARCHAR(255),
city VARCHAR(100),
country VARCHAR(100),
is_primary BOOLEAN DEFAULT false
);
Denormalization for Performance
-- When read performance matters more than write consistency
CREATE TABLE order_summaries (
id SERIAL PRIMARY KEY,
order_id INTEGER REFERENCES orders(id),
customer_name VARCHAR(255), -- Denormalized from customers
total_amount DECIMAL(10,2),
item_count INTEGER,
last_updated TIMESTAMPTZ DEFAULT NOW()
);
Index Design
Common Index Patterns
-- B-tree (default) for equality and range queries
CREATE INDEX idx_users_email ON users(email);
Sponsors
Details
- Repository
- github.com/skillcreatorai/ai-agent-skills
- Categories
- Backend & APIs, AI & Agent Building, Design & UI/UX, Databases
- First seen
- Jun 3, 2026
More from skillcreatorai/ai-agent-skills
All 30- Expo App Design363
- Llm Application Dev314
- Python Development314
- Content Research Writer284
- Ask Questions If Underspecified263
- Changelog Generator260
- Canvas Design223
- Job Application214
- Javascript Typescript211
- Xlsx172
- Web Design Guidelines164
- Docx157
- Webapp Testing155
- Pptx149
- Frontend Design143
- Jira Issues141
- Skill Creator131
- Lead Research Assistant128
- Pdf124
- Video Downloader121
- Vercel Deploy120
- Qa Regression118
- File Organizer116
- Brand Guidelines115