|
| 1 | +--- |
| 2 | +title: Agent Skills for Subgraphs |
| 3 | +sidebarTitle: Subgraph Skills |
| 4 | +--- |
| 5 | + |
| 6 | +A collection of AI agent skills providing expert knowledge for developing, testing, and deploying subgraphs with [The Graph](https://thegraph.com/) protocol. |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +This repository provides subgraph development expertise for AI coding assistants in **two formats**: |
| 11 | + |
| 12 | +| Format | Location | Use With | |
| 13 | +|--------|----------|----------| |
| 14 | +| **Claude Code Plugin** | `skills/` | Claude Code CLI | |
| 15 | +| **OpenClaw Skills** | `openclaw/` | OpenClaw / Clawdbot | |
| 16 | + |
| 17 | +Same knowledge, different agent platforms. |
| 18 | + |
| 19 | +## Skills |
| 20 | + |
| 21 | +### Subgraph Development |
| 22 | + |
| 23 | +Core development knowledge including: |
| 24 | +- Schema design and GraphQL types |
| 25 | +- Manifest configuration (subgraph.yaml) |
| 26 | +- AssemblyScript mapping handlers |
| 27 | +- Data source templates |
| 28 | +- Contract bindings and calls |
| 29 | +- **Subgraph Composition** - Combine multiple subgraphs |
| 30 | +- **Common Patterns** - ERC20, DEX, NFT, Lending, Staking, Governance |
| 31 | +- Subgraph Uncrashable (safe code generation) |
| 32 | +- Deployment workflows |
| 33 | + |
| 34 | +### Subgraph Optimization |
| 35 | + |
| 36 | +Performance best practices from The Graph docs: |
| 37 | +- Pruning with indexerHints |
| 38 | +- Arrays with @derivedFrom |
| 39 | +- Immutable entities and Bytes as IDs |
| 40 | +- Avoiding eth_calls |
| 41 | +- Timeseries and aggregations |
| 42 | +- Grafting for hotfixes |
| 43 | + |
| 44 | +### Subgraph Testing |
| 45 | + |
| 46 | +Quality assurance with Matchstick and Subgraph Linter: |
| 47 | +- **Subgraph Linter** - Static analysis to catch bugs before runtime |
| 48 | +- **Common Errors** - Troubleshooting guide for indexing issues |
| 49 | +- Unit testing setup and patterns with Matchstick |
| 50 | +- Mock events and contract calls |
| 51 | +- Entity assertions |
| 52 | +- Data source mocking |
| 53 | +- CI/CD integration |
| 54 | + |
| 55 | +## Installation |
| 56 | + |
| 57 | +### Claude Code |
| 58 | + |
| 59 | +```bash |
| 60 | +# Add as a Claude Code plugin |
| 61 | +claude plugins add PaulieB14/subgraphs-skills |
| 62 | +``` |
| 63 | + |
| 64 | +### OpenClaw / Clawdbot |
| 65 | + |
| 66 | +```bash |
| 67 | +# Copy skills to OpenClaw directory |
| 68 | +cp -r openclaw/subgraph-* ~/.openclaw/skills/ |
| 69 | + |
| 70 | +# Or via ClawHub (when published) |
| 71 | +clawdbot skill install subgraph-dev |
| 72 | +clawdbot skill install subgraph-optimization |
| 73 | +clawdbot skill install subgraph-testing |
| 74 | +``` |
| 75 | + |
| 76 | +## Usage Examples |
| 77 | + |
| 78 | +Once installed, the AI assistant will have access to subgraph development expertise: |
| 79 | + |
| 80 | +**Schema Design:** |
| 81 | +> "Create a schema for tracking DEX swaps with proper relationships" |
| 82 | +
|
| 83 | +**Optimization:** |
| 84 | +> "How do I optimize my subgraph for faster indexing?" |
| 85 | +
|
| 86 | +**Testing:** |
| 87 | +> "Write unit tests for my Transfer event handler" |
| 88 | +
|
| 89 | +## Resources |
| 90 | + |
| 91 | +- [The Graph Documentation](https://thegraph.com/docs/) |
| 92 | +- [Subgraph Best Practices](https://thegraph.com/docs/en/subgraphs/best-practices/pruning/) |
| 93 | +- [Subgraph Composition](https://thegraph.com/docs/en/subgraphs/guides/subgraph-composition/) - Combine multiple subgraphs |
| 94 | +- [Subgraph Linter](https://thegraph.com/docs/en/subgraphs/developing/subgraph-linter/) - Static analysis tool |
| 95 | +- [Subgraph Uncrashable](https://thegraph.com/docs/en/subgraphs/developing/subgraph-uncrashable/) - Safe code generation |
| 96 | +- [Matchstick Testing Framework](https://thegraph.com/docs/en/subgraphs/developing/creating/unit-testing-framework/) |
| 97 | +- [AssemblyScript API](https://thegraph.com/docs/en/subgraphs/developing/creating/assemblyscript-api/) |
| 98 | + |
| 99 | +## Platforms |
| 100 | + |
| 101 | +This skill pack works with: |
| 102 | + |
| 103 | +| Platform | Description | Link | |
| 104 | +|----------|-------------|------| |
| 105 | +| **Claude Code** | Anthropic's official CLI for Claude | [claude.ai/claude-code](https://claude.ai/claude-code) | |
| 106 | +| **OpenClaw** | Open-source AI agent framework | [github.com/openclaw/openclaw](https://github.com/openclaw/openclaw) | |
| 107 | + |
| 108 | +## Acknowledgments |
| 109 | + |
| 110 | +- Built with [Claude](https://claude.ai) (Anthropic's AI assistant) |
| 111 | +- Subgraph expertise from [The Graph Documentation](https://thegraph.com/docs/) |
| 112 | +- Inspired by [AGENTS.md](https://github.com/agentsmd/agents.md) format |
| 113 | +- OpenClaw format based on [substreams-skills](https://github.com/streamingfast/substreams-skills) |
0 commit comments