database

database is a skill for Claude Code, Codex from kok-o/koko-contextos-agents. It costs 26 tokens per session (1,039 once invoked), scanned A, original, MIT.

Guidance for designing and working with relational databases, including PostgreSQL and common TypeScript database libraries such as Prisma and Drizzle.

In plain words
What is it for?
It is for planning tables and relationships, writing migrations, adding indexes, improving ORM queries, handling transactions, and fixing N+1 queries—where one request causes many unnecessary database queries.
Why use it?
It helps avoid unsafe schema changes, slow queries, repeated database calls, and missing indexes.

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

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/kok-o/koko-contextos-agents/database.svg)](https://agentmods.dev/skills/kok-o/koko-contextos-agents/database)
Your own site
<a href="https://agentmods.dev/skills/kok-o/koko-contextos-agents/database"><img src="https://agentmods.dev/badge/skills/kok-o/koko-contextos-agents/database.svg" alt="Measured on agentmods" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,039 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.1 $0.00026 $0.01039
Opus 5 $0.00013 $0.00519
Sonnet 5 $0.00005 $0.00208
Haiku 4.5 $0.00003 $0.00104

Measured today against content hash c181f0c92b10, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, 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 today.

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.

.agents/core/skills/database/SKILL.md · 102 lines

How it starts

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

database

Overview

Relational database design, query optimization, migration safety, connection pooling in serverless environments, and ORM usage across PostgreSQL, Prisma, and Drizzle.

When to Use

Activate for tasks involving database schema design, migrations, indexing, relational models, ORM queries, transactions, or query performance tuning.

Rules & Patterns

Negative Constraints (What NOT to Do)

  1. NEVER do SELECT * in production: Always select explicit columns required by the caller to minimize memory bandwidth and lock footprint.
  2. NEVER run destructive migrations without backward compatibility: Always follow expand-and-contract (Phase 1: add new column as nullable; Phase 2: backfill; Phase 3: make non-nullable & remove old column).
  3. NEVER execute queries in loops (The N+1 Anti-Pattern): Always use batch loading (inArray, DataLoader, or relational include / JOIN).
  4. NEVER leave foreign keys without indexes: In PostgreSQL/MySQL, child foreign key columns must always have an index to prevent table-level locking on cascade deletes.
  5. NEVER perform multi-entity writes without a database transaction: Any operation touching multiple records must use prisma.$transaction or db.transaction.
  6. NEVER open unpooled database connections in Serverless / Edge functions: Serverless scale-outs will instantly exhaust PostgreSQL's max_connections.

Zero-Downtime Migrations (Expand-and-Contract)

When modifying schemas with zero downtime:

  1. Phase 1 (Expand): Add the new column as NULLABLE (or with a default value). Deploy the application code that reads from old column and writes to both old and new.
  2. Phase 2 (Backfill): Run an asynchronous batch migration job in chunks (e.g. 1000 rows at a time) to populate data from old column to new column.
  3. Phase 3 (Contract): Update application code to read and write exclusively from the new column.
  4. Phase 4 (Cleanup): Once traffic is fully shifted, remove the old column and mark the new column as NOT NULL in a separate migration.

Read the full file on GitHub · 102 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 Changed · +52 lines c181f0c92b10
  2. 5d ago First seen · 50 lines · 26 tokens per session scan A 166f7b6a40cd

Subscribe to this mod's changes

database is a skill published in the GitHub repository kok-o/koko-contextos-agents (2 stars, last pushed yesterday), licensed MIT. It adds 26 tokens to every session and 1,039 once invoked, about $0.0001 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

cache_patterns

Instruction set for enabling and operating the Spring Cache abstraction in Spring Boot when implementing application-level caching for performance-sensitive workloads.

vuralserhat86/antigravity-agentic-skills · 26 tokens

system-design-data-architecture

Choose and scale the data layer: SQL versus NoSQL per access pattern, single data ownership, replication and read scaling, partition key choice, hot partition and celebrity key mitigation. Use when selecting a store, planning sharding, or fixing a data-tier bottleneck.

HoangNguyen0403/agent-skills-standard · 59 tokens

database-hana

Apply SAP HANA database standards for SQL parameterization, in-memory engine optimization, dynamic IN query chunking, column aliasing on joins, and datatype casting. Use when writing SQL for SAP HANA, optimizing HANA queries, or diagnosing HANA driver errors.

HoangNguyen0403/agent-skills-standard · 57 tokens

database-mongodb

Apply MongoDB data-modeling, indexing, and query rules from access patterns. Use when designing schemas, choosing embed vs reference, or tuning MongoDB query behavior.

HoangNguyen0403/agent-skills-standard · 37 tokens

database-postgresql

Apply PostgreSQL standards for migrations, indexing, transactions, and ORM boundaries. Use when editing entities, Prisma schema, migrations, RLS, or query-performance work for PostgreSQL.

HoangNguyen0403/agent-skills-standard · 40 tokens

database-redis

Optimize Redis as cache and coordination infrastructure with TTL, eviction, and latency-aware key design. Use when implementing Redis caching, key invalidation, or Redis performance work.

HoangNguyen0403/agent-skills-standard · 37 tokens