subgraph-development-guide

Convert on-chain events into a queryable subgraph GraphQL API.

5|Updated May 2, 2026
One-click install
npx skills add https://github.com/nirholas/three-ui --skill subgraph-development-guide-nirholas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: subgraph-development-guide
Source: https://github.com/nirholas/three-ui/tree/main/data/skills/development/subgraph-development-guide
Command: npx skills add https://github.com/nirholas/three-ui --skill subgraph-development-guide-nirholas

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you turn slow, fragmented blockchain data access into a structured, queryable GraphQL API using The Graph’s subgraphs.

Core Features & Use Cases

  • Subgraph architecture: Understand schema design, mapping handlers (event-driven AssemblyScript), and the manifest configuration in subgraph.yaml.
  • Practical indexing patterns: Model tokens, transfers, and accounts; compute derived metrics; and store event-derived entities efficiently.
  • Query-ready outputs: Use GraphQL queries to retrieve top transfer volume tokens, recent large transfers, and account balances via derived relationships.
  • Use Case: You want a DEX analytics dashboard that shows volume trends and relationships between swaps and token metadata; build a subgraph that indexes relevant events and exposes them through GraphQL.

Quick Start

Build a subgraph by defining your schema.graphql entities, wiring event handlers in src/mapping.ts, and configuring the data sources and eventHandlers in subgraph.yaml for your target contract(s).

Frequently Asked Questions about subgraph-development-guide

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

FAQPage Schema
How do I build a subgraph to index blockchain data into a GraphQL API?

To build a subgraph, define your schema.graphql entities, wire event-driven mapping handlers in AssemblyScript, and configure target contract data sources in subgraph.yaml to expose a queryable GraphQL API.

What is the best way to track token transfers and compute DeFi analytics on-chain?

The best way to track token transfers for DeFi analytics is using a subgraph to convert on-chain events into structured entities, enabling efficient historical aggregation and queryable derived relationships between accounts and tokens.

Does The Graph support indexing DEX swap events for volume trend dashboards?

Yes, The Graph supports indexing DEX swap events by defining event handlers in your subgraph manifest, allowing you to model swap volume trends and token metadata relationships for analytics dashboards via GraphQL.

How do I query recent large transfers and top token volumes using GraphQL?

You query recent large transfers and top token volumes by executing GraphQL queries against your subgraph endpoint, retrieving filtered and sorted event-derived entities based on the schema relationships you defined.

Do I need AssemblyScript to write mapping handlers for a subgraph?

Yes, you need AssemblyScript to write mapping handlers for a subgraph, as it is the language used to process event-driven blockchain data and store it as entities defined in your GraphQL schema.

Why is querying blockchain data directly slow and how does a subgraph solve this?

Querying blockchain data directly is slow because it lacks aggregation and relationships; a subgraph solves this by indexing on-chain events into a structured GraphQL API for fast, queryable analytics.