---
title: Agent Skills for Subgraphs
sidebarTitle: Subgraph Skills
---

A collection of AI agent skills providing expert knowledge for developing, testing, and deploying subgraphs with The Graph protocol.

## Overview

This repository provides subgraph development expertise for AI coding assistants in **two formats**:

| Format                 | Location    | Use With            |
| ---------------------- | ----------- | ------------------- |
| **Claude Code Plugin** | `skills/`   | Claude Code CLI     |
| **OpenClaw Skills**    | `openclaw/` | OpenClaw / Clawdbot |

Same knowledge, different agent platforms.

## Skills

### Subgraph Development

Core development knowledge including:

- Schema design and GraphQL types
- Manifest configuration (subgraph.yaml)
- AssemblyScript mapping handlers
- Data source templates
- Contract bindings and calls
- **Subgraph Composition** - Combine multiple subgraphs
- **Common Patterns** - ERC20, DEX, NFT, Lending, Staking, Governance
- Subgraph Uncrashable (safe code generation)
- Deployment workflows

### Subgraph Optimization

Performance best practices from The Graph docs:

- Pruning with indexerHints
- Arrays with `@derivedFrom`
- Immutable entities and Bytes as IDs
- Avoiding `eth_calls`
- Timeseries and aggregations
- Grafting for hotfixes

### Subgraph Testing

Quality assurance with Matchstick and Subgraph Linter:

- **Subgraph Linter** - Static analysis to catch bugs before runtime
- **Common Errors** - Troubleshooting guide for indexing issues
- Unit testing setup and patterns with Matchstick
- Mock events and contract calls
- Entity assertions
- Data source mocking
- CI/CD integration

## Installation

### Claude Code

```bash
# Add as a Claude Code plugin
claude plugins add PaulieB14/subgraphs-skills
```

### OpenClaw / Clawdbot

```bash
# Copy skills to OpenClaw directory
cp -r openclaw/subgraph-* ~/.openclaw/skills/

# Or via ClawHub (when published)
clawdbot skill install subgraph-dev
clawdbot skill install subgraph-optimization
clawdbot skill install subgraph-testing
```

## Usage Examples

Once installed, the AI assistant will have access to subgraph development expertise:

**Schema Design:**

> "Create a schema for tracking DEX swaps with proper relationships"

**Optimization:**

> "How do I optimize my subgraph for faster indexing?"

**Testing:**

> "Write unit tests for my Transfer event handler"

## Resources

- [Subgraph Best Practices](/subgraphs/best-practices/pruning/)
- [Subgraph Composition](/subgraphs/guides/subgraph-composition/) - Combine multiple subgraphs
- [Subgraph Linter](/subgraphs/developing/subgraph-linter/) - Static analysis tool
- [Subgraph Uncrashable](/subgraphs/developing/subgraph-uncrashable/) - Safe code generation
- [Matchstick Testing Framework](/subgraphs/tooling/unit-testing-framework/)
- [AssemblyScript API](/subgraphs/developing/creating/assemblyscript-api/)

## Platforms

This skill pack works with:

| Platform | Description | Link |
| --- | --- | --- |
| **Claude Code** | Anthropic's official CLI for Claude | [claude.ai/claude-code](https://claude.ai/claude-code) |
| **OpenClaw** | Open-source AI agent framework | [github.com/openclaw/openclaw](https://github.com/openclaw/openclaw) |

## Acknowledgments

- Built with [Claude](https://claude.ai) (Anthropic's AI assistant)
- Subgraph expertise from [The Graph Documentation](https://thegraph.com/docs/)
- Inspired by [AGENTS.md](https://github.com/agentsmd/agents.md) format
- OpenClaw format based on [substreams-skills](https://github.com/streamingfast/substreams-skills)
