Back to Skills

graphql-inspector-audit

verified

Use when auditing GraphQL operations for complexity metrics, depth analysis, directive usage, or query performance concerns.

View on GitHub

Marketplace

han

TheBushidoCollective/han

Plugin

jutsu-graphql-inspector

Technique

Repository

TheBushidoCollective/han
60stars

jutsu/jutsu-graphql-inspector/skills/graphql-inspector-audit/SKILL.md

Last Verified

January 24, 2026

Install Skill

Select agents to install to:

Scope:
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-audit

Installation paths:

Claude
.claude/skills/graphql-inspector-audit/
Powered by add-skill CLI

Instructions

# 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

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
6190 chars