database

database is a skill for Claude Code, Codex from event4u-app/agent-config. It costs 39 tokens per session (1,380 once invoked), scanned A, original, MIT.

A database engineering skill covers schema design, query performance, indexes, MariaDB and MySQL tuning, and applications using more than one database connection.

In plain words
What is it for?
It helps design databases, optimize queries, add indexes, troubleshoot performance, inspect configuration, and use EXPLAIN to verify the result.
Why use it?
It helps identify why queries are slow and choose changes that can be checked against the database’s actual execution plan.

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

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/event4u-app/agent-config/database.svg)](https://agentmods.dev/skills/event4u-app/agent-config/database)
Your own site
<a href="https://agentmods.dev/skills/event4u-app/agent-config/database"><img src="https://agentmods.dev/badge/skills/event4u-app/agent-config/database.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,380 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.00039 $0.01380
Opus 5 $0.00019 $0.00690
Sonnet 5 $0.00008 $0.00276
Haiku 4.5 $0.00004 $0.00138

Measured yesterday against content hash 14e93995da29, 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.

src/skills/database/SKILL.md · 143 lines

How it starts

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

database

Grounded corpus (Tier-1 consultation): symptom → index/strategy decisions come grounded — ./scripts-run <skills-root>/corpus-grounding/scripts/ground search --manifest <skills-root>/database/data/manifest.json "<symptom>" returns root cause, strategy, good-code sketch, anti-pattern, and the verification probe (EXPLAIN expectation). Corpus: data/query-tuning.csv (PostgreSQL 16 / MySQL 8-derived).

When to use

Use when designing schemas, optimizing queries, adding indexes, or troubleshooting database performance.

Do NOT use when:

  • Writing framework-specific ORM models (use the matching skill — e.g. eloquent for Laravel, symfony-workflow for Doctrine, framework-native skill for Prisma / TypeORM / SQLAlchemy / GORM / Diesel)
  • Creating migrations only — use the framework-specific migration skill (laravel-migration for Laravel, framework-native for others)

Procedure: Optimize a query

Step 0: Inspect

  1. Read project docs in agents/reference/docs/ for database architecture.
  2. Check config/database.php for connection definitions.
  3. Detect engine: check .env driver and docker-compose.yml.

Step 1: Diagnose

Run EXPLAIN / EXPLAIN ANALYZE:

EXPLAIN ANALYZE SELECT * FROM projects WHERE customer_id = 42 AND status = 'active';

Check for: full table scans (type=ALL), missing indexes (key=NULL), filesort, temporary tables.

Step 2: Fix

  • Add missing indexes (most selective column first in composites)
  • Rewrite anti-patterns (subquery → JOIN, OFFSET → cursor, SELECT * → specific columns)
  • Add eager loading for N+1 queries
  • Always paginate list endpoints

Step 3: Verify

Re-run EXPLAIN and confirm improved plan.

Schema awareness (anti-hallucination)

Never guess table or column names. Verify before writing queries/migrations:

  1. Read migrations — source of truth
  2. Read models$table, $connection, $fillable, $casts, relationships
  3. Run schema queries — use the project's REPL or a raw introspection query:
    • Laravel: php artisan tinker --execute="Schema::getColumnListing('table')"
    • Symfony / Doctrine: bin/console doctrine:mapping:info
    • Rails: bin/rails runner "p ActiveRecord::Base.connection.columns('table').map(&:name)"
    • Prisma: npx prisma db pull --print | grep -A20 "model Table"
    • Generic SQL: psql -d mydb -c "\d table" / mysql -e "DESCRIBE table"
  4. Check project docsagents/reference/docs/ for conventions

Read the full file on GitHub · 143 lines

Files

What ships with it

2 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 · 143 lines · 39 tokens per session scan A 14e93995da29

Subscribe to this mod's changes

database is a skill published in the GitHub repository event4u-app/agent-config (10 stars, last pushed yesterday), licensed MIT. It adds 39 tokens to every session and 1,380 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-09-03.

Related

Other skills, from other repositories

architect/data-api-design

Skill "architect/data-api-design" from echoVic/boss-skill, covering 数据模型与api设计方法论, 适用场景, 数据模型设计, 1. 实体识别 and 2. 关系识别.

echoVic/boss-skill · 26 tokens

mongodb-schema-design

MongoDB schema design patterns and anti-patterns. Use when designing data models, reviewing schemas, migrating from SQL, or troubleshooting performance issues caused by schema problems. Triggers on "design schema", "embed vs reference", "MongoDB data model", "schema review", "unbounded arrays", "one-to-many", "tree…

fcakyon/claude-codex-settings · 127 tokens

mongodb-search-and-ai

Guides MongoDB users through implementing and optimizing Atlas Search (full-text), Vector Search (semantic), and Hybrid Search solutions. Use this skill when users need to build search functionality for text-based queries (autocomplete, fuzzy matching, faceted search), semantic similarity (embeddings, RAG…

fcakyon/claude-codex-settings · 132 tokens

solr-semantic-search

To build Solr phrase-tagging semantic search: concept tagging, taxonomy, graph paths.

griddynamics/rosetta · 24 tokens

generate-validation-notebook

Generate SQL validation notebooks for dbt changes. Pass a GitHub PR URL or local dbt repo path.

monte-carlo-data/mc-agent-toolkit · 27 tokens

qdrant-multitenancy

Guides tenant isolation architecture in Qdrant for multi-tenant or multi-user applications. Use when someone asks 'how to isolate customer data', 'how to build multi-tenant search/RAG', 'how many collections should I create', 'how to partition tenants by payload', 'a customer's data legally has to stay in a certain…

qdrant/skills · 109 tokens