RD

rdc-graphql-setup

Streamlines GraphQL client configuration with authentication and endpoint management.

Install

mkdir -p .claude/skills/rdc-graphql-setup && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/3493" && unzip -o skill.zip -d .claude/skills/rdc-graphql-setup && rm skill.zip

Installs to .claude/skills/rdc-graphql-setup

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Set up @data-client/graphql for GraphQL APIs. Configures GQLEndpoint with auth and custom options. Use after data-client-setup detects GraphQL patterns.
152 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Configure GQLEndpoint
  • Implement async authentication headers
  • Define GraphQL queries and mutations
  • Integrate custom error handling
  • Support collection-based schema operations

How it works

It initializes a GQLEndpoint instance with custom headers and error-handling logic, enabling type-safe GraphQL operations within the data-client ecosystem.

Inputs & outputs

You give it
GraphQL endpoint URL
You get back
Configured GQLEndpoint instance

When to use rdc-graphql-setup

  • Initialize GraphQL client with auth
  • Define custom GraphQL endpoints
  • Configure data-client for existing GraphQL schemas

About this skill

GraphQL Protocol Setup

This skill configures @data-client/graphql for a project. It should be applied after data-client-setup detects GraphQL patterns.

Installation

Install the GraphQL package alongside the core package:

# npm
npm install @data-client/graphql

# yarn
yarn add @data-client/graphql

# pnpm
pnpm add @data-client/graphql

GQLEndpoint Setup

Basic Configuration

Create a file at src/api/gql.ts (or similar):

import { GQLEndpoint } from '@data-client/graphql';

export const gql = new GQLEndpoint('/graphql');

Detection Checklist

Scan the existing codebase for GraphQL patterns:

  1. GraphQL endpoint URL: Look for /graphql or custom paths
  2. Authentication: Check for auth headers in existing GraphQL client setup
  3. Custom headers: API keys, tenant IDs, etc.
  4. Error handling: GraphQL error parsing patterns

With Authentication

import { GQLEndpoint } from '@data-client/graphql';

export const gql = new GQLEndpoint('/graphql', {
  getHeaders() {
    const token = localStorage.getItem('authToken');
    return {
      'Content-Type': 'application/json',
      ...(token && { Authorization: `Bearer ${token}` }),
    };
  },
});

Async Authentication (token refresh)

import { GQLEndpoint } from '@data-client/graphql';

export const gql = new GQLEndpoint('/graphql', {
  async getHeaders() {
    const token = await getValidToken();
    return {
      'Content-Type': 'application/json',
      Authorization: `Bearer ${token}`,
    };
  },
});

Custom Error Handling

import { GQLEndpoint } from '@data-client/graphql';

class CustomGQLEndpoint extends GQLEndpoint {
  async fetchResponse(input: RequestInfo, init: RequestInit): Promise<any> {
    const response = await super.fetchResponse(input, init);
    
    // Handle GraphQL errors
    if (response.errors?.length) {
      const authError = response.errors.find(
        e => e.extensions?.code === 'UNAUTHENTICATED'
      );
      if (authError) {
        window.dispatchEvent(new CustomEvent('auth:expired'));
      }
    }
    
    return response;
  }
}

export const gql = new CustomGQLEndpoint('/graphql');

Defining Queries and Mutations

Query Example

import { gql } from './gql';
import { User } from '../schemas/User';

export const getUser = gql.query(
  (v: { id: string }) => `
    query GetUser($id: ID!) {
      user(id: $id) {
        id
        name
        email
      }
    }
  `,
  { schema: User },
);

Mutation Example

import { gql } from './gql';
import { User } from '../schemas/User';

export const updateUser = gql.mutation(
  (v: { id: string; name: string }) => `
    mutation UpdateUser($id: ID!, $name: String!) {
      updateUser(id: $id, name: $name) {
        id
        name
      }
    }
  `,
  { schema: User },
);

With Collection

import { gql } from './gql';
import { User, UserCollection } from '../schemas/User';

export const listUsers = gql.query(
  () => `
    query ListUsers {
      users {
        id
        name
        email
      }
    }
  `,
  { schema: UserCollection },
);

export const createUser = gql.mutation(
  (v: { name: string; email: string }) => `
    mutation CreateUser($name: String!, $email: String!) {
      createUser(name: $name, email: $email) {
        id
        name
        email
      }
    }
  `,
  { schema: UserCollection.push },
);

Usage in Components

import { useSuspense, useController } from '@data-client/react';
import { getUser, updateUser } from './api/users';

function UserProfile({ id }: { id: string }) {
  const user = useSuspense(getUser, { id });
  const ctrl = useController();

  const handleUpdate = async (name: string) => {
    await ctrl.fetch(updateUser, { id, name });
  };

  return (
    <div>
      <h1>{user.name}</h1>
      <button onClick={() => handleUpdate('New Name')}>Update</button>
    </div>
  );
}

Next Steps

  1. Apply skill "data-client-schema" to define Entity classes
  2. Apply skill "data-client-react" or "data-client-vue" for usage

References

When not to use it

  • When the project does not use GraphQL
  • Before running data-client-setup

Prerequisites

@data-client/graphql package

Limitations

  • Requires prior detection of GraphQL patterns
  • Limited to @data-client/graphql ecosystem

How it compares

It provides a centralized, typed configuration for GraphQL endpoints that integrates directly with data-client hooks, replacing manual fetch calls.

Compared to similar skills

rdc-graphql-setup side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
rdc-graphql-setup (this skill)15moReviewIntermediate
api-design-principles722moNo flagsIntermediate
nodejs-backend-patterns122moNo flagsIntermediate
graphql66moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

api-design-principles

wshobson

Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use when designing new APIs, reviewing API specifications, or establishing API design standards.

72170

nodejs-backend-patterns

wshobson

Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices. Use when creating Node.js servers, REST APIs, GraphQL backends, or microservices architectures.

1246

graphql

davila7

GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.

624

api-contract-sync-manager

ananddtyagi

Validate OpenAPI, Swagger, and GraphQL schemas match backend implementation. Detect breaking changes, generate TypeScript clients, and ensure API documentation stays synchronized. Use when working with API spec files (.yaml, .json, .graphql), reviewing API changes, generating frontend types, or validating endpoint implementations.

18

designing-apis

CloudAI-X

Designs REST and GraphQL APIs including endpoints, error handling, versioning, and documentation. Use when creating new APIs, designing endpoints, reviewing API contracts, or when asked about REST, GraphQL, or API patterns.

12

graphql-architect

sickn33

Master modern GraphQL with federation, performance optimization, and enterprise security. Build scalable schemas, implement advanced caching, and design real-time systems. Use PROACTIVELY for GraphQL architecture or performance optimization.

12

Search skills

Search the agent skills registry