database

A set of standards for using PostgreSQL as a database and Redis as a cache. It covers schemas, migrations, data access, constraints, queries, indexes, transactions, and cache invalidation.

In plain words
What is it for?
Use it when designing tables, writing migrations, building repository or database-service code, optimizing queries, configuring Redis caching, or planning cache invalidation.
Why use it?
It helps keep stored data correct and makes database changes, queries, and cached values safer to maintain as the application grows.

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/ndisisnd/cook/database
Any agent
npx skills add ndisisnd/cook --skill database
Clone the repo
git clone --depth 1 https://github.com/ndisisnd/cook

Made for: Claude Code, Codex.

Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,001 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.00032 $0.01001
Opus 5 $0.00016 $0.00500
Sonnet 5 $0.00006 $0.00200
Haiku 4.5 $0.00003 $0.00100

Measured yesterday against content hash 5a2e0032bbbf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

database 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 yesterday.

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.

standards/database/SKILL.md · 99 lines

How it starts

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

Database Standards

Priority: P0 — PostgreSQL Correctness

Schema & Access

  • Isolate persistence logic behind repositories or database services. Do not scatter raw database access across handlers.
  • Model relations explicitly. Avoid redundant raw ID mirror fields when the ORM relation already expresses the dependency.
  • Enforce integrity in the database with primary keys, foreign keys, NOT NULL, CHECK, and UNIQUE constraints.
  • Prefer timestamptz for timestamps, text or unbounded varchar for strings, and numeric or integer minor units for money.

Migrations

  • Never use synchronize: true in production.
  • Use explicit migrations for every schema change.
  • Follow expand-contract for destructive changes: add, backfill, deploy, then remove.
  • Generated ORM migrations do not reliably capture Row-Level Security. Write RLS policies as explicit SQL.
  • On hot tables, avoid blocking changes and prefer concurrent index creation where supported.

Queries & Performance

  • Paginate every list query.
  • Index every hot filter, join, and foreign-key column. Columns referenced by RLS predicates must be indexed.
  • Use transactions for multi-step mutations.
  • Prevent N+1 access patterns with joins, batching, or ORM query builders.
  • Avoid SELECT * in application queries; project only the columns you need.

Priority: P0 — Redis Safety

Data Design

  • Redis is a cache, queue, or coordination layer. It must not be the sole source of truth for critical business data.
  • Namespace keys with colons, for example app:user:123.
  • Every non-permanent key needs a TTL or a deliberate eviction strategy.
  • Add TTL jitter for high-volume cache keys to avoid synchronized expirations.
  • Prefer hashes for field-addressable objects over large JSON blobs.

Commands & Operations

  • Never use KEYS in production. Use SCAN and related cursor-based commands.
  • Use UNLINK instead of DEL for large-key deletion.
  • Bound ZRANGE, LRANGE, and HGETALL usage. Do not fetch unbounded collections.
  • Use pipelines for bulk operations and EVALSHA for atomic multi-step cache logic.
  • Keep application and Redis in the same region and connect through stable hostnames.

Read the full file on GitHub · 99 lines

Files

What ships with it

8 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. yesterday First seen · 99 lines · 32 tokens per session scan A 5a2e0032bbbf

Subscribe to this mod's changes

database is a skill published in the GitHub repository ndisisnd/cook (2 stars, last pushed 21d ago), licensed MIT. It adds 32 tokens to every session and 1,001 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-31.

Related

Other skills, from other repositories

pre-landing-review

Pre-landing PR review. Analyzes diff against the base branch for SQL safety, LLM trust boundary violations, conditional side effects, and other structural issues. Use when explicitly asked for the specialized pre-landing workflow. Product /review requests are handled by BitFun's unified Review mechanism instead.…

GCWing/BitFun · 74 tokens

wechat-article-writer

公众号/自媒体全流程。根据用户表述自动匹配:撰写文章、封面图、正文插图、风格提取。支持多种写作风格。当用户提到写公众号、技术博客、公众号封面、正文插图、步骤图、演示图、流程示意、分析写作风格、克隆文风、模仿爆款、提取风格时使用。详见 reference 目录。.

xstongxue/best-skills · 105 tokens

miniapp-dev

Develops, maintains, and generates BitFun MiniApps (Zero-Dialect Runtime). Use when (1) working on miniapp framework code under src/crates/assembly/core/src/miniapp/ or src/web-ui/src/app/scenes/miniapps/; or (2) generating / creating / designing a NEW MiniApp for the user — including any request like "做一个小应用 / 生成…

GCWing/BitFun · 143 tokens

vibe-research

Deep research and market validation for app ideas. Use when starting a new project, validating an idea, or when the user says "research my idea", "validate my app", or "help me start a new project".

KhazP/vibe-coding-prompt-template · 49 tokens

commit-push-pr

Commit selected local changes, push the branch, and create or update a GitHub pull request with BitFun attribution. Use when the user asks to 提交 PR、提代码、commit and push、开 PR、create a pull request, or wants a Claude Code-like one-command PR publishing flow from BitFun.

GCWing/BitFun · 68 tokens

investigate

Systematic debugging with root cause investigation. Four phases: investigate, analyze, hypothesize, implement. Iron Law: no fixes without root cause. Use when asked to "debug this", "fix this bug", "why is this broken", "investigate this error", or "root cause analysis". Proactively invoke this skill (do NOT debug…

GCWing/BitFun · 112 tokens