subgraph-patterns

subgraph-patterns is a skill for Claude Code, Codex from ccashwell/evm-cortex. It costs 48 tokens per session (2,042 once invoked), scanned A, original, MIT.

A pattern guide for building and maintaining The Graph subgraphs, which index blockchain data and expose it through GraphQL queries. It covers manifests, schemas, AssemblyScript event handlers, tests, deployment, and indexing.

In plain words
What is it for?
Use it to design subgraph schemas, configure data sources and templates, write event mappings, test them with Matchstick, deploy subgraphs, and improve indexing.
Why use it?
It gives a consistent structure for turning smart-contract events into queryable data and helps avoid common indexing and deployment mistakes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is file: ./abis/MyProtocol.json.

Good fit Use it to design subgraph schemas, configure data sources and templates, write event mappings, test them with Matchstick, deploy subgraphs, and improve indexing.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/ccashwell/evm-cortex
agentmods
npx agentmods add skills/ccashwell/evm-cortex/subgraph-patterns

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for subgraph-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/ccashwell/evm-cortex/subgraph-patterns/github.svg)](https://agentmods.dev/skills/ccashwell/evm-cortex/subgraph-patterns)
Your own site
<a href="https://agentmods.dev/skills/ccashwell/evm-cortex/subgraph-patterns"><img src="https://agentmods.dev/badge/skills/ccashwell/evm-cortex/subgraph-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for subgraph-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/ccashwell/evm-cortex/subgraph-patterns"><img src="https://agentmods.dev/badge/skills/ccashwell/evm-cortex/subgraph-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,042 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Data Exfiltration · line 257
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00048 $0.02042
Opus 5.5 $0.00019 $0.00817
Sonnet 5.5 $0.00010 $0.00408
Haiku 4.5 $0.00005 $0.00204

Measured 1mo ago against content hash 4ac243bfa39b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

subgraph-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/subgraph-patterns/SKILL.md · 296 lines

How it starts

The opening of the file, as written. The whole thing — 296 lines — stays where its author put it; the contents beside it link to each section on GitHub.

The Graph Subgraph Patterns

Project Structure

my-subgraph/
├── subgraph.yaml           # Manifest: data sources, event handlers
├── schema.graphql           # Entity definitions (GraphQL)
├── src/
│   └── mappings.ts          # Event handler logic (AssemblyScript)
├── tests/
│   └── mappings.test.ts     # Matchstick unit tests
├── abis/
│   └── MyContract.json      # Contract ABIs
└── networks.json            # Multi-network config

Subgraph Manifest (subgraph.yaml)

specVersion: 1.0.0
indexerHints:
  prune: auto
schema:
  file: ./schema.graphql
dataSources:
  - kind: ethereum
    name: MyProtocol
    network: base
    source:
      address: "0xContractAddress"
      abi: MyProtocol
      startBlock: 12345678  # Block contract was deployed
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.9
      language: wasm/assemblyscript
      entities:
        - Deposit
        - Withdrawal
        - User
      abis:
        - name: MyProtocol
          file: ./abis/MyProtocol.json
        - name: ERC20
          file: ./abis/ERC20.json
      eventHandlers:
        - event: Deposit(indexed address,uint256,uint256)
          handler: handleDeposit
        - event: Withdrawal(indexed address,uint256)
          handler: handleWithdrawal
      file: ./src/mappings.ts
templates:
  - kind: ethereum
    name: Vault
    network: base
    source:
      abi: Vault
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.9
      language: wasm/assemblyscript
      entities:
        - VaultDeposit
      abis:
        - name: Vault
          file: ./abis/Vault.json
      eventHandlers:
        - event: VaultDeposit(indexed address,uint256)
          handler: handleVaultDeposit
      file: ./src/vault-mappings.ts

Schema Design (schema.graphql)

type Protocol @entity {
  id: Bytes!                    # Use Bytes! for addresses
  totalDeposited: BigDecimal!
  totalUsers: BigInt!
  vaults: [Vault!]! @derivedFrom(field: "protocol")
}

type User @entity {
  id: Bytes!                    # user address
  deposits: [Deposit!]! @derivedFrom(field: "user")
  totalDeposited: BigDecimal!
  firstDepositAt: BigInt!
  lastActiveAt: BigInt!
}

type Vault @entity {
  id: Bytes!                    # vault address
  protocol: Protocol!
  asset: Bytes!
  totalAssets: BigDecimal!
  deposits: [Deposit!]! @derivedFrom(field: "vault")
  createdAt: BigInt!
  createdAtBlock: BigInt!
}

type Deposit @entity(immutable: true) {
  id: Bytes!                    # tx hash + log index
  user: User!
  vault: Vault!
  amount: BigDecimal!
  shares: BigInt!
  timestamp: BigInt!
  blockNumber: BigInt!
  transactionHash: Bytes!
}

type DailySnapshot @entity {
  id: String!                   # "YYYY-MM-DD"
  date: BigInt!
  totalDeposited: BigDecimal!
  depositCount: BigInt!
  uniqueUsers: BigInt!
}

Read the full file on GitHub · 296 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 296 lines · 48 tokens per session scan A 4ac243bfa39b

Subscribe to this mod's changes

subgraph-patterns is a skill published in the GitHub repository ccashwell/evm-cortex (132 stars, last pushed 2d ago), licensed MIT. It adds 48 tokens to every session and 2,042 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

system-prompts

Write system prompts, tool docs, and agent definitions. Project tag conventions + RFC 2119 keywords + dense compression. Use when authoring or editing any prompt the model reads.

can1357/oh-my-pi · 40 tokens

mantis-threat-model

Synthesizes trust boundaries, attack surfaces, and attacker profiles into a living threat model. Use as Stage B of the Knowledge Base generation process, reading architecture and entity definitions from the KB. Don't use for analyzing source code or extracting raw learnings from JSONL files.

google/mantis · 59 tokens

blockrun

Pay-per-call access to AI models, real-time data, media generation and multi-chain RPC over x402 micropayments (USDC on Base or Solana), or a BlockRun account API key. No subscriptions. Start here when you have the BlockRun MCP installed and need to know WHICH tool answers a question, how the wallet works, or how to…

BlockRunAI/blockrun-mcp · 242 tokens

malloy-define

Propose scope, a source plan and field definitions for a Malloy model. Which tables and questions, which sources at what grain, then renames, dimensions and measures, each backed by querying data.

malloydata/publisher · 46 tokens

giza-zkml-visualization

Giza ZKML Agent Visualization — guide covering key concepts, implementation patterns, and best practices.

nirholas/three.ws · 29 tokens

webiny-api-cms-content-models

Creating Headless CMS content models via code using the ModelFactory pattern. Use this skill when the developer wants to create, modify, or understand content model definitions, define fields and validators, set up reference fields between models, configure field layouts (including nested layouts inside object or…

webiny/webiny-js · 313 tokens