Programování Expert Claude

GraphQL schema s resolvers

Návrh GraphQL schema s efektivními resolvers a dataloaders.

Prompt text

Délka: Střední
Vytvoř GraphQL schema pro [USE CASE]. Requirements:

**Types:**
[ENTITIES - např. User, Post, Comment]

**Queries:**
[READ OPERATIONS - např. getUser, getPosts]

**Mutations:**
[WRITE OPERATIONS - např. createPost, updateUser]

**Relationships:**
[RELATIONS - např. User has many Posts]

**Design:**
1. Schema definition (SDL)
2. Resolvers implementation
3. DataLoader pro N+1 problem
4. Authentication (context)
5. Input types & validation
6. Pagination (cursor-based)
7. Error handling

**Performance:**
- Query complexity limit
- Depth limit
- Caching strategy

**Security:**
- Auth directives
- Rate limiting
- Query cost analysis

Framework: [APOLLO/GRAPHQL-YOGA]. Language: [TS/JS].
Interaktivní tvůrce

Příklad použití

Vstup:

Vytvoř GraphQL schema pro blog platform. Types: User, Post, Comment. Queries: posts, user. Mutations: createPost, addComment. Relations: User 1:N Posts 1:N Comments. Framework: Apollo Server, TypeScript.

Výstup:

Complete GraphQL setup: Schema (User, Post, Comment types with relationships, getPost/getPosts queries with filters + pagination, createPost/updatePost/deletePost mutations with auth, Comment CRUD), Resolvers (field resolvers pro relationships, DataLoader eliminating N+1 on post.author, context with user auth), Input types (CreatePostInput with validation), cursor pagination on posts, error handling with custom errors (NotFoundError, AuthError), auth directives (@authenticated, @authorized), query complexity analysis (max 100), caching with Redis.

Kde použít tento prompt?

Najděte vhodné AI nástroje pro použití tohoto promptu a maximalizujte jeho efektivitu.

Objevte další AI prompty

Prozkoumejte naši sbírku Programování promptů a najděte ty, které vám pomohou dosáhnout lepších výsledků.