Use when validating GraphQL operations/documents against a schema, checking query depth, complexity, or fragment usage.
View on GitHubTheBushidoCollective/han
jutsu-graphql-inspector
jutsu/jutsu-graphql-inspector/skills/graphql-inspector-validate/SKILL.md
January 24, 2026
Select agents to install to:
npx add-skill https://github.com/TheBushidoCollective/han/blob/main/jutsu/jutsu-graphql-inspector/skills/graphql-inspector-validate/SKILL.md -a claude-code --skill graphql-inspector-validateInstallation paths:
.claude/skills/graphql-inspector-validate/# GraphQL Inspector - Validate
Expert knowledge of GraphQL Inspector's validate command for checking operations and documents against a schema with configurable rules.
## Overview
The validate command checks GraphQL operations (queries, mutations, subscriptions) and fragments against a schema. It catches errors like undefined fields, wrong argument types, and invalid fragment spreads before runtime.
## Core Commands
### Basic Validation
```bash
# Validate operations against schema
npx @graphql-inspector/cli validate './src/**/*.graphql' './schema.graphql'
# Validate operations from TypeScript files
npx @graphql-inspector/cli validate './src/**/*.tsx' './schema.graphql'
# Validate with glob patterns
npx @graphql-inspector/cli validate './**/*.{graphql,gql}' './schema.graphql'
```
### Federation Support
```bash
# Apollo Federation V1
npx @graphql-inspector/cli validate './operations/**/*.graphql' './schema.graphql' \
--federation
# Apollo Federation V2
npx @graphql-inspector/cli validate './operations/**/*.graphql' './schema.graphql' \
--federationV2
# AWS AppSync directives
npx @graphql-inspector/cli validate './operations/**/*.graphql' './schema.graphql' \
--aws
```
## Validation Rules
### Depth Limiting
Prevent deeply nested queries that could cause performance issues:
```bash
# Fail if query depth exceeds 10
npx @graphql-inspector/cli validate './src/**/*.graphql' './schema.graphql' \
--maxDepth 10
```
Example violation:
```graphql
# Depth of 8 - might exceed limit
query DeepQuery {
user { # 1
posts { # 2
author { # 3
followers { # 4
posts { # 5
comments { # 6
author { # 7
name # 8
}
}
}
}
}
}
}
}
```
### Alias Count
Limit alias usage to prevent response explosion:
```bash
# Max 5 aliases per operation
npx @graphql-inspe