database-patterns

A set of guidance for designing and building application databases, including PostgreSQL, MongoDB, SQLite, and Redis.

In plain words
What is it for?
It supports schema design, database selection, migrations, query optimization, indexing, and use of tools such as Prisma, Drizzle, TypeORM, and Kysely.
Why use it?
It helps choose a suitable database and avoid common problems with table structure, data relationships, migrations, queries, and access security.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/shahtuyakov/claude-setup/database-patterns
Any agent
npx skills add shahtuyakov/claude-setup --skill database-patterns
Clone the repo
git clone --depth 1 https://github.com/shahtuyakov/claude-setup

Made for: Claude Code, Codex.

Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,136 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00049 $0.01136
Opus 5 $0.00024 $0.00568
Sonnet 5 $0.00010 $0.00227
Haiku 4.5 $0.00005 $0.00114

Measured 3d ago against content hash 7e91dbf2210d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

database-patterns 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 3d 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-patterns/SKILL.md · 150 lines

How it starts

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

Database Patterns

Modern database design and implementation patterns.

Database Selection

Database Best For Use When
PostgreSQL Relational data, complex queries Structured data, ACID needed, analytics
MongoDB Document-oriented, flexible schema Rapid iteration, nested data, horizontal scale
SQLite Embedded, local-first Mobile apps, desktop apps, edge
Redis Caching, sessions High-speed reads, ephemeral data

ORM Selection

ORM Best For Trade-offs
Drizzle Performance, serverless SQL knowledge required
Prisma Developer experience Larger bundle, slower edge
TypeORM NestJS, decorators Legacy patterns
Kysely Type-safe SQL builder Lower-level

Reference Files

Topic Load Use When
Schema design references/schema-design.md Designing tables, relationships
PostgreSQL references/postgresql-patterns.md PostgreSQL-specific patterns
MongoDB references/mongodb-patterns.md MongoDB-specific patterns
ORM patterns references/orm-patterns.md Prisma, Drizzle usage
Migrations references/migrations.md Schema versioning
Security references/security.md SQL injection, encryption

Quick Start Patterns

PostgreSQL Table

CREATE TABLE users (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    email VARCHAR(255) NOT NULL UNIQUE,
    name VARCHAR(100) NOT NULL,
    password_hash VARCHAR(255) NOT NULL,
    email_verified_at TIMESTAMPTZ,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    deleted_at TIMESTAMPTZ
);

CREATE INDEX users_email_idx ON users(email) WHERE deleted_at IS NULL;

Drizzle Schema

import { pgTable, uuid, varchar, timestamp } from 'drizzle-orm/pg-core';

export const users = pgTable('users', {
  id: uuid('id').primaryKey().defaultRandom(),
  email: varchar('email', { length: 255 }).notNull().unique(),
  name: varchar('name', { length: 100 }).notNull(),
  passwordHash: varchar('password_hash', { length: 255 }).notNull(),
  emailVerifiedAt: timestamp('email_verified_at', { withTimezone: true }),
  createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
  updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
  deletedAt: timestamp('deleted_at', { withTimezone: true }),
});

Read the full file on GitHub · 150 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 3d ago First seen · 150 lines · 49 tokens per session scan A 7e91dbf2210d

Subscribe to this mod's changes

database-patterns is a skill published in the GitHub repository shahtuyakov/claude-setup (13 stars, last pushed 8mo ago), licensed MIT. It adds 49 tokens to every session and 1,136 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.

Related

Other skills, from other repositories

supabase-expert

Supabase database optimization specialist.

Vinix24/vnx-orchestration · 10 tokens

moai-domain-database

Database specialist covering PostgreSQL, MongoDB, Redis, Oracle, and cloud database platforms (Neon, Supabase, Firestore). Use for schema design, query optimization, indexing strategies, data modeling, or cloud database selection. Cloud vendor guide absorbed from moai-platform-database-cloud.

modu-ai/moai-adk · 64 tokens

ck:databases

Design schemas, write queries for MongoDB and PostgreSQL. Use for database design, SQL/NoSQL queries, aggregation pipelines, indexes, migrations, replication, performance optimization, psql CLI.

manhvann/codexkit · 44 tokens

database-engineer

SQLite database expertise for migrations, multi-tenant patterns, transactional safety, FTS5 virtual tables, and schema evolution. Use this skill for ANY work involving schema changes, data migrations, INSERT/UPSERT semantics, FTS5 rebuilds, transaction rollback design, multi-tenant data isolation, or SQLite…

Vinix24/vnx-orchestration · 121 tokens

intelligence-engineer

VNX-specific domain expertise for the intelligence system, central state databases, and dispatch lifecycle. Use when working on qualityintelligence.db / runtimecoordination.db / dispatchtracker.db, codesnippets FTS5, snippetmetadata linkage, successpatterns / antipatterns, T0 state projection (t0state.json)…

Vinix24/vnx-orchestration · 175 tokens

azure-cosmos-db

Expert knowledge for Azure Cosmos DB development including troubleshooting, best practices, decision making, architecture & design patterns, limits & quotas, security, configuration, integrations & coding patterns, and deployment. Use when using Cosmos DB SQL/Mongo/Cassandra APIs, change feed, multi-region HA, vector…

MicrosoftDocs/Agent-Skills · 120 tokens