database-optimization-prompt

database-optimization-prompt is an agent for coding agents from Rtur2003/Claude-Code-Promts-Skills. It costs 0 tokens per session (3,934 once invoked), scanned A, original, MIT.

A database design and optimization prompt for planning data structures, improving queries, choosing indexes, and preparing migrations. A database stores and organizes an application's data.

In plain words
What is it for?
Use it to design schemas, measure database performance, analyze how data is accessed, improve queries and indexes, and plan migrations.
Why use it?
It helps identify slow queries, inefficient data layouts, and risky changes before they cause problems as the amount of data grows.

Agent

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 agents/rtur2003/claude-code-promts-skills/database-optimization-prompt
Clone the repo
git clone --depth 1 https://github.com/Rtur2003/Claude-Code-Promts-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 database-optimization-prompt

README.md
[![agentmods](https://agentmods.dev/badge/agents/rtur2003/claude-code-promts-skills/database-optimization-prompt.svg)](https://agentmods.dev/agents/rtur2003/claude-code-promts-skills/database-optimization-prompt)
Your own site
<a href="https://agentmods.dev/agents/rtur2003/claude-code-promts-skills/database-optimization-prompt"><img src="https://agentmods.dev/badge/agents/rtur2003/claude-code-promts-skills/database-optimization-prompt.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,934 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.00000 $0.03934
Opus 5 $0.00000 $0.01967
Sonnet 5 $0.00000 $0.00787
Haiku 4.5 $0.00000 $0.00393

Measured 4d ago against content hash 188003993e15, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

database-optimization-prompt 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 4d 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.

prompts/english/agents/database-optimization-prompt.md · 452 lines

How it starts

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

Database Design & Optimization Prompt

Schema Design | Query Optimization | Indexing Strategy | Migration Planning

Role

You are a database design and optimization specialist. Your mission: design efficient schemas, optimize query performance, plan safe migrations, and build data layers that scale from thousands to millions of records without degradation.


QUERY Protocol

┌──────────────────────────────────────────────────────────┐
│  Q → QUANTIFY: Measure current performance baselines     │
│  U → UNDERSTAND: Map data relationships & access patterns│
│  E → EVALUATE: Identify bottlenecks & anti-patterns      │
│  R → REDESIGN: Schema, indexes, queries for performance  │
│  Y → YIELD: Test under load, verify improvements         │
└──────────────────────────────────────────────────────────┘

Phase 1: Schema Design Principles

Normalization Decision Matrix

Form When to Use When to Denormalize
1NF Always — atomic values, no repeating groups Never skip
2NF Most OLTP systems — no partial dependencies Read-heavy dashboards
3NF Default for transactional data — no transitive deps High-traffic read APIs
Denormalized Analytics, reporting, search indexes Never for write-heavy

Data Type Selection

-- ✅ Good: Right-sized types
CREATE TABLE users (
    id          uuid PRIMARY KEY DEFAULT gen_random_uuid(),
    email       text NOT NULL UNIQUE,           -- text over varchar (PostgreSQL)
    name        text NOT NULL,
    status      smallint NOT NULL DEFAULT 0,     -- enum as smallint, not varchar
    balance     numeric(12,2) NOT NULL DEFAULT 0, -- exact decimal for money
    metadata    jsonb DEFAULT '{}',              -- jsonb over json (indexable)
    created_at  timestamptz NOT NULL DEFAULT now(), -- always use timestamptz
    updated_at  timestamptz NOT NULL DEFAULT now()
);

-- ❌ Bad: Oversized types
CREATE TABLE users_bad (
    id          bigserial PRIMARY KEY,           -- serial for most tables
    email       varchar(255),                    -- arbitrary length
    status      varchar(20),                     -- string enum = slow joins
    balance     float,                           -- floating point for money!
    metadata    json,                            -- json can't be indexed
    created_at  timestamp                        -- no timezone = ambiguous
);

Read the full file on GitHub · 452 lines

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. 4d ago First seen · 452 lines · 0 tokens per session scan A 188003993e15

Subscribe to this mod's changes

database-optimization-prompt is an agent published in the GitHub repository Rtur2003/Claude-Code-Promts-Skills (49 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,934 tokens. 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 agents, from other repositories

CONTRACT

One behavior, many bindings. This document is the single source of truth for the chDB agent-tool surface. chdb.agents.ChDBTool (Python) is the reference implementation; the TypeScript binding (chdb-node) and any future language binding under chdb-io implement the same methods with the same semantics and are verified…

chdb-io/chdb · 0 tokens

backend-database-agent

Agent "backend-database-agent" from girijashankarj/cursor-handbook, covering database agent, invocation, scope, expertise and when to use.

girijashankarj/cursor-handbook · 0 tokens

database-query-optimization-agent

Agent "database-query-optimization-agent" from girijashankarj/cursor-handbook, covering query optimization agent, invocation, scope, expertise and when to use.

girijashankarj/cursor-handbook · 0 tokens

sql-pro

Expert SQL engineer. Writes performant queries, optimizes indexes, and debugs performance issues. Can translate natural language questions into complex SQL with self-correction capabilities.

NickCrew/Claude-Cortex · 35 tokens

database-navigator

PROACTIVELY use this agent when exploring database schemas, understanding data models, or investigating database-related issues. Expert in SQL, migrations, and data relationships. Read-only agent for production safety.

arpitnath/claude-capsule-kit · 43 tokens

growth-analytics

Analytics setup and post-launch analysis. Use to implement KPI/event tracking, and to run cohort/RFM/window-function SQL on collected data.

christopherlouet/claude-base · 31 tokens