Use when auditing GraphQL operations for complexity metrics, depth analysis, directive usage, or query performance concerns.
View on GitHubTheBushidoCollective/han
jutsu-graphql-inspector
jutsu/jutsu-graphql-inspector/skills/graphql-inspector-audit/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-audit/SKILL.md -a claude-code --skill graphql-inspector-auditInstallation paths:
.claude/skills/graphql-inspector-audit/# GraphQL Inspector - Audit
Expert knowledge of GraphQL Inspector's audit command for analyzing operation complexity and identifying potential performance issues.
## Overview
The audit command analyzes GraphQL operations to provide metrics about query depth, directive count, alias count, and complexity. This helps identify operations that may cause performance issues before they reach production.
## Core Commands
### Basic Audit
```bash
# Audit all GraphQL operations
npx @graphql-inspector/cli audit './src/**/*.graphql'
# Audit operations from TypeScript files
npx @graphql-inspector/cli audit './src/**/*.tsx'
# Audit with multiple patterns
npx @graphql-inspector/cli audit './packages/**/*.graphql' './apps/**/*.tsx'
```
### Audit with Schema
```bash
# Audit against a specific schema
npx @graphql-inspector/cli audit './src/**/*.graphql' --schema './schema.graphql'
```
## Metrics Analyzed
### Query Depth
Measures the maximum nesting level of a query:
```graphql
# Depth: 4
query UserPosts {
user { # 1
posts { # 2
comments { # 3
author { # 4
name
}
}
}
}
}
```
High depth operations can cause:
- Slow database queries (N+1 problems)
- Memory pressure on resolvers
- Long response times
### Alias Count
Counts the number of field aliases:
```graphql
# Alias count: 3
query MultipleUsers {
admin: user(id: "1") { name }
moderator: user(id: "2") { name }
member: user(id: "3") { name }
}
```
High alias counts can:
- Multiply database queries
- Increase payload size
- Indicate query batching abuse
### Directive Count
Counts directives used in the operation:
```graphql
# Directive count: 4
query ConditionalData($includeEmail: Boolean!, $skipPhone: Boolean!) {
user {
name
email @include(if: $includeEmail)
phone @skip(if: $skipPhone)
avatar @cacheControl(maxAge: 3600)
bio @deprecated
}
}
```
### Token Count
Counts the total tokens in the operation:
```graphql