Skip to main content

Claude/ChatGPT Prompt to Design a SQL Schema for a New Feature

Design a normalised SQL schema for a new feature with an ER diagram, migrations, seed data, and the exact indexes its real query patterns need.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt assigns the AI a senior database engineer role and makes it specify a runnable schema for a new feature, not a loose sketch. You describe the feature in [feature_description], pick your [db_engine] and [migration_tool], and state [scale]. It returns an ASCII ER diagram, CREATE TABLE statements with constraints and foreign keys, a migration file in your tool's format, seed data, the anticipated query patterns, and the exact indexes each pattern needs.

The structure works because it ties indexes to read patterns up front instead of bolting them on later. By asking for the query patterns and the indexes that support each, the prompt forces the design to account for how the tables will actually be read. [migration_tool] shapes the file format so the output drops into your stack, [db_engine] governs valid DDL, and [scale] drives the note on which columns will grow and whether the design holds. It aims for 3NF and only denormalises where it justifies the choice.

When to use it

  • You are starting a new feature and want the schema right before any UI exists.
  • The data model will outlive every other decision and you want it deliberate, not improvised.
  • You need migrations, seed data, and indexes in one pass rather than three separate sessions.
  • You want indexes chosen from real read patterns instead of retrofitted under load.
  • You are unsure where to denormalise and want each exception justified.
  • You want a quick ER diagram to sanity-check relationships before writing code.

Example output

You get an ASCII ER diagram of the new tables, the CREATE TABLE DDL with constraints and foreign keys, a reversible migration file in your chosen tool's format, a seed script with three representative rows per table covering normal and edge cases, a mapping of anticipated query patterns to supporting indexes, and a note on which columns grow and how the design holds at the stated scale.

Pro tips

  • Make [feature_description] concrete — "team workspaces with per-member roles" yields a sharper schema than a one-word feature name.
  • Match [migration_tool] to your actual stack so the migration file is paste-ready rather than something you have to translate.
  • Set [scale] realistically; it drives the growth note and whether the model flags columns that will balloon.
  • Decide indexes from the read patterns the model surfaces, since retrofitting them under production load is the painful path.
  • Push back on denormalisation that is not justified — the prompt aims for 3NF, and unexplained shortcuts are worth questioning.
  • Read the growth note carefully and flag any column it warns will balloon, since those are the ones that bite at the stated scale.
  • Use the seed data's edge-case rows to test constraints early, before the table is full of real records, so a bad foreign key or null surfaces in development rather than production.

Frequently Asked Questions

Does the migration file match my framework's format?
It tries to, based on `[migration_tool]`. Set that variable to your exact tool, such as Laravel migrations, so the generated file uses the right syntax and structure. Always review it against a real migration in your project before running.
Will the schema be properly normalised?
The prompt aims for third normal form and only denormalises where it can justify the choice. That keeps the design clean by default, but you should still review any denormalisation it proposes to confirm the justification holds for your access patterns.
Can it handle the indexes for my real query patterns?
Yes, that is a core deliverable. It lists the anticipated query patterns and the exact indexes supporting each, so you choose indexes from reads up front. You will still want to confirm those patterns match what your application actually issues.
Is the seed data enough to test with?
It provides three representative rows per table covering normal and edge cases, which is enough to exercise constraints and relationships. For load testing or realistic volume you will need to generate far more data, since three rows only validate correctness, not scale.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Data & SQL Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support