the-graph

Build and deploy subgraphs indexing blockchain events into queryable GraphQL APIs.

6|20|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/andresdefi/cryptoskills --skill the-graph-andresdefi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: the-graph
Source: https://github.com/andresdefi/cryptoskills/tree/main/skills/the-graph
Command: npx skills add https://github.com/andresdefi/cryptoskills --skill the-graph-andresdefi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @graphprotocol/graph-cli, @graphprotocol/graph-ts, @graphprotocol/client-cli, graphql, and includes references (resource) components.

What problem does it solve? AI agents frequently produce outdated or incorrect guidance for The Graph protocol, such as using the deprecated hosted service, writing mappings in standard TypeScript instead of AssemblyScript, or skipping the codegen step, which leads to failed builds and halted indexing. ## Core Features & Use Cases - Subgraph Development: Covers the full lifecycle from graph init through schema design, manifest configuration, AssemblyScript mappings, codegen, build, and deployment to Subgraph Studio. - GraphQL Querying: Provides query patterns including filtering, cursor-based pagination, time-travel queries, and full-text search against deployed subgraphs. - Indexing Optimization: Documents immutable entities, Bytes IDs, startBlock tuning, pruning, and contract read caching to reduce indexing time and storage. - Use Case: A developer needs to index USDC Transfer events on Ethereum mainnet and expose token balances via a GraphQL API; this Skill provides the schema, manifest, AssemblyScript handlers, and deployment commands to ship it. ## Quick Start Use the the-graph skill to create a subgraph that indexes Transfer events for my ERC-20 contract and deploy it to Subgraph Studio.

Frequently Asked Questions about the-graph

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create and deploy a subgraph on The Graph?

Run graph init to scaffold the project, define entities in schema.graphql, configure subgraph.yaml, write AssemblyScript handlers, then run graph codegen and graph build. Authenticate with graph auth --studio and deploy using graph deploy --studio with a version label.

How do I query a subgraph with GraphQL?

Send a POST request with a GraphQL query to the gateway endpoint at gateway.thegraph.com with your API key and subgraph ID. Use first, skip, orderBy, and where filters; for large datasets use cursor-based pagination with id_gt since skip is capped at 5000.

Is The Graph hosted service still available?

No, the hosted service is deprecated and stopped serving queries in Q2 2024. All deployments must use Subgraph Studio, and any documentation referencing the old --node api.thegraph.com/deploy endpoint is outdated.

Why does my subgraph build fail with TypeScript errors?

Mappings are AssemblyScript, not TypeScript, so closures, optional chaining, Array.map, try/catch, and async/await are unsupported. Also run graph codegen before graph build, since imports from the generated directory fail without it.

Why did my subgraph stop indexing at a specific block?

A deterministic error in a handler, such as a null dereference, division by zero, or a non-try contract call that reverted, halts indexing permanently. Check Studio logs, fix the handler logic, and redeploy a new version.

When should I use Ponder or Dune instead of The Graph?

Use Ponder for rapid TypeScript-native development with hot reloading, and Dune for SQL-based historical analytics across chains. The Graph fits production dApp backends needing a decentralized, reliable GraphQL API.