Guide · Agent skill
How to use the PyTorch Geometric Graph Models agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The torch-geometric skill gives an AI coding agent working knowledge of PyTorch Geometric (PyG), the library for graph neural networks. It is for people who build node, link or graph classification models in PyTorch and want the agent to structure graph data correctly and pick suitable layers. After this guide you will know what the skill changes, how to install it, how to ask for help in natural language, and what to check before trusting the output.
Quick start
- 1Download and unzip the skill. Download the skill ZIP from this page and unzip it so the skill folder contains SKILL.md.
- 2Place it in the skills folder. Move the folder into ~/.claude/skills/ for personal use or into .claude/skills/ inside a project.
- 3Or upload it in the Claude apps. Go to Settings → Capabilities → Skills and upload the skill there.
- 4Install PyTorch and torch-geometric. Install a PyTorch build for your platform, then torch-geometric 2.8.0.post1, and run the version check command.
- 5Ask for a graph task. Describe your graph, your target (node, link or graph level) and your dataset in a plain request that mentions PyTorch Geometric.
- 6Verify the output. Run the generated code on a small example, call data.validate, and confirm the dataset split before trusting results.
What an agent skill is and what this one does
An agent skill is a folder of instructions and reference files that an AI agent loads when a task matches the skill's description. This one is packaged from the K-Dense-AI scientific-agent-skills repository and is licensed under MIT.
Once installed, the agent knows how to represent graphs as Data and HeteroData objects, choose built-in layers such as GCNConv, GATConv and SAGEConv, load standard datasets like Cora and TUDataset, and handle heterogeneous graphs, neighbor sampling and custom datasets. The skill's guidance covers message passing, link prediction, explainability and scaling in separate reference files.
- It is triggered by work involving torch_geometric.
- It does not cover general NetworkX analytics or ordinary PyTorch models without graphs.
Install the skill (ZIP download or Claude apps)
Download the skill ZIP from this page and unzip it. For a personal install, place the unzipped skill folder inside ~/.claude/skills/. For a single project, place it inside that project's .claude/skills/ folder.
In the Claude apps, you can instead upload the skill under Settings → Capabilities → Skills.
- Personal: ~/.claude/skills/
- Project: .claude/skills/ inside your project folder
- Claude apps: Settings → Capabilities → Skills
Install the PyTorch Geometric libraries the skill expects
The skill's requirements are Python 3.10+, PyTorch 2.9+ and torch-geometric 2.8.0.post1. Install the PyTorch build for your platform from the official PyTorch local install page first, then install torch-geometric. Basic tensor-based layers need no extra packages.
Neighbor sampling requires pyg-lib or torch-sparse. Optional pyg-lib, torch-scatter and torch-sparse wheels must match your Python, OS, PyTorch and CUDA or CPU build. The skill warns against installing wheels for a different Torch release just because core imports work.
- Network access is needed for installation and dataset downloads.
- Check the installed version with the verification command below before using newer APIs.
- torch-cluster and torch-spline-conv are deprecated and ignored by the skill.
uv pip install torch==2.14.1
uv pip install torch-geometric==2.8.0.post1
python -c "import torch, torch_geometric; print(torch.__version__, torch.version.cuda, torch_geometric.__version__)"Trigger the skill with natural requests
You do not need special syntax. Mention graphs or PyG in your request and the agent can match it to the skill. Name the task, the data and the layer if you know them. Good prompts state what your nodes and edges represent, what you want to predict and which dataset you use.
Name torch_geometric or PyTorch Geometric explicitly when you want the skill to apply, since the skill description says it is for torch_geometric work and not for general network statistics.
- "Build a GCN node classifier on Cora with PyTorch Geometric."
- "Convert my edge list CSV into a torch_geometric Data object with a correct edge_index."
- "Set up a HeteroData graph with papers, authors and an writes relation."
- "Use neighbor sampling with SAGEConv for a large graph in torch_geometric."
Examples of what the agent produces
For a node classification task, the skill guides the agent to load Planetoid, define a two-layer GCN using GCNConv and apply dropout between layers. The agent should also keep edge_index as a [2, num_edges] tensor, not a list of tuples, and make undirected edges appear in both directions.
For graph classification on TUDataset, expect guidance toward GINConv and graph-level batching. Check what the agent writes against the dataset's official split and preprocessing before reporting results.
Safety notes: scripts and network access
The skill is marked as running scripts and as using the network. Installation and dataset downloads need network access, and dataset classes download provider data automatically. Review any script the agent proposes before running it, and only load trusted serialized artifacts, since the custom dataset reference warns against loading untrusted files.
Do not replace official benchmark splits, such as OGB splits, with random ones, and do not make directed or temporal relations undirected without a scientific reason.
- Read generated code before running it on real data.
- Use only trusted .pt files for custom datasets.
- Run the skill's validation check, including an edge-free or isolated-node case, after building a graph.
Tips for better results
Give the agent exact dimensions and the meaning of each node and edge. Ask it to call data.validate(raise_on_error=True) after construction. For production training on large datasets, verify installed versions and extension wheels first, because some backend combinations were not tested.
- Set data.num_nodes explicitly when node features are absent.
- Keep the dataset version and split fixed when comparing results.
- Confirm the installed torch_geometric version before adopting new APIs.
What people use it for
- Training a GCN or GAT node classifier on Cora or Citeseer.
- Graph classification on TUDataset collections such as ENZYMES or MUTAG.
- Building a HeteroData graph with several node and edge types.
- Setting up neighbor sampling with SAGEConv for a large graph.
- Loading your own graph data as a custom InMemoryDataset.
Frequently asked questions
Is the torch-geometric skill free?
The skill is released under the MIT license, as stated on this page. PyTorch Geometric itself is a separate library you install with pip-style tools, and the skill does not state any price.
What do I need before installing this skill?
The skill expects Python 3.10+, PyTorch 2.9+ and torch-geometric 2.8.0.post1. Optional pyg-lib, torch-scatter and torch-sparse wheels must match your Python, OS, PyTorch and CUDA or CPU build. Network access is needed for installation and dataset downloads.
Where do I put the skill folder?
Place it in ~/.claude/skills/ for personal use or in a project's .claude/skills/ folder. In the Claude apps you can upload it under Settings → Capabilities → Skills instead.
Does this skill work for NetworkX or ordinary PyTorch models?
No. The skill description says it is not for general NetworkX analytics or non-graph PyTorch models. Use it for graph neural networks built with torch_geometric.
Why does my graph fail or batch incorrectly?
A common cause is edge_index in the wrong format or missing isolated nodes. The skill says edge_index must be a [2, num_edges] long tensor, and that num_nodes should be set explicitly when node features are absent. Calling data.validate(raise_on_error=True) helps locate the problem.
Can I use it instead of a different GNN library?
The skill only covers PyTorch Geometric. The source does not compare it with other libraries, so check their documentation yourself before choosing.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
This skill suits machine learning engineers, researchers and students who build graph neural networks in PyTorch with torch_geometric and want an agent that follows the library's conventions. It is a poor fit for general network analysis with NetworkX, for models that do not use graph data, or for production training that has not first been checked against your exact installed versions and extension wheels.
Download the skill