Install
openclaw skills install graphql-schema-analyzerAnalyze GraphQL schemas for performance, security, complexity, and best practices — detect N+1 queries, circular references, excessive depth, and missing aut...
openclaw skills install graphql-schema-analyzerAnalyze GraphQL schemas for performance bottlenecks, security vulnerabilities, query complexity issues, and best practices. Detects N+1 resolver patterns, circular references, excessive query depth, missing authorization, and schema design anti-patterns.
"Analyze my GraphQL schema for issues"
"Check for N+1 queries in my resolvers"
"Audit GraphQL authorization and security"
"Optimize my GraphQL schema performance"
# Find schema files
find . -name "*.graphql" -o -name "*.gql" -o -name "schema.ts" -o -name "typeDefs*" | head -20
# Find resolver files
find . -name "*resolver*" -o -name "*resolvers*" | head -20
# Check for schema-first vs code-first
grep -rn "buildSchema\|makeExecutableSchema\|@ObjectType\|@Field" src/ 2>/dev/null | head -10
Type design:
Naming conventions:
N+1 query detection:
Query complexity:
Resolver efficiency:
Authorization:
Denial of service:
Data leakage:
## GraphQL Schema Analysis
**Types:** 34 | **Queries:** 12 | **Mutations:** 18 | **Subscriptions:** 3
### 🔴 Critical (3)
1. **N+1 on User.posts resolver** — resolvers/user.ts:23
Each user in a list query triggers individual posts query
→ Implement DataLoader: batch user IDs → single query
2. **No query depth limit** — server.ts
Allows queries nested to unlimited depth
→ Add depth limiting plugin (max 8-10 levels)
3. **Introspection enabled in production** — server.ts:15
Full schema discoverable by anyone
→ Disable in production: `introspection: process.env.NODE_ENV !== 'production'`
### 🟡 Warnings (5)
4. 3 mutations without authorization middleware
5. User.email exposed without field-level auth
6. `posts` query returns unbounded list (no pagination)
7. Circular reference: User → Posts → Author → Posts
8. 5 deprecated fields without migration timeline
### 📊 Schema Metrics
- Average type size: 6.2 fields
- Deepest nesting: 7 levels (User → Posts → Comments → Author → ...)
- Largest type: Order (18 fields — consider splitting)
- Undocumented types: 12/34 (35%)
### ✅ Good Practices
- Relay-style pagination on main collections
- Input validation via custom scalars (Email, DateTime)
- Proper union types for polymorphic returns
- Error union pattern for typed error handling