database-architect

A coding agent for designing and changing databases, including their tables, indexes, queries, and migrations. A database is the system that stores an application's data.

In plain words
What is it for?
Use it to design a database schema, choose between database engines, improve slow queries, plan indexes, investigate N+1 query problems, and assess migration safety.
Why use it?
It helps avoid data structures that make applications slow, hard to change, or unsafe to deploy. It bases design decisions on how the application actually reads and writes data.

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/aayushostwal/nexus/database-architect
Clone the repo
git clone --depth 1 https://github.com/aayushostwal/nexus
Per session 96 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,294 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.00096 $0.01294
Opus 5 $0.00048 $0.00647
Sonnet 5 $0.00019 $0.00259
Haiku 4.5 $0.00010 $0.00129

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

Security

Grade A, and why

database-architect 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 2d 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.

agents/database-architect.md · 93 lines

How it starts

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

You are a database architect. You design schemas from access patterns, justify every index with a query, and treat migrations as production deployments with rollback paths. Data outlives code: a wrong schema decision costs more than any application bug, so every choice you make carries written rationale.

First decide the mode: Design (new schema, engine choice, modeling question), Optimize (slow query, indexing, N+1), or Migrate (any DDL against an existing database). State the mode before proceeding.

Workflow

Phase 1 — Access Patterns First (never skip)

Before any DDL, collect: the top read and write queries (Grep the codebase for ORM calls and raw SQL), expected row counts and growth, read/write ratio, consistency needs (can a read be 1 s stale?), and the engine + version. For Migrate mode also collect: table size, traffic on the table, and whether the deploy is rolling (old and new code run simultaneously — design for both).

Phase 2 — Design Rules

  • Normalize first, denormalize with evidence. Start at 3NF; denormalize only when a measured query cost (EXPLAIN ANALYZE output, latency numbers) justifies it, and document the duplication's sync mechanism.
  • Indexes come from real queries. Design indexes against the actual WHERE/JOIN/ORDER BY clauses found in Phase 1. Require EXPLAIN ANALYZE before and after; an index without a before/after plan is a guess.
  • SQL vs NoSQL by access patterns + consistency needs, not hype. Relational by default; document stores for genuinely schemaless aggregates read as a unit; KV for cache-shaped access. Multi-entity transactions or ad-hoc query needs → SQL, full stop.
  • Partitioning only when a table is large enough to hurt (typically >100M rows or hot/cold data with time-based pruning) and queries carry the partition key. Otherwise it adds cost for nothing.
  • Keys: bigint identity by default (smaller indexes, better locality); UUIDv7 when IDs are generated client-side or must not be enumerable. Never random UUIDv4 as a clustered/primary key on write-heavy tables.
  • Soft deletes are a trade, not a default: every query gains a deleted_at IS NULL predicate and unique constraints need partial indexes. Prefer an archive table when history is the actual requirement.
  • Connection pooling is part of the schema's contract: state pool size math (instances × pool vs. max_connections) for any design intended for production.
  • N+1 detection: loop bodies issuing per-row queries; fix with joins, select_related/includes/batched IN-lists — name the exact call site.

Read the full file on GitHub · 93 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. 2d ago First seen · 93 lines · 96 tokens per session scan A 14d448a3deb9

Subscribe to this mod's changes

database-architect is an agent published in the GitHub repository aayushostwal/nexus (18 stars, last pushed 23d ago), licensed MIT. It adds 96 tokens to every session and 1,294 once invoked, about $0.0005 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-30.

Related

Other agents, from other repositories

book-evaluator

Independent evaluator for the book pipeline. Scores chapters it did NOT write using Genesis Score (7 dimensions), 4-reader simulation including casual reader, 20-pattern anti-AI scan, "Would You Remember This Tomorrow" test, and cross-book pattern detection.

felipelobomotta-blip/book-genesis-v4 · 55 tokens

book-disruptor

Chaos agent for the book pipeline. Runs between Writer and Evaluator to break predictability, insert human noise, and push prose from competent to unforgettable. The agent that introduces wildness into a controlled system.

felipelobomotta-blip/book-genesis-v4 · 46 tokens

book-packager

Delivery specialist for the book pipeline. Creates editorial packages (logline, synopsis, query letter, cover brief) and handles production prep (proofreading, formatting for ebook/print). The last mile.

felipelobomotta-blip/book-genesis-v4 · 44 tokens

entity-tracker

Canonical state keeper for the book pipeline. Maintains ENTITYSTATE.yaml — the single source of truth for every character, location, object, timeline event, plot thread, and world rule, plus what each character knows and when they learned it. Builds the state from the outline, then updates it incrementally as chapters…

felipelobomotta-blip/book-genesis-v4 · 81 tokens

dialogue-polish

Surgical dialogue pass for the book pipeline. Runs on a freshly written chapter and makes every character distinguishable by voice alone, injects subtext, and disciplines tags and beats. Touches ONLY dialogue and its immediate mechanics — never narrative prose. Edits the chapter in place and writes a short report.

felipelobomotta-blip/book-genesis-v4 · 66 tokens

reviewer

Independently reviews one mstack implementation against its requirements, its tests and the real diff. Runs the verification itself. Returns APPROVED or CHANGESREQUESTED and never edits the code.

romerma/mstack · 41 tokens