GraphQL schema design prompt

Design a GraphQL schema from your app requirements, with types, queries, mutations, pagination, error handling and notes on N+1 and auth.

Published
Works with
ChatGPT, Claude and Gemini
Level
Advanced
By
GoodAIPromt editorial team

A GraphQL schema is the contract between your frontend and backend, and early mistakes (vague nullability, no pagination, mutations that return nothing useful) are painful to change later. This GraphQL schema design prompt turns your requirements into a typed SDL schema with clear naming, cursor pagination and error handling, and points out performance and security issues to handle in your resolvers.

The prompt

Act as a senior backend engineer experienced in GraphQL API design.

App description: 
Main entities and relationships: 
Key screens or use cases: 
Server stack: 
Auth model: 
Existing data store: 

Please produce:
1. The full schema in SDL: object types, enums, input types, queries, mutations and (if useful) subscriptions.
2. Careful nullability: explain any field you made nullable.
3. Cursor-based pagination using the connection pattern for list fields that can grow.
4. Mutation payload types that return the changed object plus user-facing errors.
5. A short naming conventions list used in the schema.
6. Notes on resolvers: where N+1 queries will happen and how to batch them (for example with a DataLoader pattern).
7. Security notes: field-level authorization, query depth and complexity limits, input validation.
8. Three example queries and one mutation the frontend would send for my use cases.
9. Things to decide before shipping, and how to evolve the schema without breaking clients.

0 of 6 blanks filled

How to use it

  1. Describe real screens, not just tables, so the schema fits how the frontend reads data.
  2. Review nullability and auth notes with your team before writing resolvers.
  3. Load the SDL into your server and run the example queries to check it works.

Tips

  • Add new fields and deprecate old ones instead of renaming; clients may still use the old names.
  • Check exact syntax against your GraphQL server library's documentation.

Frequently asked questions

What does this prompt do?

Design a GraphQL schema from your app requirements, with types, queries, mutations, pagination, error handling and notes on N+1 and auth.

Which AI tools does it work with?

It is written for ChatGPT, Claude and Gemini. It also works in other AI tools that accept text prompts, with small changes.

What do I need to fill in?

6 blanks: what the app does and who uses it; e.g. users have many projects; projects have tasks; tasks have comments and assignees; e.g. dashboard listing projects, task detail page, create and assign task; e.g. node with apollo server, python with strawberry, go with gqlgen; e.g. jwt, roles: admin, member, viewer; e.g. postgres tables — paste if available. Click each blue blank on the page, type your details and press Copy prompt.

Is this prompt free to use?

Yes. You can copy and use it for personal and commercial work.

graphqlapi designschemabackend

More prompts for ChatGPT, Claude, Gemini.