Agent skill

Subgraph Development Guide

by nirholas in nirholas/three.ws

Guide to building blockchain data indexes with The Graph — subgraph architecture, schema design, mapping handlers, deployment, and querying.

MITAuto-check passedDatabases

Install Subgraph Development Guide

skills CLI
$ npx skills add nirholas/three.ws --skill subgraph-development-guide -a claude-code

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

GitHub CLI
$ gh skill install nirholas/three.ws subgraph-development-guide --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/nirholas/three.ws.git skills-src && mkdir -p .claude/skills && cp -r skills-src/data/skills/development/subgraph-development-guide .claude/skills/subgraph-development-guide && 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
subgraph-development-guide
GitHub stars
226
Token cost
~2.1k tokens
SKILL.md length
419 words
Files
1
Skills in repo
165
Repo updated
First seen
Licence
MIT

At a glance

Guide to building blockchain data indexes with The Graph — subgraph architecture, schema design, mapping handlers, deployment, and querying.

  • Works in 3 steps: Schema (schema.graphql) → Manifest (subgraph.yaml) → Mapping (src/mapping.ts)
  • Explaining blockchain indexing
  • SKILL.md covers Why Subgraphs?, Architecture, Building a Token Transfer… and Querying Subgraphs, plus 5 more sections
  • Calls npm and docker-compose

What it does

Subgraph Development Guide is an agent skill from nirholas/three.ws. Guide to building blockchain data indexes with The Graph — subgraph architecture, schema design, mapping handlers, deployment, and querying. Covers GraphQL APIs for DEX data, token transfers, and DeFi protocol events. Use when explaining blockchain indexing or building custom data pipelines.

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering GraphQL, Database schema design and Data pipelines and ETL. It works with GraphQL. The repository describes itself as: Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web… The licence is MIT.

When your agent uses it

  • Explaining blockchain indexing
  • Building custom data pipelines

Example prompts

  • “/subgraph-development-guide”

Requirements

  • Node.js
  • Docker
  • A credential in YOUR_DEPLOY_KEY

Workflow steps

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

  1. Schema (schema.graphql)
  2. Manifest (subgraph.yaml)
  3. Mapping (src/mapping.ts)

What it can do on your machine

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

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm
    • docker-compose

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

  • Network

    Links to these hosts (documentation or services it may open):

    • thegraph.com
    • github.com
    • arbiscan.io

    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.

Context cost

Subgraph Development Guide loads about 2.1k tokens when it runs. Until then it costs about 80 tokens; SKILL.md has 419 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~80
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

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 nirholas/three.ws at commit 238ef60, republished under its MIT licence (© nirholas). 419 words, ~2,110 tokens.

Download SKILL.mdSave it as .claude/skills/subgraph-development-guide/SKILL.md (or your agent's skills folder).
name
subgraph-development-guide
description
Guide to building blockchain data indexes with The Graph — subgraph architecture, schema design, mapping handlers, deployment, and querying. Covers GraphQL APIs for DEX data, token transfers, and DeFi protocol events. Use when explaining blockchain indexing or building custom data pipelines.
license
MIT
metadata.category
development
metadata.difficulty
advanced
metadata.author
clawhub
metadata.tags
development, subgraph-development-guide

Subgraph Development Guide

The Graph is the indexing protocol for blockchain data. Subgraphs turn raw blockchain events into queryable GraphQL APIs. This guide covers how they work and how to build them.

Why Subgraphs?

The Problem

Reading blockchain data directly is painful:

  • RPC calls are slow and sequential
  • No aggregation (can't query "total volume last 7 days")
  • No relationships (can't join swaps with token metadata)
  • Rate limits on public RPCs
The Solution

Subgraphs listen to blockchain events, process them, and store structured data:

Blockchain Events → Subgraph Indexer → GraphQL API
(Swap, Transfer,    (Processes,        (Fast queries,
 Mint, Burn)         aggregates)        relationships)

Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│  1. Schema       │    │  2. Mappings     │    │  3. Manifest     │
│  (GraphQL types) │    │  (Event handlers)│    │  (subgraph.yaml) │
│                  │    │                  │    │                  │
│  type Token {    │    │  handleSwap(e) { │    │  dataSources:    │
│    id: ID!       │    │    // process    │    │    - name: Pool  │
│    symbol: String│    │    // and save   │    │      source:     │
│    volume: BigInt│    │  }              │    │        abi: Pool  │
│  }              │    │                  │    │        address:   │
└─────────────────┘    └─────────────────┘    └─────────────────┘
Three Core Files
FilePurpose
schema.graphqlDefine your data model (entities)
src/mapping.tsEvent handler functions (AssemblyScript)
subgraph.yamlManifest — which contracts, events, and chains to index

Building a Token Transfer Tracker

Step 1: Schema (schema.graphql)
graphql
type Token @entity {
  id: ID!                       # Contract address
  symbol: String!
  name: String!
  decimals: Int!
  totalSupply: BigInt!
  transferCount: BigInt!
  holderCount: BigInt!
}

type Transfer @entity {
  id: ID!                       # tx hash + log index
  token: Token!
  from: Bytes!
  to: Bytes!
  value: BigDecimal!
  timestamp: BigInt!
  blockNumber: BigInt!
}

type Account @entity {
  id: ID!                       # Wallet address
  balances: [AccountBalance!]! @derivedFrom(field: "account")
}

type AccountBalance @entity {
  id: ID!                       # account-token
  account: Account!
  token: Token!
  balance: BigDecimal!
}
Step 2: Manifest (subgraph.yaml)
yaml
specVersion: 0.0.5
schema:
  file: ./schema.graphql

dataSources:
  - kind: ethereum
    name: USDC
    network: arbitrum-one
    source:
      address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
      abi: ERC20
      startBlock: 100000000
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.7
      language: wasm/assemblyscript
      entities:
        - Token
        - Transfer
        - Account
      abis:
        - name: ERC20
          file: ./abis/ERC20.json
      eventHandlers:
        - event: Transfer(indexed address,indexed address,uint256)
          handler: handleTransfer
      file: ./src/mapping.ts
Step 3: Mapping (src/mapping.ts)
typescript
import { Transfer as TransferEvent } from "../generated/USDC/ERC20"
import { Token, Transfer, Account, AccountBalance } from "../generated/schema"
import { BigInt, BigDecimal } from "@graphprotocol/graph-ts"

export function handleTransfer(event: TransferEvent): void {
  // Load or create token
  let token = Token.load(event.address.toHexString())
  if (token == null) {
    token = new Token(event.address.toHexString())
    token.symbol = "USDC"
    token.name = "USD Coin"
    token.decimals = 6
    token.totalSupply = BigInt.fromI32(0)
    token.transferCount = BigInt.fromI32(0)
    token.holderCount = BigInt.fromI32(0)
  }
  token.transferCount = token.transferCount.plus(BigInt.fromI32(1))
  token.save()

  // Create transfer entity
  let transfer = new Transfer(
    event.transaction.hash.toHexString() + "-" + event.logIndex.toString()
  )
  transfer.token = token.id
  transfer.from = event.params.from
  transfer.to = event.params.to
  transfer.value = event.params.value.toBigDecimal().div(
    BigDecimal.fromString("1000000") // 6 decimals
  )
  transfer.timestamp = event.block.timestamp
  transfer.blockNumber = event.block.number
  transfer.save()
}

Querying Subgraphs

GraphQL Query Examples

Top tokens by transfer volume:

graphql
{
  tokens(first: 10, orderBy: transferCount, orderDirection: desc) {
    id
    symbol
    transferCount
  }
}

Recent large transfers:

graphql
{
  transfers(
    first: 20
    orderBy: timestamp
    orderDirection: desc
    where: { value_gt: "100000" }
  ) {
    from
    to
    value
    timestamp
    token { symbol }
  }
}

Account balances:

graphql
{
  account(id: "0x1234...") {
    balances {
      token { symbol }
      balance
    }
  }
}
Query Endpoints
NetworkHosted ServiceDecentralized
Ethereumapi.thegraph.com/subgraphs/name/...gateway.thegraph.com/api/...
ArbitrumSame patternSame pattern
Base/OptimismSame patternSame pattern
SubgraphWhat It IndexesUseful For
Uniswap V3Pools, swaps, liquidity positionsDEX price data, volume
Aave V3Deposits, borrows, liquidationsLending market data
Balancer V2Pools, swaps, BPT balancesMulti-asset pool data
ENSDomain registrations, transfersName resolution
SperaxUSDs transfers, SPA stakingSperax ecosystem data

Deployment

The Graph Studio (Decentralized)
bash
# Install CLI
npm install -g @graphprotocol/graph-cli

# Initialize
graph init --studio my-subgraph

# Authenticate
graph auth --studio YOUR_DEPLOY_KEY

# Build + Deploy
graph codegen
graph build
graph deploy --studio my-subgraph
Self-Hosted Graph Node

For full control:

bash
# Docker Compose
docker-compose up graph-node postgres ipfs

# Deploy to local
graph create --node http://localhost:8020/ my-subgraph
graph deploy --node http://localhost:8020/ my-subgraph

Performance Tips

TipWhy
Use startBlock wiselyDon't index from block 0 — start from contract deployment
Avoid call handlersThey're 10x slower than event handlers
Use BigDecimal for pricesAvoid precision loss with BigInt division
Batch entity loadingUse store.get() sparingly in hot paths
Index only what you needMore entities = slower indexing
Show full SKILL.md (145 more words)Show less

Alternative Indexing Solutions

ToolApproachBest For
The GraphDecentralized, GraphQLProduction DeFi data
GoldskyManaged subgraph hosting + streamingHigh-performance queries
EnvioHyperIndex — fast parallel indexingSpeed-critical applications
PonderTypeScript framework for indexingDeveloper-friendly, type-safe
Dune AnalyticsSQL on decoded blockchain dataAnalytics and dashboards

Agent Tips

  1. Use existing subgraphs first — don't build one if Uniswap/Aave already has what you need
  2. Decentralized network is production — hosted service is being sunset
  3. Start with events, not calls — event handlers are much faster
  4. Schema design matters — think about what queries you need before designing entities
  5. Multi-chain — deploy the same subgraph to multiple networks for cross-chain data
  6. Sperax data: USDs transfer volumes, SPA staking events, and veSPA locking can all be indexed with subgraphs on Arbitrum

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

Files

Just SKILL.md in data/skills/development/subgraph-development-guide of nirholas/three.ws.

Open the folder on GitHubat commit 238ef60

Compare with similar skills

Subgraph Development Guide 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.

Subgraph Development Guide compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Subgraph Development Guide this skillnirholas/three.ws226—~2.1kAutomated safety check: PassMIT
API Architectcuriositech/some_claude_skills2431 repos~1.4kAutomated safety check: PassMIT
Railway APImajiayu000/claude-skill-registry6661 repos~2kAutomated safety check: PassMIT
Ar Io Gateway Operatorar-io/ar-io-node127—~8.2kAutomated safety check: NotesAGPL-3.0
Data Client Schemareactive/data-client2k—~2.3kAutomated safety check: PassApache-2.0
Wp Headless And Wpgraphqljorgerosal/wordpress-skills100—~1.7kAutomated safety check: PassMIT

Similar skills

  • API Architect

    curiositech/some_claude_skills

    Expert API designer for REST, GraphQL, gRPC architectures. An agent skill from curiositech/some_claude_skills.

    243 GitHub starsUsed in 1 repo~1.4k tokens
    Backend & APIsAuto-check passed
  • Railway API

    majiayu000/claude-skill-registry

    Railway.com GraphQL API automation for projects, services, deployments, and environment variables.

    666 GitHub starsUsed in 1 repo~2k tokens
    DevOps & CloudAuto-check passed
  • Ar Io Gateway Operator

    ar-io/ar-io-node

    Operate any AR.IO node deployment — architecture, daily ops, diagnostics, and recurring pitfalls that apply to every operator.

    127 GitHub stars~8.2k tokensUpdated today
    Backend & APIsAuto-check: notes
  • Data Client Schema

    reactive/data-client

    Model data with @data-client schemas (Entity, EntityMixin, Collection, Union, Query, Values, All, Invalidate, Lazy, Scalar) for atomic, consistent, referentially-equal async data via normalization…

    2k GitHub stars~2.3k tokensUpdated today
    Backend & APIsAuto-check passed
  • Wp Headless And Wpgraphql

    jorgerosal/wordpress-skills

    Headless WordPress and WPGraphQL review guidance. An agent skill from jorgerosal/wordpress-skills.

    100 GitHub stars~1.7k tokensUpdated 4 mo ago
    Backend & APIsAuto-check passed
  • Moai Ref API Patterns

    modu-ai/moai-adk

    REST/GraphQL API design patterns, error handling conventions, and input validation reference for backend development.

    1.2k GitHub stars~1.9k tokensUpdated today
    Backend & APIsAuto-check passed

More from nirholas/three.ws

All 165 skills in this repo
  • Add Shader Cursor Trail

    nirholas/three.ws

    Add the Shaders WebGPU mouse effect used for the Tidal Commons hero: a white twinkling halftone cursor trail driven by ChromaFlow, masked through a DotGrid, finished with chromatic ripples and film…

    226 GitHub starsUsed in 1 repo~760 tokens
    Auto-check passed
  • Publish Project To GitHub

    nirholas/three.ws

    Package a finished local project into an intentional GitHub repository, create a strong README and visual preview, push it safely, configure a public GitHub Pages URL when the project is compatible…

    226 GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check: notes
  • Audit a website or digital experience against its supplied source references for originality and plagiarism risk.

    226 GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • Turn a completed daily UI inspiration capture into exactly five original landing-page builds, one per separate Codex task, using Sites.

    226 GitHub starsUsed in 1 repo~1.9k tokens
    Auto-check passed
  • Write Like Meng On X

    nirholas/three.ws

    Write, rewrite, review, or continuously refine X/Twitter posts in Meng To's current voice using his deduplicated authored-post corpus, personal and product context, shared resources, and Content…

    226 GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed
  • Browser Video Recording

    nirholas/three.ws

    Create polished 60 fps 4:3 4K browser screen-recording style videos from Codex in-app browser captures, with browser-only crop, natural macOS cursor styling, deliberate click choreography…

    226 GitHub starsUsed in 1 repo~1.5k tokens
    Auto-check passed

Works with

Questions about Subgraph Development Guide

What does Subgraph Development Guide do?

Guide to building blockchain data indexes with The Graph — subgraph architecture, schema design, mapping handlers, deployment, and querying. ws. Guide to building blockchain data indexes with The Graph — subgraph architecture, schema design, mapping handlers, deployment, and querying.

When should I use Subgraph Development Guide?

Subgraph Development Guide fits situations like: explaining blockchain indexing; building custom data pipelines.

How do I install Subgraph Development Guide in Claude Code?

Run `npx skills add nirholas/three.ws --skill subgraph-development-guide -a claude-code`. Or copy the skill folder (data/skills/development/subgraph-development-guide in nirholas/three.ws) into .claude/skills/subgraph-development-guide in your project. Claude Code loads it when a task matches its description.

How do I install Subgraph Development Guide in Codex?

Run `npx skills add nirholas/three.ws --skill subgraph-development-guide -a codex`. Or copy the skill folder (data/skills/development/subgraph-development-guide in nirholas/three.ws) into .agents/skills/subgraph-development-guide in your project. Codex loads it when a task matches its description.

Can I use Subgraph Development Guide 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 nirholas/three.ws --skill subgraph-development-guide -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/subgraph-development-guide, .gemini/skills/subgraph-development-guide, .github/skills/subgraph-development-guide and .opencode/skills/subgraph-development-guide in your project.

What does Subgraph Development Guide need to run?

Going by SKILL.md and its folder, Subgraph Development Guide needs the command-line tools its instructions call (npm and docker-compose). Our summary lists: Node.js; Docker; A credential in YOUR_DEPLOY_KEY.

Does Subgraph Development Guide access the network?

SKILL.md names 3 domains. As links in the text: thegraph.com, github.com and arbiscan.io. This is read from the text; nothing was executed.

Is Subgraph Development Guide 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 Subgraph Development Guide use?

Subgraph Development Guide 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 Subgraph Development Guide use?

About 2.1k tokens (SKILL.md is roughly 8.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Subgraph Development Guide?

Skills that share tags, products or a category with Subgraph Development Guide: API Architect (curiositech/some_claude_skills, 243 stars), Railway API (majiayu000/claude-skill-registry, 666 stars), Ar Io Gateway Operator (ar-io/ar-io-node, 127 stars) and Data Client Schema (reactive/data-client, 2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Subgraph Development Guide?

nirholas (a GitHub user) maintains it in nirholas/three.ws, which has 226 GitHub stars. The repository holds 165 skills in this directory. The repository was last updated on October 7, 2026.

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