database-design

database-design is a skill for Claude Code, Codex from MoizIbnYousaf/Ai-Agent-Skills. It costs 36 tokens per session (1,113 once invoked), scanned A, original, MIT.

A reference guide for designing databases and changing or improving their structure across PostgreSQL, MySQL, and NoSQL systems.

In plain words
What is it for?
Designing schemas, writing migrations, choosing normalized or denormalized data structures, and optimizing queries and indexes.
Why use it?
It helps avoid poorly organized data, unsafe changes, and slow searches by covering table structure, relationships, migrations, and indexes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

not rated 1.1krepo 23d ago A scan Socket: passSnyk: passSkillSpector: pass 36 tokens original MIT

Good fit Designing schemas, writing migrations, choosing normalized or denormalized data structures, and optimizing queries and indexes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/moizibnyousaf/ai-agent-skills/database-design
About the project

AI Agent Skills is a curated library and package manager for installing, organizing, and creating skills for compatible AI coding agents. It is for developers who want to manage reusable agent instructions through a command-line or terminal interface. The catalogue skills and agents are examples of the kind of add-ons it helps manage.

MoizIbnYousaf/Ai-Agent-Skills · 1,134 stars · on GitHub · npmjs.com

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add MoizIbnYousaf/Ai-Agent-Skills --skill database-design
Clone the repo
git clone --depth 1 https://github.com/MoizIbnYousaf/Ai-Agent-Skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for database-design

README.md
[![agentmods](https://agentmods.dev/badge/skills/moizibnyousaf/ai-agent-skills/database-design/github.svg)](https://agentmods.dev/skills/moizibnyousaf/ai-agent-skills/database-design)
Your own site
<a href="https://agentmods.dev/skills/moizibnyousaf/ai-agent-skills/database-design"><img src="https://agentmods.dev/badge/skills/moizibnyousaf/ai-agent-skills/database-design/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for database-design

Your own site · 80×15
<a href="https://agentmods.dev/skills/moizibnyousaf/ai-agent-skills/database-design"><img src="https://agentmods.dev/badge/skills/moizibnyousaf/ai-agent-skills/database-design.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,113 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 3 Apr 2026
  • Snyk pass 3 Apr 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00036 $0.01113
Opus 5 $0.00018 $0.00557
Sonnet 5 $0.00007 $0.00223
Haiku 4.5 $0.00004 $0.00111

Measured 10d ago against content hash 6c74dbafbeee, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

database-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/database-design/SKILL.md · 179 lines

How it starts

The opening of the file, as written. The whole thing — 179 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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);

-- Composite index (order matters!)
CREATE INDEX idx_orders_user_date ON orders(user_id, created_at DESC);

-- Partial index for specific conditions
CREATE INDEX idx_active_users ON users(email) WHERE deleted_at IS NULL;

-- GIN index for array/JSONB columns
CREATE INDEX idx_posts_tags ON posts USING GIN(tags);

-- Covering index (includes additional columns)
CREATE INDEX idx_orders_covering ON orders(user_id) INCLUDE (total, status);

Index Analysis

-- Check index usage
SELECT
  schemaname, tablename, indexname,
  idx_scan, idx_tup_read, idx_tup_fetch
FROM pg_stat_user_indexes
ORDER BY idx_scan DESC;

-- Find missing indexes
SELECT
  relname, seq_scan, seq_tup_read,
  idx_scan, idx_tup_fetch
FROM pg_stat_user_tables
WHERE seq_scan > idx_scan
ORDER BY seq_tup_read DESC;

Migration Patterns

Safe Migration Template

-- Always use transactions
BEGIN;

-- Add column with default (non-blocking in PG 11+)
ALTER TABLE users ADD COLUMN status VARCHAR(20) DEFAULT 'active';

-- Create index concurrently (doesn't lock table)
CREATE INDEX CONCURRENTLY idx_users_status ON users(status);

-- Backfill data in batches
UPDATE users SET status = 'active' WHERE status IS NULL AND id BETWEEN 1 AND 10000;

COMMIT;

Read the full file on GitHub · 179 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 179 lines · 36 tokens per session scan A 6c74dbafbeee

Subscribe to this mod's changes

database-design is a skill published in the GitHub repository MoizIbnYousaf/Ai-Agent-Skills (1,134 stars, last pushed 23d ago), licensed MIT. It adds 36 tokens to every session and 1,113 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.