15 prompts for designing a database schema with an AI agent

A prompt for designing a database is worth copying only if the agent can act on it. These 15 are written for an agent connected to a real schema over MCP, where “read the project” means it actually reads the project and “propose a change” puts a diff in front of your team. Each one comes with the reason it is worded the way it is, because the wording is the reusable part.

They assume DB Planner’s MCP server is connected to Claude Code, Cursor, or another client, which is one URL to set up. Swap the project names for your own.

Three rules that make any schema prompt better

  • State constraints, not descriptions. “Money is integer minor units” changes the output. “We are a fintech company” does not.
  • Ask for questions before a design. The agent does not know which of its assumptions are wrong. You do, once you see them.
  • Ask for a proposal, not an edit. A proposal waits in the Review tab for a person to merge it. The agent has no way to merge one itself.

Understand a schema you did not write

Safe on a read-only connection. Start here with any project, including your own.

Read the project “Storefront” and explain the schema to me as if I joined the team today. Start with the five tables everything else depends on.

Why it works: Asking for the load-bearing tables first forces a ranking. A flat list of forty tables is a description; a ranking is an understanding.

Which tables have no relationships at all, and for each one, is that deliberate or is a foreign key missing?

Why it works: An isolated table is either a log or a bug. Making the agent commit to which one surfaces the columns that look like keys and are not.

Trace what happens in the schema when a customer places an order: which rows are created, in which tables, in what order.

Why it works: Walking one real flow through the tables finds the gaps a table-by-table review never does.

Render the board as an image and tell me what you would rearrange to make the main flow readable left to right.

Why it works: The agent can look at the diagram, not only at coordinates. A layout critique from the picture is far better than one from a list of positions.

Design something new

These change documents, so they need write access. Each asks for a proposal, which lands in the Review tab and waits for you.

I need to add gift cards. Before designing anything, ask me the questions whose answers would change the tables.

Why it works: The best single prompt in this list. Can a card be partially spent? Reloaded? Refunded to? Each answer is a different schema, and the agent cannot know.

Design the gift card tables and submit them as a proposal. Money is integer minor units, balances are derived from a ledger and never stored, and nothing is hard-deleted.

Why it works: Three constraints, each ruling out a design the agent would otherwise pick. Constraints beat description.

Start a new project from the e-commerce template, then propose the changes needed to sell subscriptions as well as one-off products.

Why it works: Starting from a worked schema means the agent spends its effort on what is different about your case.

Propose two different designs for multi-tenancy in this schema, one with a tenant_id on every table and one with a schema per tenant. Say what each costs us in a year.

Why it works: Asking for two forces the trade-off into the open. Asking for one gets you the first idea, defended.

Review and harden

Use the agent as the reviewer who has time to check everything.

Find every foreign key column with no index and propose the indexes, with one line each on the query it speeds up.

Why it works: Mechanical, tedious, and exactly what an agent is good at. The one line per index stops it adding ones nothing uses.

List every relationship where the two columns have different types, and every column that looks like money stored as a float.

Why it works: Both are real bugs that survive for years because they work in testing.

Read the open proposals on this project and tell me, for each one, what could go wrong in production if we merged it as written.

Why it works: The agent can read proposals like any reviewer. It cannot merge one, which is the point.

For every ON DELETE CASCADE in the schema, tell me what a single delete at the top could remove, in rows of which tables.

Why it works: Cascades are designed one at a time and fail all at once.

Keep the schema and the code in step

For projects linked to a repository, or where the schema lives in an ORM.

Our schema.prisma is linked to this project. Read it from the repository, update the DBML to match, and tell me what changed since the last sync.

Why it works: The agent reads the file, rewrites the design to match, and records the commit it synced to, so the diagram stays a picture of the code.

Open a pull request for the proposal “add gift cards” so the engineers can review it where they review everything else.

Why it works: A design reviewed in the tool and code reviewed in GitHub are the same change. This puts them in one place.

Add a note to every table that does not have one, saying in one sentence what a row represents. Mark any you are unsure of with a question.

Why it works: Table notes travel with the schema and render on the diagram. “Unsure” marks are worth more than confident guesses.

What not to ask

  • “Design a database for an online store.” You will get the average of every tutorial. Use the template instead and ask for what is different about yours.
  • “Make this schema better.” Better for what? Name the query that is slow or the bug you keep hitting.
  • “Apply it to production.” This server cannot, and that is deliberate. It works on the design. Turning a merged design into a migration, and running it, stays with you; the migration generator writes the script.

The working method behind the prompts

Prompts are the small part. The larger part is the loop they sit in: connect read-only, brief with constraints, take a proposal, review it on the diagram, merge it yourself. That is laid out step by step in how to let an AI agent design your database. If you are deciding whether to connect an agent to a schema or to a live database, read database MCP servers explained first.