db-agent

db-agent is an agent for Claude Code, Cursor from openplanr/planr-pipeline. It costs 0 tokens per session (1,489 once invoked), scanned A, a copy of db-agent, MIT.

A read-only database agent that scans the live database structure and saves a JSON summary of its tables and data model for other planning agents.

In plain words
What is it for?
It helps inspect databases such as PostgreSQL, MySQL, SQLite, or MongoDB and create or refresh a schema snapshot for feature planning.
Why use it?
It lets later steps understand the existing database without changing data, running migrations, or modifying the schema.

Agent for Claude CodeCursor

Written for Claude Code and Cursor: shipped in a Claude Code plugin, but also installed under .cursor/. Also seen: mentions subagents.

Part of the planr-pipeline plugin — 8 skills, 10 commands, 9 agents, 1 hook shipped together

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/openplanr/planr-pipeline/db-agent
Clone the repo
git clone --depth 1 https://github.com/openplanr/planr-pipeline

Made for: Claude Code, Cursor.

Or install planr-pipeline, the plugin that ships this one along with the rest of its 8 skills, 10 commands, 9 agents, 1 hook.

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 db-agent

README.md
[![agentmods](https://agentmods.dev/badge/agents/openplanr/planr-pipeline/db-agent.svg)](https://agentmods.dev/agents/openplanr/planr-pipeline/db-agent)
Your own site
<a href="https://agentmods.dev/agents/openplanr/planr-pipeline/db-agent"><img src="https://agentmods.dev/badge/agents/openplanr/planr-pipeline/db-agent.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 1,489 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod 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.00000 $0.01489
Opus 5 $0.00000 $0.00745
Sonnet 5 $0.00000 $0.00298
Haiku 4.5 $0.00000 $0.00149

Measured 5d ago against content hash 9d853f8605b0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

db-agent 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 5d 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.

Origin

This is a copy

100% identical to db-agent — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/agents/db-agent.md · 164 lines

How it starts

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

Cursor adapter — synthesized from planr-pipeline. Agent role system prompt (body-only). Used by /cursor/rules/planr-pipeline.mdc for Composer subagent dispatch. Source: planr-pipeline/agents/db-agent.md (frontmatter stripped — Cursor uses different permission model; restrictions documented in the role body and the master rule).

DB Agent

Phase: Step 0.1 — Database Scan Mode: READ-ONLY (no writes, no migrations, no schema changes) Trigger: Invoked by /planr-pipeline:plan if DatabaseType is configured and output/db/schema.json is missing or stale; can also be invoked manually.

Purpose

The DB Agent scans the live database schema and produces a structured JSON snapshot that all subsequent agents use to understand the data model. It never modifies the database. Ever.

Tool-layer enforcement: This agent's tools frontmatter grants only read-only DB clients (psql, mysql, sqlite3, mongosh, mongo) plus Read, Grep, Glob, and a single Write (for output/db/schema.json only). It cannot Edit source files, cannot Bash(rm:*), cannot run any non-DB-client command. R8 is enforced by the harness, not just the prompt.

Inputs

Input Source Required
input/tech/stack.md Tech Lead ✅ Yes
DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD Environment vars ✅ Yes

Outputs

Output Path Description
Schema snapshot output/db/schema.json Full introspected schema

System Prompt

You are the DB Agent operating in strict READ-ONLY mode.

Your only job is to connect to the database described in input/tech/stack.md
using the environment variables DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD,
and introspect the full schema using the technique appropriate for the
configured DatabaseType (see Execution Steps).

For SQL databases (PostgreSQL, MySQL, MSSQL, SQLite): use INFORMATION_SCHEMA queries.
For MongoDB: use the official driver to list collections and infer document shape.

You must:
1. Discover all tables (SQL) or collections (Mongo) and their fields
2. Capture types, nullability, defaults, and constraints (SQL) or inferred shape (Mongo)
3. Identify all primary keys, foreign keys, and indexes (SQL) or `_id` + indexes (Mongo)
4. Detect existing enum types or check constraints (SQL only)
5. Output everything as a single valid JSON file to output/db/schema.json

You must NOT:
- Execute any INSERT, UPDATE, DELETE, DROP, ALTER, or CREATE statement
- For Mongo: never call insertOne/updateOne/deleteOne/dropCollection
- Modify any file outside output/db/
- Make assumptions about missing tables/collections — only report what exists

Output format: see Output Schema below.

Read the full file on GitHub · 164 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. 5d ago First seen · 164 lines · 0 tokens per session scan A 9d853f8605b0

Subscribe to this mod's changes

db-agent is an agent published in the GitHub repository openplanr/planr-pipeline (2 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,489 tokens. A static security scan graded it A with 0 findings. It is 100% identical to db-agent, differing in 0 lines, and is treated as a copy.

Related

Other agents, from other repositories

db-design

You are DB Design, a database architect who creates schemas from plain English requirements.

vikisingh23/neuraforge-ai · 0 tokens

db-advisor

Reviews database schema and queries for performance. Read-only advisory role invoked during review phase or explicitly for database concerns.

LiorCohen/sdd · 26 tokens

data-model-architect

Use when an orchestrator needs a Dataverse data model proposed (existing-table reuse, new tables in dependency-tier order, Mermaid ER diagram) for embedding in native-app-plan.md. Read-only — proposes, never mutates. Called by native-app-planner and /edit-app; not invoked directly by users.

microsoft/power-platform-skills · 67 tokens

data-scientist

Data analysis expert for SQL queries, BigQuery operations, and data insights. Use proactively for data analysis tasks and queries.

davepoon/buildwithclaude · 29 tokens

data-engineer

Adversarial data and database engineer who assumes the design is mis-normalized and indexed for a workload that does not exist. Audits schemas, migrations, queries, ORM code, document shapes, stream contracts, and pipelines against normalization, dimensional modeling, key-value access patterns, columnar and…

testdouble/han · 216 tokens

d1-query-optimizer

Performance analysis agent that identifies slow queries, missing indexes, and optimization opportunities in Cloudflare D1 databases using metrics, insights, and query plan analysis. Use when encountering slow queries, high latency, or performance degradation.

secondsky/claude-skills · 49 tokens