database-patterns

database-patterns is a skill for Claude Code, Codex from shahtuyakov/claude-setup. It costs 49 tokens per session (1,136 once invoked), scanned A, original, MIT.

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

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

Good fit It supports schema design, database selection, migrations, query optimization, indexing, and use of tools such as Prisma, Drizzle, TypeORM, and Kysely.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/shahtuyakov/claude-setup/database-patterns
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 shahtuyakov/claude-setup --skill database-patterns
Clone the repo
git clone --depth 1 https://github.com/shahtuyakov/claude-setup

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-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/shahtuyakov/claude-setup/database-patterns/github.svg)](https://agentmods.dev/skills/shahtuyakov/claude-setup/database-patterns)
Your own site
<a href="https://agentmods.dev/skills/shahtuyakov/claude-setup/database-patterns"><img src="https://agentmods.dev/badge/skills/shahtuyakov/claude-setup/database-patterns/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-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/shahtuyakov/claude-setup/database-patterns"><img src="https://agentmods.dev/badge/skills/shahtuyakov/claude-setup/database-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. A grade says what 26 rules found in the file — not that it is safe.
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.00049 $0.01136
Opus 5.5 $0.00020 $0.00454
Sonnet 5.5 $0.00010 $0.00227
Haiku 4.5 $0.00005 $0.00114

Measured 1mo ago against content hash 7e91dbf2210d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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. 1mo 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 9mo ago), licensed MIT. It adds 49 tokens to every session and 1,136 once invoked, about $0.0002 per session on Opus 5.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

database-expert

Advanced database design and administration for PostgreSQL, MongoDB, and Redis. Use when designing schemas, optimizing queries, managing database performance, or implementing data patterns.

travisjneuman/.claude · 36 tokens

software-database-design

Designs database schemas, migrations, and data models for PostgreSQL, MySQL, MongoDB, and Redis. Use when planning tables, relationships, indexes, or ORM-backed schema changes.

vasilyu1983/AI-Agents-public · 43 tokens

agent-database-expert

Specialist subagent: Expert database architect and engineer for PostgreSQL, MongoDB, Redis, and all major databases. Use when designing schemas, optimizing queries, planning migrations, implementing caching, or troubleshooting database performance.

travisjneuman/.claude · 49 tokens

database-migrator

Migrates databases between providers (Postgres, MySQL, Supabase, PlanetScale, MongoDB). Reads source schema, generates migration scripts, handles data type mapping, foreign keys, indexes, triggers, stored procedures. Validates migration with row counts and checksums. Generates migration-plan.md with step-by-step…

OneWave-AI/claude-skills · 76 tokens

database-schema-designer

Designs relational and document database schemas from requirements or an existing app - tables and collections, keys, relationships, constraints, indexes driven by real query patterns, ERDs, and reversible migration scripts - with PostgreSQL (including Supabase) as the default and MySQL, SQLite, and MongoDB supported.…

OneWave-AI/claude-skills · 141 tokens

engineer

Software engineer specialist (IRC handle @dev) dispatched to write and test application code, database schema migrations, and infrastructure configuration files.

NexaDuo/mARC · 30 tokens