GraphQL Schema
Target: $ARGUMENTS
- Detect GraphQL setup:
cat package.json | grep -E '"graphql"|"apollo-server"|"pothos"|"nexus"|"typegraphql"|"@graphql-yoga"'
ls src/graphql/ src/schema/ 2>/dev/null | head -10
- If reviewing existing schema:
- N+1 problem: resolvers fetching data per parent field
- Missing
DataLoaderfor batched queries - Over-exposed fields (internal IDs, timestamps that shouldn't be public)
- Missing pagination (connections pattern)
- Mutations not returning the updated entity
- If generating new schema for
$ARGUMENTS:
type $ARGUMENTS {
id: ID!
# ... fields
createdAt: DateTime!
updatedAt: DateTime!
}
type Query {
$ARGUMENTS(id: ID!): $ARGUMENTS
${ARGUMENTS}s(first: Int, after: String, filter: ${ARGUMENTS}Filter): ${ARGUMENTS}Connection!
}
type Mutation {
create$ARGUMENTS(input: Create${ARGUMENTS}Input!): ${ARGUMENTS}MutationResult!
update$ARGUMENTS(id: ID!, input: Update${ARGUMENTS}Input!): ${ARGUMENTS}MutationResult!
delete$ARGUMENTS(id: ID!): Boolean!
}
- Generate resolver stubs and DataLoader for the entity.
- Add input validation and proper error types.