Skip to content
Agentmart
Submit a tool

db-schema-scan

Read-only inspection of database schema via migration files and schema SQL.

Skill by ernesto2108

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/ernesto2108-db-schema-scan

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Read-only inspection of database schema via migration files and schema SQL. Use when user says "check the schema", "show tables", "inspect migrations", "what columns does X have", or needs to understand the database structure before writing queries.

Use cases: backend, writing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/db-schema-scan

What's inside

Skill name
db-schema-scan
Description
Read-only inspection of database schema via migration files and schema SQL. Use when user says "check the schema", "show tables", "inspect migrations", "what columns does X have", or needs to understand the database structure before writing queries.
License
MIT
Instructions
86 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Database Schema Scan

> Read-only inspection of the current database schema. Prerequisite for DBA work and query optimization.

## When to Use

- Before any DBA migration work (understand current state)
- Before developer writes repository queries (verify table/column names)
- When user asks "what columns does X have", "show me the schema", "check the tables"
- As prerequisite for `/db-optimize`

## Workflow

### Step 1 — Find Migration Files

Search for migration files in common locations:

```
migrations/*.sql
db/migrations/*.sql
sql/migrations/*.sql
database/migrations/*.sql
**/migrate/*.sql
```

Also check for schema dumps: `schema.sql`, `init.sql`, `db/schema.sql`

### Step 2 — Parse Schema

Read migration files in order (by number/timestamp) and build a mental model of:

1. **Tables** — name, columns, types, constraints
2. **Relationships** — foreign keys, join tables
3. **Indexes** — name, columns, unique/partial
4. **Enums/Types** — custom types defined
5. **RLS Policies** — if multi-tenant
6. **Triggers** — if any exist

### Step 3 — Produce Schema Summary

Output a structured summary:

```markdown
## Schema Summary — <project>

### Tables (<count>)

#### <table_name>
| Column | Type | Nullable | Default | Constraint |
|--------|------|----------|---------|------------|
| id | UUID | NO | uuid_generate_v7() | PK |
| email | VARCHAR(255) | NO | — | UNIQUE |
| tenant_id | UUID | YES | — | FK → tenants(id) |
| created_at | TIMESTAMP | YES | CURRENT_TIMESTAMP | — |

**Indexes:** idx_users_email, idx_users_tenant_id
**RLS:** tenant_id = current_setting('app.tenant_id')

### Relationships
- users.tenant_id → tenants.id
- user_roles.user_id → users.id
- user_roles.role_id → roles.id

### Migration Count: <N> (latest: <filename>)

### Potential Issues
- [ ] Table X has no tenant_id (multi-tenant gap)
- [ ] Table Y has no index on frequently queried column Z
- [ ] Column A is VARCHAR(255) but only stores short codes
```

### Step 4 — Check for Schema/Code Mismatches (optional)

If the orchestrator asks, compare schema against repository query files:
- Columns referenced in queries that don't exist in schema
- Tables in schema that have no corresponding repository
- Type mismatches (schema says UUID, code scans as string)

## Rules

- **READ-ONLY** — never modify schema or migration files
- **Report, don't fix** — flag issues for the DBA agent to handle
- **Order matters** — read migrations in sequence to understand evolution
- **Check rollbacks** — note migrations that have `.up.sql` but no `.down.sql`

From ernesto2108/forge, MIT.

More from ernesto2108/forge

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Apr 3, 2026 (6 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from ernesto2108

Cite this page

db-schema-scan skill. Agent Mart. https://agentmart.dev/skills/ernesto2108-db-schema-scan (last updated 2026-10-24)