yd-db-expert

yd-db-expert is a skill for Claude Code from LeeYudok/agents-scaffold. It costs 129 tokens per session (2,569 once invoked), scanned A, original, MIT.

A database design guide for relational databases, which store data in tables linked by relationships. It covers schema structure, keys, NULL meanings, constraints, indexes, query patterns, transactions, and migrations without depending on one database engine.

In plain words
What is it for?
Use it to design tables and relationships, choose keys and constraints, decide when to normalize data, avoid N+1 queries, use placeholders and cursor pagination, define transaction boundaries, and plan migrations.
Why use it?
Poor database design can cause duplicate or inconsistent data, slow queries, unsafe pagination, and migration problems. This guide provides general rules while leaving PostgreSQL, Oracle, and SQLite-specific behavior to their own specialists.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: reads .claude/ paths.

Good fit Use it to design tables and relationships, choose keys and constraints, decide when to normalize data, avoid N+1 queries, use placeholders and cursor pagination, define transaction boundaries, and plan migrations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/leeyudok/agents-scaffold/yd-db-expert
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 LeeYudok/agents-scaffold --skill yd-db-expert
Clone the repo
git clone --depth 1 https://github.com/LeeYudok/agents-scaffold

Made for: Claude Code.

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 yd-db-expert

README.md
[![agentmods](https://agentmods.dev/badge/skills/leeyudok/agents-scaffold/yd-db-expert/github.svg)](https://agentmods.dev/skills/leeyudok/agents-scaffold/yd-db-expert)
Your own site
<a href="https://agentmods.dev/skills/leeyudok/agents-scaffold/yd-db-expert"><img src="https://agentmods.dev/badge/skills/leeyudok/agents-scaffold/yd-db-expert/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 yd-db-expert

Your own site · 80×15
<a href="https://agentmods.dev/skills/leeyudok/agents-scaffold/yd-db-expert"><img src="https://agentmods.dev/badge/skills/leeyudok/agents-scaffold/yd-db-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 129 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,569 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.00129 $0.02569
Opus 5.5 $0.00052 $0.01028
Sonnet 5.5 $0.00026 $0.00514
Haiku 4.5 $0.00013 $0.00257

Measured today against content hash cb1d7234f7a3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

yd-db-expert 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 today.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/verify_db_claims.py, tests/test_db_claims.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.claude/skills/yd-db-expert/SKILL.md · 133 lines

How it starts

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

yd-db-expert

엔진과 무관한 관계형 설계가 대상이다. 잠금·테이블 재작성·실행계획 읽는 법·타입 세부처럼 엔진마다 다른 동작은 엔진 스킬이 맡는다 — PostgreSQL 은 yd-pg-expert, Oracle 은 yd-oracle-expert, SQLite 파일은 yd-sqlite-expert. 애플리케이션 코드는 각 언어 스킬이 맡는다.

아래 단언 가운데 SQL 의미론에 관한 것은 scripts/verify_db_claims.py 가 SQLite 로 재현한다(8장). 같은 의미론은 표준 SQL 이라 PostgreSQL·Oracle 에서도 같다. 엔진마다 갈리는 지점은 본문에 적었다.

1. 스키마 설계 — 판단 기준

정규화는 목적이 아니라 이상현상(anomaly)을 없애는 수단이다. 3NF 를 기본으로 두고, 역정규화는 측정된 병목이 있을 때만, 그리고 갱신 경로를 하나로 유지할 수 있을 때만.

설계하기 전에 스스로 답한다:

  1. 이 테이블의 한 행은 무엇 하나인가 — 한 문장으로 안 되면 쪼갤 신호다.
  2. 자연키인가 대리키인가 — 사업자번호·사번처럼 외부가 소유한 값은 바뀐다. 대리키(식별자)를 두고 자연키에는 유니크 제약을 건다.
  3. 이 컬럼이 NULL 일 수 있는 실제 상황은 무엇인가 — 답이 없으면 NOT NULL. NULL 은 "모름"이지 "없음"이나 "0"이 아니다.
  4. 삭제하면 무엇이 같이 사라져야 하는가 — FK 의 ON DELETE 를 의도적으로 정한다. 기본값에 맡기지 않는다.

제약은 애플리케이션이 아니라 DB 에 건다

NOT NULL·UNIQUE·CHECK·FOREIGN KEY 는 마지막 방어선이다. 애플리케이션 검증은 사용자 경험용이고, 데이터 무결성은 DB 가 보장한다. 버그·수동 작업·다른 클라이언트는 애플리케이션을 우회한다. 제약이 없는 테이블에 수동 SQL 세 줄을 넣으면 NULL·중복·음수 잔액이 그대로 들어가고, 제약이 있는 테이블은 셋 다 거부한다.

NULL 의 의미론

  • NULL = NULL 은 참이 아니라 NULL 이다. WHERE col = NULL 은 아무 행도 고르지 못한다. IS NULL 을 쓴다. col <> 'x' 도 NULL 인 행을 고르지 않는다.
  • NOT IN 서브쿼리에 NULL 이 하나라도 있으면 결과가 통째로 빈다. 오류도 경고도 없다. 서브쿼리 컬럼이 NULL 을 허용하면 NOT EXISTS 를 쓴다.
  • UNIQUE 는 NULL 끼리 같다고 보지 않는다. NULL 행이 여러 개여도 통과한다. "값이 하나뿐" 이 규칙이면 NOT NULL 을 함께 건다. NULL 도 하나만 허용하는 방법은 엔진마다 다르다.

시간과 통화

  • 시각은 타임존이 붙은 형식으로 저장한다. 저장은 UTC, 표시에서 변환한다. 엔진별 타입 선택은 엔진 스킬이 맡는다. 사용자 표기는 YYYY-MM-DD HH:MM:SS.mmm (KST 가정).
  • 돈은 고정소수점(numeric/decimal)이나 최소 단위 정수(원·센트)로 저장한다. 부동소수점 금지.

소프트 삭제

deleted_at 을 도입하면 모든 조회에 조건이 붙는다. 빠뜨린 한 곳이 사고가 된다. 정말 필요하면 뷰나 행 수준 보안으로 강제하고, 아니면 이력 테이블로 옮기는 편이 낫다.

일반 UNIQUE 는 탈퇴한 이메일의 재가입을 막는다. 삭제 표시만 한 행이 값을 쥐고 있어서다. 살아 있는 행에만 거는 부분 유니크 인덱스(WHERE deleted_at IS NULL)는 재가입을 허용하고 활성 중복은 막는다. 부분 인덱스가 없는 엔진은 엔진 스킬에서 대안을 찾는다.

2. 인덱스

  • WHERE·JOIN·ORDER BY 에 쓰이는 컬럼이 후보다. 전부 만들지 않는다 — 인덱스는 쓰기 비용과 저장공간을 먹는다.
  • 복합 인덱스는 앞 컬럼부터 쓰인다. 등호 조건 컬럼을 앞에, 범위 조건 컬럼을 뒤에 둔다.
  • FK 를 선언해도 자식 컬럼 인덱스는 생기지 않는다 (PostgreSQL·SQLite 실측). 부모를 지우거나 부모 기준으로 자식을 찾을 때 자식 테이블 전체를 훑으므로 직접 만든다.
  • 함수를 씌운 조건은 컬럼 인덱스를 못 탄다. WHERE lower(name) = ... 는 name 인덱스를 쓰지 않는다. 쿼리를 바꾸거나 표현식 인덱스를 만든다.
  • 인덱스를 추가하기 전에 쿼리를 고칠 수 있는지 먼저 본다. 판단은 추측이 아니라 실행계획으로 하고, 실행계획 읽는 법은 엔진 스킬을 따른다.

Read the full file on GitHub · 133 lines

Files

What ships with it

3 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. today First seen · 133 lines · 129 tokens per session scan A cb1d7234f7a3

Subscribe to this mod's changes

yd-db-expert is a skill published in the GitHub repository LeeYudok/agents-scaffold (36 stars, last pushed today), licensed MIT. It adds 129 tokens to every session and 2,569 once invoked, about $0.0005 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-10-25.

Related

Other skills, from other repositories

migration

Generate and manage database migrations.

SpaceMalamute/ai-rules · 7 tokens

memstack-development-migration-planner

Use this skill when the user says 'migration', 'schema change', 'database migration', 'alter table', 'add column', 'change type', 'rollback plan', or needs safe database schema evolution with zero-downtime strategies. Do NOT use for initial database design (use database-architect) or code refactoring.

cwinvestments/memstack · 73 tokens

memstack-security-rls-checker

Use this skill when the user says 'check RLS', 'audit RLS', 'RLS policies', 'row level security', 'Supabase security audit', or needs to verify table-level access control. Audits Supabase Row Level Security policies across all tables. Do NOT use for non-Supabase projects or writing RLS policies from scratch.

cwinvestments/memstack · 80 tokens

memstack-security-rls-guardian

Use this skill when creating or altering database tables in Supabase or PostgreSQL projects. Triggers include: CREATE TABLE, ALTER TABLE, migration files, 'RLS', 'row level security', 'new table', 'database schema'. Enforces Row Level Security policies on every table to prevent unauthorized data access. Do NOT use for…

cwinvestments/memstack · 84 tokens

elasticsearch-best-practices

Elasticsearch development best practices for indexing, querying, and search optimization.

Mindrally/skills · 20 tokens

kysely

Guidelines for developing with Kysely, a type-safe TypeScript SQL query builder with autocompletion support.

Mindrally/skills · 26 tokens