torch-geometric
by K-Dense-AItorch-geometric skill guide for PyTorch Geometric graph neural networks. Use it for torch-geometric install help, torch-geometric usage, graph classification, node classification, link prediction, heterogeneous graphs, custom MessagePassing layers, and scaling GNNs for Machine Learning workflows.
This skill scores 84/100, which means it is a solid listing candidate for directory users who work on graph neural networks with PyTorch Geometric. The repository gives enough trigger guidance, workflow coverage, and practical examples that an agent can usually activate and use it with less guesswork than a generic prompt, though users should still expect some environment/setup caveats.
- Very strong triggerability: the frontmatter says to use it for GNNs, node classification, link prediction, heterogeneous graphs, neighbor sampling, imports from torch_geometric, and common GNN layers like GCN/GAT/GraphSAGE/GIN.
- Substantial operational content: the SKILL.md body is large, has valid frontmatter, code fences, and multiple workflow-oriented sections; references cover custom datasets, explainability, heterogeneous graphs, link prediction, message passing, and scaling.
- Good install-decision value: it states the library role clearly, names core APIs like Data, HeteroData, MessagePassing, Explainer, and NeighborLoader, and includes an install command plus optional acceleration packages.
- No install command is included in the skill metadata itself, so users may need to interpret the setup note manually and ensure PyTorch compatibility.
- Evidence is documentation-heavy rather than automation-heavy: there are no scripts or other support files, so execution quality depends on the agent following the written references well.
Overview of torch-geometric skill
What torch-geometric is for
torch-geometric is the PyTorch Geometric skill for building graph neural networks, not a general-purpose deep learning prompt. It is best for users who need torch-geometric install guidance, model selection, or implementation help for graph data tasks such as node classification, link prediction, graph classification, heterogeneous graphs, message passing, and large-graph sampling.
Best fit readers
Use this torch-geometric skill when you are working with relational data and need practical PyG choices: how to represent graphs, which loader or split strategy to use, how to scale training, or how to implement a custom layer. It is a strong fit for Machine Learning users who already have PyTorch code and need graph-specific structure, not theory-only explanation.
What differentiates it
This skill is centered on PyG’s actual workflow: Data and HeteroData, MessagePassing, RandomLinkSplit, NeighborLoader, and explainability tools. The main value is reducing adoption friction around the parts that usually block users: installation dependencies, graph input shape conventions, leakage-safe splits, and sampling choices for large graphs.
How to Use torch-geometric skill
Install torch-geometric correctly
For a basic torch-geometric install, start with the package and then add acceleration only if you need it. The repo guidance is uv add torch_geometric or uv pip install torch_geometric; PyTorch must already be installed. Optional performance packages include pyg-lib, torch-scatter, torch-sparse, and torch-cluster. If you are troubleshooting install failures, confirm your PyTorch version first, then match any binary wheels to your CUDA or CPU environment.
Turn a rough goal into a useful prompt
A weak request like “help me use torch-geometric” leaves too many choices open. A stronger prompt names the task, data shape, and constraints:
- “I have a citation graph with
x,edge_index, and node labels. Show a torch-geometric usage pattern for node classification with train/val/test masks.” - “I need a torch-geometric guide for link prediction on an undirected graph with negative sampling.”
- “I have heterogeneous paper/author/institution data in
HeteroData; help me build a model and dataloader.”
Include whether the graph is single or heterogeneous, whether labels are node-, edge-, or graph-level, and whether the graph fits in memory.
Read the right files first
Start with SKILL.md, then read the references that match your task: references/message_passing.md for custom layers, references/link_prediction.md for edge prediction, references/heterogeneous.md for multi-type graphs, references/custom_datasets.md for ingestion, references/scaling.md for large graphs, and references/explainability.md for interpretation. This order gives you a short path from install to working code without guessing at PyG conventions.
Workflow that produces better output
Use this sequence: identify the graph type, choose the training objective, decide the split strategy, then pick the data loader. For example, node classification on one graph usually needs Data, masks, and possibly NeighborLoader; link prediction usually needs RandomLinkSplit; heterogeneous data usually needs HeteroData and type-aware model code. If you skip those decisions, the output is often valid Python but wrong for your task.
torch-geometric skill FAQ
Is torch-geometric hard to install?
It can be. The base torch_geometric package is straightforward, but optional acceleration libraries may need version matching with PyTorch and your CUDA stack. If you only need to prototype, start with the core package before adding extras.
When should I use torch-geometric instead of a normal prompt?
Use the torch-geometric skill when graph structure matters: neighbors, edges, heterogeneous node types, or message passing. A generic prompt often misses the PyG-specific data model and can suggest code that ignores graph sampling or split leakage.
Is torch-geometric good for beginners?
Yes, if your data is already graph-shaped and you want a guided path from raw edges to a model. It is less beginner-friendly if you do not yet know whether your task is node, edge, or graph prediction, because that choice changes the entire pipeline.
When should I not use it?
Do not reach for torch-geometric if your problem is just tabular ML, plain NLP, or image classification with no graph structure. Also avoid it if you only need a high-level conceptual explanation and no implementation detail.
How to Improve torch-geometric skill
Give the skill the graph facts that matter
The biggest quality jump comes from stating the graph type, feature shapes, and target. For torch-geometric, that means whether you have x, edge_index, edge_attr, masks, multiple node types, or only adjacency data. If you have a heterogeneous graph, name each node and edge type; if you are doing link prediction, say whether the graph is directed or undirected.
State the training constraint up front
If the graph is large, mention memory limits and batch style. A torch-geometric usage answer changes materially depending on whether you need full-batch training, NeighborLoader, or a custom sampling strategy. If you omit this, the first answer may be correct but unusable at scale.
Ask for the exact PyG artifact you need
The torch-geometric guide is most useful when you ask for a concrete output: dataset class, model skeleton, loader setup, train loop, or debugging help. For example: “Write an InMemoryDataset for CSV edges,” “Convert this graph to HeteroData,” or “Refactor my MessagePassing layer to support bipartite inputs.” Specific artifacts reduce hand-waving and make the answer easier to run.
Iterate on the first result
If the first output is close but not ready, improve it by adding one missing constraint at a time: version, device, graph size, label type, or output format. For torch-geometric for Machine Learning, the common failure mode is a correct architecture paired with the wrong split or loader. Iterating on those details usually matters more than changing the model class.
