dok3-pg

dok3-pg is a skill for Claude Code from LeeYudok/agents-scaffold. It costs 85 tokens per session (2,864 once invoked), scanned A, original, MIT.

A guide to PostgreSQL, an open-source database server, and to operating a shared PostgreSQL cluster used by multiple services. It covers PostgreSQL-specific types, query plans, locks, concurrent index creation, vacuuming, and serialization retries.

In plain words
What is it for?
Use it when writing or reviewing PostgreSQL queries, inspecting execution plans, adding indexes safely, scheduling maintenance, handling concurrent changes, or retrying serialization failures.
Why use it?
PostgreSQL has behavior that generic database advice does not fully describe, such as time-zone handling, exact money values, foreign-key indexes, and operations that can block other work. The guide helps check these details against the actual database version.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: reads .claude/ paths.

Part of the yd-skills plugin — 20 skills shipped together

Good fit Use it when writing or reviewing PostgreSQL queries, inspecting execution plans, adding indexes safely, scheduling maintenance, handling concurrent changes, or retrying serialization failures.

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

Made for: Claude Code.

Or install yd-skills, the plugin that ships this one along with the rest of its 20 skills.

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 dok3-pg

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/leeyudok/agents-scaffold/dok3-pg"><img src="https://agentmods.dev/badge/skills/leeyudok/agents-scaffold/dok3-pg.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 85 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,864 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.00085 $0.02864
Opus 5.5 $0.00034 $0.01146
Sonnet 5.5 $0.00017 $0.00573
Haiku 4.5 $0.00009 $0.00286

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

Security

Grade A, and why

dok3-pg 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_pg_claims.py, tests/test_pg_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.

plugins/yd-skills/skills/dok3-pg/SKILL.md · 152 lines

How it starts

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

dok3-pg

PostgreSQL 엔진 고유 동작과 공유 클러스터 운영이 대상이다. 엔진과 무관한 설계(정규화·키·NULL·제약·쿼리 원칙·트랜잭션 경계·마이그레이션 단계)는 dok3-db, SQLite 파일 문제는 dok3-sqlite 가 맡는다. 여기서는 그 원칙을 반복하지 않는다.

엔진 동작에 관한 단언은 scripts/verify_pg_claims.py 가 일회용 서버에서 재현한다. 아래 관찰값은 PostgreSQL 17.11 에서 얻었다 (2026-10-04 실측). 버전을 올리면 다시 돌린다.

1. 타입

  • 타임스탬프는 timestamptz. timestamp 는 입력에 붙은 오프셋을 오류 없이 버린다. '2026-01-01 09:00:00+09' 를 넣으면 09:00:00 이 그대로 남아 UTC 로 읽을 때 9시간 어긋난다. timestamptz 는 같은 순간(00:00:00+00)을 유지한다.
  • 저장은 UTC, 표시에서 변환한다. 사용자 표기는 YYYY-MM-DD HH:MM:SS.mmm (KST 가정).
  • 돈은 numeric. float8 은 0.1 + 0.2 = 0.3 이 거짓이고, 0.1 을 열 번 더하면 0.9999999999999999 다. numeric 은 둘 다 정확하다.
  • UNIQUE 는 별도 옵션이 없으면 NULL 을 여러 개 허용한다. NULL 도 하나만 허용하려면 UNIQUE NULLS NOT DISTINCT (PostgreSQL 15 부터)를 쓴다.

2. 인덱스와 실행계획

  • FK 컬럼에는 인덱스가 자동으로 생기지 않는다. PK·UNIQUE 만 생긴다. 부모 행을 지우거나 키를 바꿀 때 자식 테이블을 풀스캔하므로 FK 인덱스는 직접 만든다.
  • 확인은 추측이 아니라 EXPLAIN (ANALYZE, BUFFERS) <쿼리> 로 한다.
  • EXPLAIN ANALYZE 는 문을 실제로 실행한다. DELETE·UPDATE 를 분석하면 행이 정말 지워진다. 쓰기 문은 BEGIN; EXPLAIN ANALYZE ...; ROLLBACK; 으로 감싼다.
  • 작은 테이블의 Seq Scan 은 인덱스 누락이 아니다. 20행 테이블은 PK 가 있어도 플래너가 일부러 순차 스캔을 고른다. 원인을 찾을 대상은 큰 테이블의 Seq Scan 이다.
  • 함수를 씌운 조건(WHERE lower(name) = ...)은 name 인덱스를 못 탄다. CREATE INDEX ... ON t (lower(name)) 표현식 인덱스를 만든다.
  • C 가 아닌 콜레이션 컬럼의 일반 인덱스는 LIKE 'abc%' 에 쓰이지 않는다. 공식 postgres 컨테이너 이미지의 기본 콜레이션은 en_US.utf8 이다. 접두 검색이 필요하면 text_pattern_ops 인덱스를 따로 만든다.
  • 부분 인덱스(WHERE status = 'pending')는 조회 조건이 인덱스 조건을 함의할 때만 쓰인다. status = 'done' 조회에는 쓰이지 않는다.

3. 잠금과 온라인 스키마 변경

모든 ALTER TABLE 은 짧게라도 ACCESS EXCLUSIVE 잠금을 잡는다. 관건은 두 가지다 — 테이블을 다시 쓰는가(잠금이 데이터 크기에 비례해 길어진다), 잠금을 기다리는 동안 무엇이 막히는가.

변경 테이블 재작성
ADD COLUMN (기본값 없음, NULL 허용) 없음
ADD COLUMN ... NOT NULL DEFAULT 0 (상수 기본값) 없음 (PostgreSQL 11 부터)
ADD COLUMN ... DEFAULT clock_timestamp() (volatile 기본값) 있음
ALTER COLUMN ... TYPE bigint (int 에서) 있음
varchar(10) → varchar(20), varchar → text 없음
ALTER COLUMN ... SET NOT NULL 없음. 대신 잠금을 쥔 채 전체를 스캔한다

Read the full file on GitHub · 152 lines

Files

What ships with it

4 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 · 152 lines · 85 tokens per session scan A b696a4ee82f0

Subscribe to this mod's changes

dok3-pg is a skill published in the GitHub repository LeeYudok/agents-scaffold (40 stars, last pushed today), licensed MIT. It adds 85 tokens to every session and 2,864 once invoked, about $0.0003 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-11-30.

Related

dok3-pg compared with skills from other repositories

dok3-pg next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
dok3-pgLeeYudok/agents-scaffoldSkill40todayMITA85Claude Code
memstack-security-rls-guardiancwinvestments/memstackSkill43317d agoMITA84Claude Code
database-experttravisjneuman/.claudeSkill115yesterdayMITA36Claude Code
agent-database-experttravisjneuman/.claudeSkill115yesterdayMITA49Claude Code
kyselyMindrally/skillsSkill3221mo agoApache-2.0A26Claude Code
postgresql-best-practicesMindrally/skillsSkill3221mo agoApache-2.0A23Claude Code
dev-supabasechristopherlouet/claude-baseSkill514d agoMITA28Claude Code