Skip to content

Skills / db-schema

db-schema

Design or review a relational database schema from requirements, producing normalized tables, keys, constraints and indexes as a migration plus a short ER summary. Use when the user asks to design tables, model data, add an entity or review a schema. Do not use for query tuning, data migration of existing rows or non-relational stores.

OfficialRuns scriptsAuditB
Latest
v0.1.0
Aisle
database
Works with
Claude Code, Codex, Cursor
Stars
2

Install

Install db-schema

npx @agentsaisle/cli add db-schema

Installs into your project's skills folder. Add --global to install it for every project.

Runs scriptsThis skill includes scripts

Your agent may run these scripts on your machine. A maintainer has read every one in full, and the CLI lists the files when you install. You can read them on GitHub first.

Read the files on GitHub

Audit

B
Critical
0
High
0
Medium
1
Low
0

4 files · audited 2026-10-29 · rules 1.0.0

MediumAA-P02Can write files and run interpreters without disable-model-invocation

SKILL.md:6

Read Write Edit Glob Grep Bash(node *)

Why The agent may load this skill on its own and then write files and run code in one go.

Fix Set disable-model-invocation: true so the user starts it, or narrow the Bash patterns.

What this skill can use

Tools

  • Read
  • Write
  • Edit
  • Glob
  • Grep
  • Bash(node *)

Scripts

  • scripts/er-summary.mjs

Domains mentioned

None

Automated checks found the patterns listed here. An audit reduces risk; it is not a guarantee of safety. How audits work · Read the rules

Show this grade in a README

The badge updates when the registry is rebuilt. Paste this Markdown into the README:

[![aisle audit](https://img.shields.io/endpoint?url=https%3A%2F%2Fagentsaisle-vercel.vercel.app%2Fbadges%2Fdb-schema.json)](https://agentsaisle-vercel.vercel.app/skills/db-schema)

SKILL.md

Rendered from commit 276ea59

Database schema

Use when

  • New tables or a new feature that needs stored data.
  • A schema review: missing keys, indexes or constraints.

Don't use when

  • The task is a slow query (use db-optimize-query) or changing a live table safely (use db-migrate).
  • The data is not relational (documents, key-value).

Steps

  1. Find the engine and existing schema (migrations folder, ORM models, schema.sql). Match their naming and id style. Ask only if the engine is unclear.
  2. List entities, their relationships (one-to-many, many-to-many via a join table) and the questions the app asks of the data.
  3. Write the DDL: a primary key on every table, NOT NULL unless absence is meaningful, foreign keys with an explicit ON DELETE, UNIQUE for natural keys, CHECK for small fixed sets. Timestamps in UTC. Money as integer minor units or numeric, never float.
  4. Index every foreign key and every column used to filter or sort in the app's real queries. No speculative indexes.
  5. Run node <skill>/scripts/er-summary.mjs <file.sql>. Fix every finding it prints.
  6. Put the DDL in the project's migration format. Do not change existing migrations; add a new one.

Budget

  • Search first (grep, glob, symbol search). Read line ranges, not whole files.
  • Read at most 8 files per step. If you need more, write down what you learned and narrow the question.
  • Do not re-read a file you just wrote or edited.
  • Prefer the smallest command output that answers the question: head, tail, quiet flags, filtered lists.
  • Read the schema and the models, not the whole codebase.

Output

  • The migration file, the ER summary (the script's output), and one sentence per non-obvious choice.

Done when

  • er-summary.mjs reports no problems.
  • Every foreign key is indexed and every table has a primary key.
  • The migration applies cleanly to an empty database, when one is available.

Version history

VersionCommitInstall
0.1.0latest276ea59add db-schema

Report this skillAgent Aisle on GitHub