Skip to content

Commit 93fe2b1

Browse files
Adding Subgraph and Substreams Skills
1 parent e3262d1 commit 93fe2b1

8 files changed

Lines changed: 220 additions & 2 deletions

File tree

website/next.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ export default withNextra({
147147
destination: '/en/',
148148
permanent: true,
149149
},
150+
{
151+
source: '/en/ai-suite/token-api-skills/quick-setup',
152+
destination: '/en/ai-suite/token-api-skills/setup',
153+
permanent: true,
154+
},
150155
// If we ever change `output` to not be `export`, we should move all the redirects from `nginx.conf` here
151156
],
152157
images: {

website/src/pages/en/ai-suite/_meta-titles.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
"ai-introduction": "The Graph's AI",
33
"subgraph-mcp": "Subgraph MCP",
44
"token-api-mcp": "Token API MCP",
5-
"token-api-skills": "Token API Skills"
5+
"subgraph-skills": "Subgraph Skills",
6+
"token-api-skills": "Token API Skills",
7+
"substreams-skills": "Substreams Skills"
68
}

website/src/pages/en/ai-suite/_meta.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ export default {
44
'ai-introduction': titles['ai-introduction'],
55
'subgraph-mcp': titles['subgraph-mcp'],
66
'token-api-mcp': titles['token-api-mcp'],
7+
'subgraph-skills': titles['subgraph-skills'],
78
'token-api-skills': titles['token-api-skills'],
9+
'substreams-skills': titles['substreams-skills'],
810
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
setup: ''
3+
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
setup: ''
3+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: Agent Skills for Substreams
3+
sidebarTitle: Substreams Skills
4+
---
5+
6+
AI coding assistants can be enhanced with specialized Substreams expertise through agent skills. These open-source knowledge packages give AI assistants deep understanding of Substreams development patterns, best practices, and debugging techniques.
7+
8+
## Available Skills
9+
10+
### Substreams Development (`substreams-dev`)
11+
12+
Expert knowledge for developing, building, and debugging Substreams projects on any blockchain:
13+
14+
- Creating and configuring `substreams.yaml` manifests
15+
- Writing efficient Rust modules (map, store, index types)
16+
- Protobuf schema design and code generation
17+
- Performance optimization and avoiding excessive cloning
18+
- Debugging and troubleshooting common issues
19+
20+
### Substreams SQL (`substreams-sql`)
21+
22+
Expert knowledge for building SQL database sinks from Substreams data:
23+
24+
- **Database Changes (CDC)** - Stream individual row changes for real-time consistency
25+
- **Relational Mappings** - Transform data into normalized tables with proper relationships
26+
- **PostgreSQL** - Advanced patterns, indexing strategies, and performance optimization
27+
- **ClickHouse** - Analytics-optimized schemas, materialized views, and time-series patterns
28+
- **Schema Design** - Best practices for blockchain data modeling
29+
30+
### Substreams Testing (`substreams-testing`)
31+
32+
Expert knowledge for testing Substreams applications at all levels:
33+
34+
- **Unit Testing** - Testing individual functions with real blockchain data
35+
- **Integration Testing** - End-to-end workflows with real block processing
36+
- **Performance Testing** - Benchmarking, memory profiling, and production mode validation
37+
- **FireCore Tools** - Using Firehose, StreamingFast API, and testing utilities
38+
- **CI/CD Integration** - Automated testing pipelines and regression detection
39+
40+
## Installation
41+
42+
### Claude Code
43+
44+
Install the plugin from the marketplace:
45+
46+
```bash
47+
claude plugin marketplace add https://github.com/streamingfast/substreams-skills
48+
```
49+
50+
Then enable the skills:
51+
52+
1. Run `/plugin` to open the plugin manager
53+
2. Go to the **Discover** tab
54+
3. Find and install the `substreams-dev` plugin (which pulls all defined skills automatically)
55+
4. Restart Claude instance(s) for skills to be discovered
56+
57+
After installation, Claude automatically uses Substreams expertise when working on relevant projects.
58+
59+
**Alternative: Local Development**
60+
61+
Clone and load directly without installing from the marketplace:
62+
63+
```bash
64+
git clone https://github.com/streamingfast/substreams-skills.git
65+
claude --plugin-dir ./substreams-skills
66+
```
67+
68+
### Cursor
69+
70+
Clone the repository and add the skill directory path in Cursor settings:
71+
72+
```
73+
~/substreams-skills/skills/substreams-dev
74+
```
75+
76+
### VS Code
77+
78+
VS Code 1.107+ supports Claude Skills as an experimental feature:
79+
80+
1. Enable the experimental feature in settings
81+
2. Add skill paths to your configuration
82+
3. Skills will be available to Claude in VS Code
83+
84+
See the [VS Code 1.107 release notes](https://code.visualstudio.com/updates/v1_107#_reuse-your-claude-skills-experimental) for details.
85+
86+
## Resources
87+
88+
- [Substreams Skills Repository](https://github.com/streamingfast/substreams-skills)
89+
- [Claude Code Plugins Documentation](https://docs.anthropic.com/en/docs/claude-code/plugins)

website/src/pages/en/ai-suite/token-api-skills/quick-setup.mdx renamed to website/src/pages/en/ai-suite/token-api-skills/setup.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: Quick Setup
2+
title: Agent Skills for Token API
3+
sidebarTitle: Token API Skills
34
---
45

56
## Quick Setup

0 commit comments

Comments
 (0)