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.
- Author
- agentsaisle
- Latest
- v0.1.0
- Aisle
- database
- Works with
- Claude Code, Codex, Cursor
- Source
- HazemSalah29/agentsaisle
- Stars
- 2
Install
Install db-schema
npx @agentsaisle/cli add db-schemaInstalls 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 GitHubAudit
- 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:
[](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 (usedb-migrate). - The data is not relational (documents, key-value).
Steps
- 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. - List entities, their relationships (one-to-many, many-to-many via a join table) and the questions the app asks of the data.
- Write the DDL: a primary key on every table,
NOT NULLunless absence is meaningful, foreign keys with an explicitON DELETE,UNIQUEfor natural keys,CHECKfor small fixed sets. Timestamps in UTC. Money as integer minor units ornumeric, never float. - Index every foreign key and every column used to filter or sort in the app's real queries. No speculative indexes.
- Run
node <skill>/scripts/er-summary.mjs <file.sql>. Fix every finding it prints. - 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.mjsreports 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
| Version | Commit | Install |
|---|---|---|
| 0.1.0latest | 276ea59 | add db-schema |