Agent skill

Apollo Server

by apollographql in apollographql/skills

Guide for building GraphQL servers with Apollo Server 5.x. An agent skill from apollographql/skills.

MITAuto-check passedBackend & APIs

Install Apollo Server

skills CLI
$ npx skills add apollographql/skills --skill apollo-server -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install apollographql/skills apollo-server --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/apollographql/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/apollo-server .claude/skills/apollo-server && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
apollo-server
GitHub stars
117
Token cost
~1.8k tokens
SKILL.md length
361 words
Files
7 (incl. references)
Skills in repo
12
Repo updated
First seen
Licence
MIT

At a glance

Guide for building GraphQL servers with Apollo Server 5.x. An agent skill from apollographql/skills.

  • Works in 4 steps: Install → Define Schema → Write Resolvers → …
  • Setting up a new Apollo Server project
  • SKILL.md covers Quick Start, Schema Definition, Resolvers Overview and Context Setup, plus 3 more sections
  • Calls npm

What it does

Apollo Server is an agent skill from apollographql/skills. Guide for building GraphQL servers with Apollo Server 5.x. Use this skill when: (1) setting up a new Apollo Server project, (2) writing resolvers or defining GraphQL schemas, (3) implementing authentication or authorization, (4) creating plugins or custom data sources, (5) troubleshooting Apollo Server errors or performance issues.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files (for example `references/context-and-auth.md`, `references/data-sources.md` and `references/error-handling.md`). Compatibility notes: Node.js v20+, TypeScript 4.7+. Works with Express v4/v5, standalone, Fastify, and serverless.

It sits in Backend & APIs, covering GraphQL. It works with Apollo GraphQL and GraphQL. The repository describes itself as: Apollo GraphQL Agent Skills. The licence is MIT.

When your agent uses it

  • Setting up a new Apollo Server project
  • Writing resolvers
  • Defining GraphQL schemas
  • Implementing authentication

Example prompts

  • “/apollo-server”

Requirements

  • Node.js
  • Compatibility (from SKILL.md): Node.js v20+, TypeScript 4.7+. Works with Express v4/v5, standalone, Fastify, and serverless.
  • Pre-approved tools (allowed-tools): Bash(npm:*), Bash(npx:*), Bash(node:*), Read, Write, Edit, Glob, Grep

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Install
  2. Define Schema
  3. Write Resolvers
  4. Start Server

What it can do on your machine

Read from SKILL.md and the folder at commit 5f02fcf. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash(npm:*)
    • Bash(npx:*)
    • Bash(node:*)
    • Read
    • Write
    • Edit
    • Glob
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Node.js v20+, TypeScript 4.7+. Works with Express v4/v5, standalone, Fastify, and serverless.

    From compatibility in the SKILL.md frontmatter.

Context cost

Apollo Server loads about 1.8k tokens when it runs, and up to ~17k if it reads all its reference files. Until then it costs about 87 tokens; SKILL.md has 361 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~87
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~17k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from apollographql/skills at commit 5f02fcf, republished under its MIT licence (© apollographql). 361 words, ~1,803 tokens.

Download SKILL.mdSave it as .claude/skills/apollo-server/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
apollo-server
description
Guide for building GraphQL servers with Apollo Server 5.x. Use this skill when: (1) setting up a new Apollo Server project, (2) writing resolvers or defining GraphQL schemas, (3) implementing authentication or authorization, (4) creating plugins or custom data sources, (5) troubleshooting Apollo Server errors or performance issues.
allowed-tools
Bash(npm:*), Bash(npx:*), Bash(node:*), Read, Write, Edit, Glob, Grep
compatibility
Node.js v20+, TypeScript 4.7+. Works with Express v4/v5, standalone, Fastify, and serverless.
license
MIT
metadata.author
apollographql
metadata.version
1.0.0

Apollo Server 5.x Guide

Apollo Server is an open-source GraphQL server that works with any GraphQL schema. Apollo Server 5 is framework-agnostic and runs standalone or integrates with Express, Fastify, and serverless environments.

Quick Start

Step 1: Install
bash
npm install @apollo/server graphql

For Express integration:

bash
npm install @apollo/server @as-integrations/express5 express graphql cors
Step 2: Define Schema
typescript
const typeDefs = `#graphql
  type Book {
    title: String
    author: String
  }

  type Query {
    books: [Book]
  }
`;
Step 3: Write Resolvers
typescript
const resolvers = {
  Query: {
    books: () => [
      { title: "The Great Gatsby", author: "F. Scott Fitzgerald" },
      { title: "1984", author: "George Orwell" },
    ],
  },
};
Step 4: Start Server

Standalone (Recommended for prototyping):

The standalone server is great for prototyping, but for production services, we recommend integrating Apollo Server with a more fully-featured web framework such as Express, Koa, or Fastify. Swapping from the standalone server to a web framework later is straightforward.

typescript
import { ApolloServer } from "@apollo/server";
import { startStandaloneServer } from "@apollo/server/standalone";

const server = new ApolloServer({ typeDefs, resolvers });

const { url } = await startStandaloneServer(server, {
  listen: { port: 4000 },
});

console.log(`Server ready at ${url}`);

Express:

typescript
import { ApolloServer } from "@apollo/server";
import { expressMiddleware } from "@as-integrations/express5";
import { ApolloServerPluginDrainHttpServer } from "@apollo/server/plugin/drainHttpServer";
import express from "express";
import http from "http";
import cors from "cors";

const app = express();
const httpServer = http.createServer(app);

const server = new ApolloServer({
  typeDefs,
  resolvers,
  plugins: [ApolloServerPluginDrainHttpServer({ httpServer })],
});

await server.start();

app.use(
  "/graphql",
  cors(),
  express.json(),
  expressMiddleware(server, {
    context: async ({ req }) => ({ token: req.headers.authorization }),
  }),
);

await new Promise<void>((resolve) => httpServer.listen({ port: 4000 }, resolve));
console.log("Server ready at http://localhost:4000/graphql");

Schema Definition

Scalar Types
  • Int - 32-bit integer
  • Float - Double-precision floating-point
  • String - UTF-8 string
  • Boolean - true/false
  • ID - Unique identifier (serialized as String)
Type Definitions
graphql
type User {
  id: ID!
  name: String!
  email: String
  posts: [Post!]!
}

type Post {
  id: ID!
  title: String!
  content: String
  author: User!
}

input CreatePostInput {
  title: String!
  content: String
}

type Query {
  user(id: ID!): User
  users: [User!]!
}

type Mutation {
  createPost(input: CreatePostInput!): Post!
}
Enums and Interfaces
graphql
enum Status {
  DRAFT
  PUBLISHED
  ARCHIVED
}

interface Node {
  id: ID!
}

type Article implements Node {
  id: ID!
  title: String!
}

Resolvers Overview

Resolvers follow the signature: (parent, args, contextValue, info)

  • parent: Result from parent resolver (root resolvers receive undefined)
  • args: Arguments passed to the field
  • contextValue: Shared context object (auth, dataSources, etc.)
  • info: Field-specific info and schema details (rarely used)
typescript
const resolvers = {
  Query: {
    user: async (_, { id }, { dataSources }) => {
      return dataSources.usersAPI.getUser(id);
    },
  },
  User: {
    posts: async (parent, _, { dataSources }) => {
      return dataSources.postsAPI.getPostsByAuthor(parent.id);
    },
  },
  Mutation: {
    createPost: async (_, { input }, { dataSources, user }) => {
      if (!user) throw new GraphQLError("Not authenticated");
      return dataSources.postsAPI.create({ ...input, authorId: user.id });
    },
  },
};

Context Setup

Context is created per-request and passed to all resolvers.

typescript
interface MyContext {
  token?: string;
  user?: User;
  dataSources: {
    usersAPI: UsersDataSource;
    postsAPI: PostsDataSource;
  };
}

const server = new ApolloServer<MyContext>({
  typeDefs,
  resolvers,
});

// Standalone
const { url } = await startStandaloneServer(server, {
  context: async ({ req }) => ({
    token: req.headers.authorization || "",
    user: await getUser(req.headers.authorization || ""),
    dataSources: {
      usersAPI: new UsersDataSource(),
      postsAPI: new PostsDataSource(),
    },
  }),
});

// Express middleware
expressMiddleware(server, {
  context: async ({ req, res }) => ({
    token: req.headers.authorization,
    user: await getUser(req.headers.authorization),
    dataSources: {
      usersAPI: new UsersDataSource(),
      postsAPI: new PostsDataSource(),
    },
  }),
});

Reference Files

Detailed documentation for specific topics:

Show full SKILL.md (145 more words)Show less

Key Rules

Schema Design
  • Use ! (non-null) for fields that always have values
  • Prefer input types for mutations over inline arguments
  • Use interfaces for polymorphic types
  • Keep schema descriptions for documentation
Resolver Best Practices
  • Keep resolvers thin - delegate to services/data sources
  • Always handle errors explicitly
  • Use DataLoader for batching related queries
  • Return partial data when possible (GraphQL's strength)
Performance
  • Use @defer and @stream for large responses
  • Implement DataLoader to solve N+1 queries
  • Consider persisted queries for production
  • Use caching headers and CDN where appropriate

Ground Rules

  • ALWAYS use Apollo Server 5.x patterns (not v4 or earlier)
  • ALWAYS type your context with TypeScript generics
  • ALWAYS use GraphQLError from graphql package for errors
  • NEVER expose stack traces in production errors
  • PREFER startStandaloneServer for prototyping only
  • USE an integration with a server framework like Express, Koa, Fastify, Next, etc. for production apps
  • IMPLEMENT authentication in context, authorization in resolvers

© apollographql, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (references) in skills/apollo-server of apollographql/skills.

  • SKILL.md
  • references/context-and-auth.md
  • references/data-sources.md
  • references/error-handling.md
  • references/plugins.md
  • references/resolvers.md
  • references/troubleshooting.md

Open the folder on GitHubat commit 5f02fcf

Compare with similar skills

Apollo Server next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Apollo Server compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Apollo Server this skillapollographql/skills117—~1.8kAutomated safety check: PassMIT
GraphQL Operations with CodegenChrisWiles/claude-code-showcase6.1k3 repos~1.5kAutomated safety check: PassNone
Graphqldavila7/claude-code-templates32k5 repos~625Automated safety check: PassMIT
Neo4j Graphql Skillneo4j-contrib/neo4j-skills114—~3.8kAutomated safety check: NotesMIT
Graphqlaiskillstore/marketplace4304 repos~6.5kAutomated safety check: PassNone
Apollo GraphqlKilo-Org/kilo-marketplace1901 repos~3.1kAutomated safety check: PassApache-2.0

Similar skills

  • GraphQL Operations with Codegen

    ChrisWiles/claude-code-showcase

    Sets the rules for writing GraphQL queries and mutations in .gql files, running codegen, and using generated Apollo hooks with proper error and loading handling.

    6.1k GitHub starsUsed in 3 repos~1.5k tokens
    Backend & APIsAuto-check passed
  • Graphql

    davila7/claude-code-templates

    GraphQL gives clients exactly the data they need - no more, no less.

    32k GitHub starsUsed in 5 repos~625 tokens
    Backend & APIsAuto-check passed
  • Neo4j Graphql Skill

    neo4j-contrib/neo4j-skills

    Build and configure a GraphQL API backed by Neo4j using @neo4j/graphql v7 (current) or v5 (LTS).

    114 GitHub stars~3.8k tokensUpdated yesterday
    Backend & APIsAuto-check: notes
  • Graphql

    aiskillstore/marketplace

    GraphQL gives clients exactly the data they need - no more, no less.

    430 GitHub starsUsed in 4 repos~6.5k tokens
    Backend & APIsAuto-check passed
  • Apollo Graphql

    Kilo-Org/kilo-marketplace

    Guidelines for developing GraphQL APIs and React applications using Apollo Client for state management, data fetching, and caching

    190 GitHub starsUsed in 1 repo~3.1k tokens
    Backend & APIsAuto-check passed
  • MCP Apps Sync Docs

    apollographql/apollo-mcp-server

    Syncs MCP Apps documentation with the @apollo/client-ai-apps changelog.

    311 GitHub stars~1.2k tokensUpdated yesterday
    DevelopmentAuto-check passed

More from apollographql/skills

All 12 skills in this repo
  • Apollo Federation

    apollographql/skills

    Guide for authoring Apollo Federation subgraph schemas. An agent skill from apollographql/skills.

    117 GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Apollo iOS

    apollographql/skills

    Guide for building Apple-platform applications with Apollo iOS, the strongly-typed GraphQL client for Swift.

    117 GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed
  • Graphos Factory

    apollographql/skills

    Build and iterate on an Apollo Connectors subgraph for a GraphOS supergraph from a REST API, with or without an OpenAPI or Swagger spec, in a dedicated git workspace that records what the API…

    117 GitHub stars~15k tokensUpdated today
    Auto-check passed
  • Graphql Operations

    apollographql/skills

    Guide for writing GraphQL operations (queries, mutations, fragments) following best practices.

    117 GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed
  • Apollo Client

    apollographql/skills

    Guide for building React applications with Apollo Client 4.x.

    117 GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Apollo Connectors

    apollographql/skills

    DEPRECATED: superseded by the graphos-factory skill (npx skills add apollographql/skills@graphos-factory), which builds and maintains a Connectors subgraph from a REST API with recorded decisions…

    117 GitHub stars~1.8k tokensUpdated today
    Auto-check passed

Categories

Questions about Apollo Server

What does Apollo Server do?

Guide for building GraphQL servers with Apollo Server 5.x. An agent skill from apollographql/skills. Apollo Server is an agent skill from apollographql/skills.x.

When should I use Apollo Server?

Apollo Server fits situations like: setting up a new Apollo Server project; writing resolvers; defining GraphQL schemas; implementing authentication.

How do I install Apollo Server in Claude Code?

Run `npx skills add apollographql/skills --skill apollo-server -a claude-code`. Or copy the skill folder (skills/apollo-server in apollographql/skills) into .claude/skills/apollo-server in your project. Claude Code loads it when a task matches its description.

How do I install Apollo Server in Codex?

Run `npx skills add apollographql/skills --skill apollo-server -a codex`. Or copy the skill folder (skills/apollo-server in apollographql/skills) into .agents/skills/apollo-server in your project. Codex loads it when a task matches its description.

Can I use Apollo Server in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add apollographql/skills --skill apollo-server -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/apollo-server, .gemini/skills/apollo-server, .github/skills/apollo-server and .opencode/skills/apollo-server in your project.

What does Apollo Server need to run?

Going by SKILL.md and its folder, Apollo Server needs the command-line tools its instructions call (npm). Our summary lists: Node.js. Its frontmatter pre-approves these tools: Bash(npm:*), Bash(npx:*), Bash(node:*), Read, Write, Edit, Glob, Grep. Compatibility (from SKILL.md): Node.js v20+, TypeScript 4.7+. Works with Express v4/v5, standalone, Fastify, and serverless..

Does Apollo Server access the network?

SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Apollo Server safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Apollo Server use?

Apollo Server is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Apollo Server use?

About 1.8k tokens (SKILL.md is roughly 7.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 15k tokens, read only when the agent opens those files.

What are the alternatives to Apollo Server?

Skills that share tags, products or a category with Apollo Server: GraphQL Operations with Codegen (ChrisWiles/claude-code-showcase, 6.1k stars), Graphql (davila7/claude-code-templates, 32k stars), Neo4j Graphql Skill (neo4j-contrib/neo4j-skills, 114 stars) and Graphql (aiskillstore/marketplace, 430 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Apollo Server?

apollographql (a GitHub organization) maintains it in apollographql/skills, which has 117 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 7, 2026.

Source: apollographql/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.