[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6QG7177F1APS2Y58W4EDDNM":3,"skill-same:01M6QG7177F1APS2Y58W4EDDNM":104},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":55,"commitSha":56,"skillDirectory":57,"forksCount":14,"repositoryHtmlUrl":58,"repositoryHomepageUrl":59,"ownerHtmlUrl":60,"ownerBlogUrl":61,"ownerDescription":62,"updatedAt":63,"install":64,"resources":77},"01M6QG7177F1APS2Y58W4EDDNM","torch-geometric",null,"PyTorch Geometric (PyG) for graph neural networks — node\u002Flink\u002Fgraph classification, message passing (GCN, GAT, GraphSAGE, GIN), heterogeneous graphs, neighbor sampling, and custom datasets. Use when working with torch_geometric, not for general NetworkX analytics or non-graph PyTorch models.","Tashima-Tarsh\u002FDisha6.6","Tashima-Tarsh","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F269906498?v=4","01M6PBH98X03XERH0HFT4PFB1P","NITISH KUMAR","01M6PBH9DA0M6KM3Z12P848F0K",0,"MIT","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-torch-geometric\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"torch geometric","sampling","graph neural networks","for","org","data-science","cluster","gin","lib","deep","message","analytics","node","networks","data","gnn","graph","pytorch","neural networks","deep learning","2026-11-10 10:12:30",false,"---\nname: torch-geometric\ndescription: PyTorch Geometric (PyG) for graph neural networks — node\u002Flink\u002Fgraph classification, message passing (GCN, GAT, GraphSAGE, GIN), heterogeneous graphs, neighbor sampling, and custom datasets. Use when working with torch_geometric, not for general NetworkX analytics or non-graph PyTorch models.\nlicense: MIT\ncompatibility: Requires Python 3.10+, PyTorch 2.6+, and torch-geometric 2.7.x. Optional extension wheels (pyg-lib, torch-scatter, torch-sparse, torch-cluster) must match your PyTorch\u002FCUDA build from https:\u002F\u002Fdata.pyg.org\u002Fwhl.\nmetadata:\n  version: '1.2'\n  category: data-science-and-ml\n  maintainer: Kalaris Labs\n  tags: graph neural networks, PyTorch Geometric, GNN, deep learning\n---\n\n# PyTorch Geometric (PyG)\n\nPyG is the standard library for Graph Neural Networks built on PyTorch. It provides data structures for graphs, 60+ GNN layer implementations, scalable mini-batch training, and support for heterogeneous graphs.\n\n## Installation\n\nTested against **torch-geometric 2.7.x** (Oct 2025). Requires **Python 3.10+** and **PyTorch 2.6+**.\n\n```bash\n# 1. Install PyTorch first (match your CUDA\u002FCPU setup — see https:\u002F\u002Fpytorch.org\u002Fget-started\u002Flocally\u002F)\nuv pip install torch\n\n# 2. Core PyG (no extension wheels required for basic usage)\nuv pip install torch_geometric\n```\n\nOptional accelerated ops (`pyg-lib`, `torch-scatter`, `torch-sparse`, `torch-cluster`) are **not required** for basic PyG usage (since PyG 2.3). Install version-matched wheels from the [PyG wheel index](https:\u002F\u002Fdata.pyg.org\u002Fwhl) after checking your PyTorch and CUDA versions:\n\n```bash\npython -c \"import torch; print(torch.__version__, torch.version.cuda)\"\n# Then install wheels for your torch+CUDA combo, e.g.:\nuv pip install pyg-lib torch-scatter torch-sparse torch-cluster \\\n  -f https:\u002F\u002Fdata.pyg.org\u002Fwhl\u002Ftorch-2.8.0+cu128.html\n```\n\nCheck your version:\n\n```python\nimport torch_geometric\nprint(torch_geometric.__version__)\n```\n\n**Conda:** the `pyg` conda channel is no longer maintained for PyTorch >2.5 — use `uv pip install` and the wheel index above instead.\n\n### PyG 2.7 notes\n\nPyG 2.7 dropped Python 3.9 and PyTorch ≤2.5. See the [2.7.0 release notes](https:\u002F\u002Fgithub.com\u002Fpyg-team\u002Fpytorch_geometric\u002Freleases\u002Ftag\u002F2.7.0) for PyTorch 2.6–2.8 compatibility tables. `torch_geometric.distributed` is deprecated — use standard `torch.distributed` DDP (see `references\u002Fscaling.md`).\n\n## Core Concepts\n\n### Graph Data: `Data` and `HeteroData`\n\nA graph lives in a `Data` object. The key attributes:\n\n```python\nfrom torch_geometric.data import Data\n\ndata = Data(\n    x=node_features,          # [num_nodes, num_node_features]\n    edge_index=edge_index,     # [2, num_edges] — COO format, dtype=torch.long\n    edge_attr=edge_features,   # [num_edges, num_edge_features]\n    y=labels,                  # node-level [num_nodes, *] or graph-level [1, *]\n    pos=positions,             # [num_nodes, num_dimensions] (for point clouds\u002Fspatial)\n)\n```\n\n**`edge_index` format is critical**: it's a `[2, num_edges]` tensor where `edge_index[0]` = source nodes, `edge_index[1]` = target nodes. It is NOT a list of tuples. If you have edge pairs as rows, transpose and call `.contiguous()`:\n\n```python\n# If edges are [[src1, dst1], [src2, dst2], ...] — transpose first:\nedge_index = edge_pairs.t().contiguous()\n```\n\nFor undirected graphs, include both directions: edge (0,1) needs both `[0,1]` and `[1,0]` in edge_index.\n\nFor heterogeneous graphs, use `HeteroData` — see the Heterogeneous Graphs section below.\n\n### Datasets\n\nPyG bundles many standard datasets that auto-download and preprocess:\n\n```python\nfrom torch_geometric.datasets import Planetoid, TUDataset\n\n# Single-graph node classification (Cora, Citeseer, Pubmed)\ndataset = Planetoid(root='.\u002Fdata', name='Cora')\ndata = dataset[0]  # single graph with train\u002Fval\u002Ftest masks\n\n# Multi-graph classification (ENZYMES, MUTAG, IMDB-BINARY, etc.)\ndataset = TUDataset(root='.\u002Fdata', name='ENZYMES')\n# dataset[0], dataset[1], ... are individual graphs\n```\n\nCommon datasets by task:\n- **Node classification**: Planetoid (Cora\u002FCiteseer\u002FPubmed), OGB (ogbn-arxiv, ogbn-products, ogbn-mag)\n- **Graph classification**: TUDataset (MUTAG, ENZYMES, PROTEINS, IMDB-BINARY), OGB (ogbg-molhiv)\n- **Link prediction**: OGB (ogbl-collab, ogbl-citation2)\n- **Molecular**: QM7, QM9, MoleculeNet\n- **Point cloud\u002Fmesh**: ShapeNet, ModelNet10\u002F40, FAUST\n\n### Transforms\n\nTransforms preprocess or augment graph data, analogous to torchvision transforms:\n\n```python\nimport torch_geometric.transforms as T\n\n# Common transforms\nT.NormalizeFeatures()    # Row-normalize node features to sum to 1\nT.ToUndirected()         # Add reverse edges to make graph undirected\nT.AddSelfLoops()         # Add self-loop edges\nT.KNNGraph(k=6)          # Build k-NN graph from point cloud positions\nT.RandomJitter(0.01)     # Random noise augmentation on positions\nT.Compose([...])         # Chain multiple transforms\n\n# Apply as pre_transform (once, saved to disk) or transform (every access)\ndataset = ShapeNet(root='.\u002Fdata', pre_transform=T.KNNGraph(k=6),\n                   transform=T.RandomJitter(0.01))\n```\n\n## Building GNN Models\n\n### Quick Start: Using Built-in Layers\n\nThe fastest way to build a GNN — stack conv layers from `torch_geometric.nn`:\n\n```python\nimport torch\nimport torch.nn.functional as F\nfrom torch_geometric.nn import GCNConv\n\nclass GCN(torch.nn.Module):\n    def __init__(self, in_channels, hidden_channels, out_channels):\n        super().__init__()\n        self.conv1 = GCNConv(in_channels, hidden_channels)\n        self.conv2 = GCNConv(hidden_channels, out_channels)\n\n    def forward(self, x, edge_index):\n        x = self.conv1(x, edge_index).relu()\n        x = F.dropout(x, p=0.5, training=self.training)\n        x = self.conv2(x, edge_index)\n        return x\n```\n\n**Important**: PyG conv layers do NOT include activation functions — apply them yourself after each layer. This is by design for flexibility.\n\n### Choosing a Conv Layer\n\nPick based on your task and graph structure:\n\n| Layer | Best for | Key idea |\n|-------|----------|----------|\n| `GCNConv` | Homogeneous, semi-supervised node classification | Spectral-inspired, degree-normalized aggregation |\n| `GATConv` \u002F `GATv2Conv` | When neighbor importance varies | Attention-weighted messages |\n| `SAGEConv` | Large graphs, inductive settings | Sampling-friendly, learnable aggregation |\n| `GINConv` | Graph classification, maximizing expressiveness | As powerful as WL test |\n| `TransformerConv` | Rich edge features, complex interactions | Multi-head attention with edge features |\n| `EdgeConv` | Point clouds, dynamic graphs | MLP on edge features (x_i, x_j - x_i) |\n| `RGCNConv` | Heterogeneous with many relation types | Relation-specific weight matrices |\n| `HGTConv` | Heterogeneous graphs | Type-specific attention |\n\nAll conv layers accept `(x, edge_index)` at minimum. Many also accept `edge_attr` for edge features.\n\n### Lazy Initialization\n\nUse `-1` for input channels to let PyG infer dimensions automatically — especially useful for heterogeneous models:\n\n```python\nconv = SAGEConv((-1, -1), 64)  # Input dims inferred on first forward pass\n# Initialize lazy modules:\nwith torch.no_grad():\n    out = model(data.x, data.edge_index)\n```\n\n### High-Level Model APIs\n\nFor common architectures, PyG provides ready-made model classes:\n\n```python\nfrom torch_geometric.nn import GraphSAGE, GCN, GAT, GIN\n\nmodel = GraphSAGE(\n    in_channels=dataset.num_features,\n    hidden_channels=64,\n    out_channels=dataset.num_classes,\n    num_layers=2,\n)\n```\n\n### Custom Layers via MessagePassing\n\nTo implement a novel GNN layer, subclass `MessagePassing`. The framework is:\n\n1. `propagate()` orchestrates the message passing\n2. `message()` defines what info flows along each edge (the phi function)\n3. `aggregate()` combines messages at each node (sum\u002Fmean\u002Fmax)\n4. `update()` transforms the aggregated result (the gamma function)\n\n```python\nfrom torch_geometric.nn import MessagePassing\nfrom torch_geometric.utils import add_self_loops, degree\n\nclass MyConv(MessagePassing):\n    def __init__(self, in_channels, out_channels):\n        super().__init__(aggr='add')  # \"add\", \"mean\", or \"max\"\n        self.lin = torch.nn.Linear(in_channels, out_channels)\n\n    def forward(self, x, edge_index):\n        # Pre-processing before message passing\n        x = self.lin(x)\n        # Start message passing\n        return self.propagate(edge_index, x=x)\n\n    def message(self, x_j):\n        # x_j: features of source nodes for each edge [num_edges, features]\n        # The _j suffix auto-indexes source nodes, _i indexes target nodes\n        return x_j\n```\n\n**The `_i` \u002F `_j` convention**: any tensor passed to `propagate()` can be auto-indexed by appending `_i` (target\u002Fcentral node) or `_j` (source\u002Fneighbor node) in the `message()` signature. So if you pass `x=...` to propagate, you can access `x_i` and `x_j` in message().\n\nRead `references\u002Fmessage_passing.md` for the full GCN and EdgeConv implementation examples.\n\n## Task-Specific Patterns\n\n### Node Classification\n\n```python\n# Full-batch training on a single graph (e.g., Cora)\nmodel.train()\nfor epoch in range(200):\n    optimizer.zero_grad()\n    out = model(data.x, data.edge_index)\n    loss = F.cross_entropy(out[data.train_mask], data.y[data.train_mask])\n    loss.backward()\n    optimizer.step()\n\n# Evaluation — train(False) puts the model in inference mode (disables dropout\u002FBN)\nmodel.train(False)\npred = model(data.x, data.edge_index).argmax(dim=1)\nacc = (pred[data.test_mask] == data.y[data.test_mask]).float().mean()\n```\n\n### Graph Classification\n\nMultiple graphs — use `DataLoader` for mini-batching and global pooling to get graph-level representations:\n\n```python\nfrom torch_geometric.loader import DataLoader\nfrom torch_geometric.nn import GCNConv, global_mean_pool\n\nloader = DataLoader(dataset, batch_size=32, shuffle=True)\n\nclass GraphClassifier(torch.nn.Module):\n    def __init__(self, in_ch, hidden_ch, out_ch):\n        super().__init__()\n        self.conv1 = GCNConv(in_ch, hidden_ch)\n        self.conv2 = GCNConv(hidden_ch, hidden_ch)\n        self.lin = torch.nn.Linear(hidden_ch, out_ch)\n\n    def forward(self, x, edge_index, batch):\n        x = self.conv1(x, edge_index).relu()\n        x = self.conv2(x, edge_index).relu()\n        x = global_mean_pool(x, batch)  # [num_graphs_in_batch, hidden_ch]\n        return self.lin(x)\n\n# Training loop\nfor data in loader:\n    out = model(data.x, data.edge_index, data.batch)\n    loss = F.cross_entropy(out, data.y)\n```\n\nPyG's `DataLoader` batches multiple graphs by creating block-diagonal adjacency matrices. The `batch` tensor maps each node to its graph index. Pooling ops (`global_mean_pool`, `global_max_pool`, `global_add_pool`) use this to aggregate per-graph.\n\n### Link Prediction\n\nSplit edges into train\u002Fval\u002Ftest, use negative sampling:\n\n```python\nfrom torch_geometric.transforms import RandomLinkSplit\n\ntransform = RandomLinkSplit(\n    num_val=0.1,\n    num_test=0.1,\n    is_undirected=True,\n    add_negative_train_samples=False,\n)\ntrain_data, val_data, test_data = transform(data)\n\n# Encode nodes, then score edges\nz = model.encode(train_data.x, train_data.edge_index)\n# Positive edges\npos_score = (z[train_data.edge_label_index[0]] * z[train_data.edge_label_index[1]]).sum(dim=1)\n```\n\nRead `references\u002Flink_prediction.md` for the complete link prediction guide: GAE\u002FVGAE autoencoders, full training loops, LinkNeighborLoader for large graphs, heterogeneous link prediction, and evaluation metrics.\n\n## Scaling to Large Graphs\n\nFor graphs that don't fit in GPU memory, use neighbor sampling via `NeighborLoader`:\n\n```python\nfrom torch_geometric.loader import NeighborLoader\n\ntrain_loader = NeighborLoader(\n    data,\n    num_neighbors=[15, 10],     # Sample 15 neighbors in hop 1, 10 in hop 2\n    batch_size=128,              # Number of seed nodes per batch\n    input_nodes=data.train_mask, # Which nodes to sample from\n    shuffle=True,\n)\n\nfor batch in train_loader:\n    batch = batch.to(device)\n    out = model(batch.x, batch.edge_index)\n    # Only use first batch_size nodes for loss (these are the seed nodes)\n    loss = F.cross_entropy(out[:batch.batch_size], batch.y[:batch.batch_size])\n```\n\n**Key points about NeighborLoader**:\n- `num_neighbors` list length should match GNN depth (number of message passing layers)\n- Seed nodes are always the first `batch.batch_size` nodes in the output\n- `batch.n_id` maps relabeled indices back to original node IDs\n- Works for both `Data` and `HeteroData`\n- For link prediction, use `LinkNeighborLoader` instead\n- Sampling more than 2-3 hops is generally infeasible (exponential blowup)\n\nOther scalability options: `ClusterLoader` (ClusterGCN), `GraphSAINTSampler`, `ShaDowKHopSampler`. For multi-GPU training, DDP, PyTorch Lightning integration, and `torch.compile` support, read `references\u002Fscaling.md`.\n\n## Heterogeneous Graphs\n\nFor graphs with multiple node and edge types (social networks, knowledge graphs, recommendation):\n\n```python\nfrom torch_geometric.data import HeteroData\n\ndata = HeteroData()\n\n# Node features — indexed by node type string\ndata['user'].x = torch.randn(1000, 64)\ndata['movie'].x = torch.randn(500, 128)\n\n# Edge indices — indexed by (src_type, edge_type, dst_type) triplet\ndata['user', 'rates', 'movie'].edge_index = torch.randint(0, 500, (2, 3000))\ndata['user', 'follows', 'user'].edge_index = torch.randint(0, 1000, (2, 5000))\n\n# Access convenience dicts\ndata.x_dict        # {'user': tensor, 'movie': tensor}\ndata.edge_index_dict  # {('user','rates','movie'): tensor, ...}\ndata.metadata()    # ([node_types], [edge_types])\n```\n\n### Three ways to build heterogeneous GNNs\n\n**1. Auto-convert with `to_hetero()`** — write a homogeneous model, convert automatically:\n\n```python\nfrom torch_geometric.nn import SAGEConv, to_hetero\n\nclass GNN(torch.nn.Module):\n    def __init__(self, hidden_channels, out_channels):\n        super().__init__()\n        self.conv1 = SAGEConv((-1, -1), hidden_channels)\n        self.conv2 = SAGEConv((-1, -1), out_channels)\n\n    def forward(self, x, edge_index):\n        x = self.conv1(x, edge_index).relu()\n        x = self.conv2(x, edge_index)\n        return x\n\nmodel = GNN(64, dataset.num_classes)\nmodel = to_hetero(model, data.metadata(), aggr='sum')\n\n# Now accepts dicts:\nout = model(data.x_dict, data.edge_index_dict)\n```\n\nUse `(-1, -1)` for bipartite input channels (source, target may differ). Lazy init handles the rest.\n\n**2. `HeteroConv` wrapper** — different conv per edge type:\n\n```python\nfrom torch_geometric.nn import HeteroConv, GCNConv, SAGEConv, GATConv\n\nconv = HeteroConv({\n    ('paper', 'cites', 'paper'): GCNConv(-1, 64),\n    ('author', 'writes', 'paper'): SAGEConv((-1, -1), 64),\n    ('paper', 'rev_writes', 'author'): GATConv((-1, -1), 64, add_self_loops=False),\n}, aggr='sum')\n```\n\n**3. Native heterogeneous operators** like `HGTConv`:\n\n```python\nfrom torch_geometric.nn import HGTConv\nconv = HGTConv(hidden_channels, hidden_channels, data.metadata(), num_heads=4)\n```\n\n**Important for heterogeneous graphs**:\n- Use `T.ToUndirected()` to add reverse edge types for bidirectional message flow\n- Disable `add_self_loops` in bipartite conv layers (different source\u002Fdest types) — use skip connections instead: `conv(x, edge_index) + lin(x)`\n- For NeighborLoader on HeteroData, specify `input_nodes` as `('node_type', mask)` tuple\n- `num_neighbors` can be a dict keyed by edge type for fine-grained control\n\nRead `references\u002Fheterogeneous.md` for complete examples including training loops and NeighborLoader usage with heterogeneous graphs.\n\n## Custom Datasets\n\nFor loading your own data into PyG:\n\n- **Quick (no class needed)**: Create `Data` objects directly and pass a list to `DataLoader`\n- **Reusable (fits in RAM)**: Subclass `InMemoryDataset` — override `raw_file_names`, `processed_file_names`, `download()`, `process()`\n- **Large (disk-backed)**: Subclass `Dataset` — also override `len()` and `get()`\n- **From CSV**: Load node\u002Fedge tables with pandas, build mappings to consecutive indices, assemble into `Data` or `HeteroData`\n- **From NetworkX**: `from_networkx(G)` converts a NetworkX graph directly\n- **From scipy sparse**: `from_scipy_sparse_matrix(adj)` extracts edge_index\n\nRead `references\u002Fcustom_datasets.md` for complete examples with all patterns, CSV loading with encoders, and the MovieLens walkthrough.\n\n## Explainability\n\nPyG provides `torch_geometric.explain` for interpreting GNN predictions:\n\n```python\nfrom torch_geometric.explain import Explainer, GNNExplainer\n\nexplainer = Explainer(\n    model=model,\n    algorithm=GNNExplainer(epochs=200),\n    explanation_type='model',\n    node_mask_type='attributes',\n    edge_mask_type='object',\n    model_config=dict(\n        mode='multiclass_classification',\n        task_level='node',\n        return_type='log_probs',\n    ),\n)\n\nexplanation = explainer(data.x, data.edge_index, index=10)\nexplanation.visualize_graph()           # Important subgraph\nexplanation.visualize_feature_importance(top_k=10)  # Feature importance\n```\n\nAvailable algorithms: `GNNExplainer` (optimization-based), `PGExplainer` (parametric, trained), `CaptumExplainer` (gradient-based via Captum), `AttentionExplainer` (attention weights). Works for both homogeneous and heterogeneous graphs.\n\nRead `references\u002Fexplainability.md` for all algorithms, heterogeneous explanations, evaluation metrics, and PGExplainer training.\n\n## Common Pitfalls\n\n1. **edge_index shape**: Must be `[2, num_edges]`, not `[num_edges, 2]`. Transpose if needed.\n2. **Forgetting activations**: Conv layers don't include ReLU\u002Fetc — add them manually.\n3. **Self-loops in hetero bipartite**: Don't use `add_self_loops=True` when source and dest node types differ. Use skip connections instead.\n4. **NeighborLoader slicing**: Only the first `batch.batch_size` nodes are your seed nodes. Slice predictions and labels accordingly.\n5. **Undirected graphs**: If your graph is undirected, include edges in both directions in `edge_index`, or use `T.ToUndirected()`.\n6. **Lazy init**: Models with `-1` input channels need one forward pass with `torch.no_grad()` before training to initialize parameters.\n7. **Global pooling for graph tasks**: Use `global_mean_pool(x, batch)` (not manual reshape) to aggregate node features to graph-level.\n8. **num_neighbors alignment**: Keep `len(num_neighbors)` equal to the number of GNN layers. More hops than layers wastes compute; fewer means wasted model capacity.\n\n## Agent operating procedure\n\n1. **Check the environment.** Confirm the Python environment and library versions (`python -c \"import pkg; print(pkg.__version__)\"`) and inspect the data's shape, types and missing values.\n2. **Pin down the inputs.** Confirm formats, identifiers and parameters from the data or the user. Ask rather than guess any value that changes the result.\n3. **Run a small version first.** Run on a sample or a single fold first and check runtime and memory.\n4. **Execute the full task** using the instructions and references above.\n5. **Validate the result.** Use held-out data, fixed random seeds and appropriate metrics; check for leakage; report uncertainty (CIs, std over seeds).\n6. **Report.** State what was run (versions, commands, parameters), what was checked, and what is still uncertain.\n\n| If this happens | Do this |\n|---|---|\n| Out-of-memory or very slow execution | Subsample, use chunked or lazy computation, or reduce model size, and tell the user what changed. |\n| A function, flag or endpoint in these instructions is missing in the installed version | Check the installed version's own documentation (`help()`, `--help`, official docs), adapt, and tell the user. Never invent an API. |\n| A required input, identifier or parameter is ambiguous | Ask the user, or state the assumption explicitly before running. |\n\n**Integrity rules**\n\n- Never fabricate results, parameters, identifiers, citations or statistics. If something cannot be run or verified, say so plainly.\n- Never report a metric you did not compute in this session; show the code path that produced every number.\n- Treat version-specific details here as possibly outdated: confirm them against the official documentation for the installed version.\n- Ask before actions that cost money, consume shared GPUs or cloud quota, touch personal or patient data, or cannot be undone.\n\n## Related skills\n\n- `networkx`: Create, analyze, and visualize complex networks and graphs in Python with NetworkX.\n- `torchdrug`: Build and troubleshoot TorchDrug 0.2.1 workflows for molecular graphs, property prediction, self-supervised pretraining, molecule generatio…\n","# PyTorch Geometric (PyG)\n\nPyG is the standard library for Graph Neural Networks built on PyTorch. It provides data structures for graphs, 60+ GNN layer implementations, scalable mini-batch training, and support for heterogeneous graphs.\n\n## Installation\n\nTested against **torch-geometric 2.7.x** (Oct 2025). Requires **Python 3.10+** and **PyTorch 2.6+**.\n\n```bash\n# 1. Install PyTorch first (match your CUDA\u002FCPU setup — see https:\u002F\u002Fpytorch.org\u002Fget-started\u002Flocally\u002F)\nuv pip install torch\n\n# 2. Core PyG (no extension wheels required for basic usage)\nuv pip install torch_geometric\n```\n\nOptional accelerated ops (`pyg-lib`, `torch-scatter`, `torch-sparse`, `torch-cluster`) are **not required** for basic PyG usage (since PyG 2.3). Install version-matched wheels from the [PyG wheel index](https:\u002F\u002Fdata.pyg.org\u002Fwhl) after checking your PyTorch and CUDA versions:\n\n```bash\npython -c \"import torch; print(torch.__version__, torch.version.cuda)\"\n# Then install wheels for your torch+CUDA combo, e.g.:\nuv pip install pyg-lib torch-scatter torch-sparse torch-cluster \\\n  -f https:\u002F\u002Fdata.pyg.org\u002Fwhl\u002Ftorch-2.8.0+cu128.html\n```\n\nCheck your version:\n\n```python\nimport torch_geometric\nprint(torch_geometric.__version__)\n```\n\n**Conda:** the `pyg` conda channel is no longer maintained for PyTorch >2.5 — use `uv pip install` and the wheel index above instead.\n\n### PyG 2.7 notes\n\nPyG 2.7 dropped Python 3.9 and PyTorch ≤2.5. See the [2.7.0 release notes](https:\u002F\u002Fgithub.com\u002Fpyg-team\u002Fpytorch_geometric\u002Freleases\u002Ftag\u002F2.7.0) for PyTorch 2.6–2.8 compatibility tables. `torch_geometric.distributed` is deprecated — use standard `torch.distributed` DDP (see `references\u002Fscaling.md`).\n\n## Core Concepts\n\n### Graph Data: `Data` and `HeteroData`\n\nA graph lives in a `Data` object. The key attributes:\n\n```python\nfrom torch_geometric.data import Data\n\ndata = Data(\n    x=node_features,          # [num_nodes, num_node_features]\n    edge_index=edge_index,     # [2, num_edges] — COO format, dtype=torch.long\n    edge_attr=edge_features,   # [num_edges, num_edge_features]\n    y=labels,                  # node-level [num_nodes, *] or graph-level [1, *]\n    pos=positions,             # [num_nodes, num_dimensions] (for point clouds\u002Fspatial)\n)\n```\n\n**`edge_index` format is critical**: it's a `[2, num_edges]` tensor where `edge_index[0]` = source nodes, `edge_index[1]` = target nodes. It is NOT a list of tuples. If you have edge pairs as rows, transpose and call `.contiguous()`:\n\n```python\n# If edges are [[src1, dst1], [src2, dst2], ...] — transpose first:\nedge_index = edge_pairs.t().contiguous()\n```\n\nFor undirected graphs, include both directions: edge (0,1) needs both `[0,1]` and `[1,0]` in edge_index.\n\nFor heterogeneous graphs, use `HeteroData` — see the Heterogeneous Graphs section below.\n\n### Datasets\n\nPyG bundles many standard datasets that auto-download and preprocess:\n\n```python\nfrom torch_geometric.datasets import Planetoid, TUDataset\n\n# Single-graph node classification (Cora, Citeseer, Pubmed)\ndataset = Planetoid(root='.\u002Fdata', name='Cora')\ndata = dataset[0]  # single graph with train\u002Fval\u002Ftest masks\n\n# Multi-graph classification (ENZYMES, MUTAG, IMDB-BINARY, etc.)\ndataset = TUDataset(root='.\u002Fdata', name='ENZYMES')\n# dataset[0], dataset[1], ... are individual graphs\n```\n\nCommon datasets by task:\n- **Node classification**: Planetoid (Cora\u002FCiteseer\u002FPubmed), OGB (ogbn-arxiv, ogbn-products, ogbn-mag)\n- **Graph classification**: TUDataset (MUTAG, ENZYMES, PROTEINS, IMDB-BINARY), OGB (ogbg-molhiv)\n- **Link prediction**: OGB (ogbl-collab, ogbl-citation2)\n- **Molecular**: QM7, QM9, MoleculeNet\n- **Point cloud\u002Fmesh**: ShapeNet, ModelNet10\u002F40, FAUST\n\n### Transforms\n\nTransforms preprocess or augment graph data, analogous to torchvision transforms:\n\n```python\nimport torch_geometric.transforms as T\n\n# Common transforms\nT.NormalizeFeatures()    # Row-normalize node features to sum to 1\nT.ToUndirected()         # Add reverse edges to make graph undirected\nT.AddSelfLoops()         # Add self-loop edges\nT.KNNGraph(k=6)          # Build k-NN graph from point cloud positions\nT.RandomJitter(0.01)     # Random noise augmentation on positions\nT.Compose([...])         # Chain multiple transforms\n\n# Apply as pre_transform (once, saved to disk) or transform (every access)\ndataset = ShapeNet(root='.\u002Fdata', pre_transform=T.KNNGraph(k=6),\n                   transform=T.RandomJitter(0.01))\n```\n\n## Building GNN Models\n\n### Quick Start: Using Built-in Layers\n\nThe fastest way to build a GNN — stack conv layers from `torch_geometric.nn`:\n\n```python\nimport torch\nimport torch.nn.functional as F\nfrom torch_geometric.nn import GCNConv\n\nclass GCN(torch.nn.Module):\n    def __init__(self, in_channels, hidden_channels, out_channels):\n        super().__init__()\n        self.conv1 = GCNConv(in_channels, hidden_channels)\n        self.conv2 = GCNConv(hidden_channels, out_channels)\n\n    def forward(self, x, edge_index):\n        x = self.conv1(x, edge_index).relu()\n        x = F.dropout(x, p=0.5, training=self.training)\n        x = self.conv2(x, edge_index)\n        return x\n```\n\n**Important**: PyG conv layers do NOT include activation functions — apply them yourself after each layer. This is by design for flexibility.\n\n### Choosing a Conv Layer\n\nPick based on your task and graph structure:\n\n| Layer | Best for | Key idea |\n|-------|----------|----------|\n| `GCNConv` | Homogeneous, semi-supervised node classification | Spectral-inspired, degree-normalized aggregation |\n| `GATConv` \u002F `GATv2Conv` | When neighbor importance varies | Attention-weighted messages |\n| `SAGEConv` | Large graphs, inductive settings | Sampling-friendly, learnable aggregation |\n| `GINConv` | Graph classification, maximizing expressiveness | As powerful as WL test |\n| `TransformerConv` | Rich edge features, complex interactions | Multi-head attention with edge features |\n| `EdgeConv` | Point clouds, dynamic graphs | MLP on edge features (x_i, x_j - x_i) |\n| `RGCNConv` | Heterogeneous with many relation types | Relation-specific weight matrices |\n| `HGTConv` | Heterogeneous graphs | Type-specific attention |\n\nAll conv layers accept `(x, edge_index)` at minimum. Many also accept `edge_attr` for edge features.\n\n### Lazy Initialization\n\nUse `-1` for input channels to let PyG infer dimensions automatically — especially useful for heterogeneous models:\n\n```python\nconv = SAGEConv((-1, -1), 64)  # Input dims inferred on first forward pass\n# Initialize lazy modules:\nwith torch.no_grad():\n    out = model(data.x, data.edge_index)\n```\n\n### High-Level Model APIs\n\nFor common architectures, PyG provides ready-made model classes:\n\n```python\nfrom torch_geometric.nn import GraphSAGE, GCN, GAT, GIN\n\nmodel = GraphSAGE(\n    in_channels=dataset.num_features,\n    hidden_channels=64,\n    out_channels=dataset.num_classes,\n    num_layers=2,\n)\n```\n\n### Custom Layers via MessagePassing\n\nTo implement a novel GNN layer, subclass `MessagePassing`. The framework is:\n\n1. `propagate()` orchestrates the message passing\n2. `message()` defines what info flows along each edge (the phi function)\n3. `aggregate()` combines messages at each node (sum\u002Fmean\u002Fmax)\n4. `update()` transforms the aggregated result (the gamma function)\n\n```python\nfrom torch_geometric.nn import MessagePassing\nfrom torch_geometric.utils import add_self_loops, degree\n\nclass MyConv(MessagePassing):\n    def __init__(self, in_channels, out_channels):\n        super().__init__(aggr='add')  # \"add\", \"mean\", or \"max\"\n        self.lin = torch.nn.Linear(in_channels, out_channels)\n\n    def forward(self, x, edge_index):\n        # Pre-processing before message passing\n        x = self.lin(x)\n        # Start message passing\n        return self.propagate(edge_index, x=x)\n\n    def message(self, x_j):\n        # x_j: features of source nodes for each edge [num_edges, features]\n        # The _j suffix auto-indexes source nodes, _i indexes target nodes\n        return x_j\n```\n\n**The `_i` \u002F `_j` convention**: any tensor passed to `propagate()` can be auto-indexed by appending `_i` (target\u002Fcentral node) or `_j` (source\u002Fneighbor node) in the `message()` signature. So if you pass `x=...` to propagate, you can access `x_i` and `x_j` in message().\n\nRead `references\u002Fmessage_passing.md` for the full GCN and EdgeConv implementation examples.\n\n## Task-Specific Patterns\n\n### Node Classification\n\n```python\n# Full-batch training on a single graph (e.g., Cora)\nmodel.train()\nfor epoch in range(200):\n    optimizer.zero_grad()\n    out = model(data.x, data.edge_index)\n    loss = F.cross_entropy(out[data.train_mask], data.y[data.train_mask])\n    loss.backward()\n    optimizer.step()\n\n# Evaluation — train(False) puts the model in inference mode (disables dropout\u002FBN)\nmodel.train(False)\npred = model(data.x, data.edge_index).argmax(dim=1)\nacc = (pred[data.test_mask] == data.y[data.test_mask]).float().mean()\n```\n\n### Graph Classification\n\nMultiple graphs — use `DataLoader` for mini-batching and global pooling to get graph-level representations:\n\n```python\nfrom torch_geometric.loader import DataLoader\nfrom torch_geometric.nn import GCNConv, global_mean_pool\n\nloader = DataLoader(dataset, batch_size=32, shuffle=True)\n\nclass GraphClassifier(torch.nn.Module):\n    def __init__(self, in_ch, hidden_ch, out_ch):\n        super().__init__()\n        self.conv1 = GCNConv(in_ch, hidden_ch)\n        self.conv2 = GCNConv(hidden_ch, hidden_ch)\n        self.lin = torch.nn.Linear(hidden_ch, out_ch)\n\n    def forward(self, x, edge_index, batch):\n        x = self.conv1(x, edge_index).relu()\n        x = self.conv2(x, edge_index).relu()\n        x = global_mean_pool(x, batch)  # [num_graphs_in_batch, hidden_ch]\n        return self.lin(x)\n\n# Training loop\nfor data in loader:\n    out = model(data.x, data.edge_index, data.batch)\n    loss = F.cross_entropy(out, data.y)\n```\n\nPyG's `DataLoader` batches multiple graphs by creating block-diagonal adjacency matrices. The `batch` tensor maps each node to its graph index. Pooling ops (`global_mean_pool`, `global_max_pool`, `global_add_pool`) use this to aggregate per-graph.\n\n### Link Prediction\n\nSplit edges into train\u002Fval\u002Ftest, use negative sampling:\n\n```python\nfrom torch_geometric.transforms import RandomLinkSplit\n\ntransform = RandomLinkSplit(\n    num_val=0.1,\n    num_test=0.1,\n    is_undirected=True,\n    add_negative_train_samples=False,\n)\ntrain_data, val_data, test_data = transform(data)\n\n# Encode nodes, then score edges\nz = model.encode(train_data.x, train_data.edge_index)\n# Positive edges\npos_score = (z[train_data.edge_label_index[0]] * z[train_data.edge_label_index[1]]).sum(dim=1)\n```\n\nRead `references\u002Flink_prediction.md` for the complete link prediction guide: GAE\u002FVGAE autoencoders, full training loops, LinkNeighborLoader for large graphs, heterogeneous link prediction, and evaluation metrics.\n\n## Scaling to Large Graphs\n\nFor graphs that don't fit in GPU memory, use neighbor sampling via `NeighborLoader`:\n\n```python\nfrom torch_geometric.loader import NeighborLoader\n\ntrain_loader = NeighborLoader(\n    data,\n    num_neighbors=[15, 10],     # Sample 15 neighbors in hop 1, 10 in hop 2\n    batch_size=128,              # Number of seed nodes per batch\n    input_nodes=data.train_mask, # Which nodes to sample from\n    shuffle=True,\n)\n\nfor batch in train_loader:\n    batch = batch.to(device)\n    out = model(batch.x, batch.edge_index)\n    # Only use first batch_size nodes for loss (these are the seed nodes)\n    loss = F.cross_entropy(out[:batch.batch_size], batch.y[:batch.batch_size])\n```\n\n**Key points about NeighborLoader**:\n- `num_neighbors` list length should match GNN depth (number of message passing layers)\n- Seed nodes are always the first `batch.batch_size` nodes in the output\n- `batch.n_id` maps relabeled indices back to original node IDs\n- Works for both `Data` and `HeteroData`\n- For link prediction, use `LinkNeighborLoader` instead\n- Sampling more than 2-3 hops is generally infeasible (exponential blowup)\n\nOther scalability options: `ClusterLoader` (ClusterGCN), `GraphSAINTSampler`, `ShaDowKHopSampler`. For multi-GPU training, DDP, PyTorch Lightning integration, and `torch.compile` support, read `references\u002Fscaling.md`.\n\n## Heterogeneous Graphs\n\nFor graphs with multiple node and edge types (social networks, knowledge graphs, recommendation):\n\n```python\nfrom torch_geometric.data import HeteroData\n\ndata = HeteroData()\n\n# Node features — indexed by node type string\ndata['user'].x = torch.randn(1000, 64)\ndata['movie'].x = torch.randn(500, 128)\n\n# Edge indices — indexed by (src_type, edge_type, dst_type) triplet\ndata['user', 'rates', 'movie'].edge_index = torch.randint(0, 500, (2, 3000))\ndata['user', 'follows', 'user'].edge_index = torch.randint(0, 1000, (2, 5000))\n\n# Access convenience dicts\ndata.x_dict        # {'user': tensor, 'movie': tensor}\ndata.edge_index_dict  # {('user','rates','movie'): tensor, ...}\ndata.metadata()    # ([node_types], [edge_types])\n```\n\n### Three ways to build heterogeneous GNNs\n\n**1. Auto-convert with `to_hetero()`** — write a homogeneous model, convert automatically:\n\n```python\nfrom torch_geometric.nn import SAGEConv, to_hetero\n\nclass GNN(torch.nn.Module):\n    def __init__(self, hidden_channels, out_channels):\n        super().__init__()\n        self.conv1 = SAGEConv((-1, -1), hidden_channels)\n        self.conv2 = SAGEConv((-1, -1), out_channels)\n\n    def forward(self, x, edge_index):\n        x = self.conv1(x, edge_index).relu()\n        x = self.conv2(x, edge_index)\n        return x\n\nmodel = GNN(64, dataset.num_classes)\nmodel = to_hetero(model, data.metadata(), aggr='sum')\n\n# Now accepts dicts:\nout = model(data.x_dict, data.edge_index_dict)\n```\n\nUse `(-1, -1)` for bipartite input channels (source, target may differ). Lazy init handles the rest.\n\n**2. `HeteroConv` wrapper** — different conv per edge type:\n\n```python\nfrom torch_geometric.nn import HeteroConv, GCNConv, SAGEConv, GATConv\n\nconv = HeteroConv({\n    ('paper', 'cites', 'paper'): GCNConv(-1, 64),\n    ('author', 'writes', 'paper'): SAGEConv((-1, -1), 64),\n    ('paper', 'rev_writes', 'author'): GATConv((-1, -1), 64, add_self_loops=False),\n}, aggr='sum')\n```\n\n**3. Native heterogeneous operators** like `HGTConv`:\n\n```python\nfrom torch_geometric.nn import HGTConv\nconv = HGTConv(hidden_channels, hidden_channels, data.metadata(), num_heads=4)\n```\n\n**Important for heterogeneous graphs**:\n- Use `T.ToUndirected()` to add reverse edge types for bidirectional message flow\n- Disable `add_self_loops` in bipartite conv layers (different source\u002Fdest types) — use skip connections instead: `conv(x, edge_index) + lin(x)`\n- For NeighborLoader on HeteroData, specify `input_nodes` as `('node_type', mask)` tuple\n- `num_neighbors` can be a dict keyed by edge type for fine-grained control\n\nRead `references\u002Fheterogeneous.md` for complete examples including training loops and NeighborLoader usage with heterogeneous graphs.\n\n## Custom Datasets\n\nFor loading your own data into PyG:\n\n- **Quick (no class needed)**: Create `Data` objects directly and pass a list to `DataLoader`\n- **Reusable (fits in RAM)**: Subclass `InMemoryDataset` — override `raw_file_names`, `processed_file_names`, `download()`, `process()`\n- **Large (disk-backed)**: Subclass `Dataset` — also override `len()` and `get()`\n- **From CSV**: Load node\u002Fedge tables with pandas, build mappings to consecutive indices, assemble into `Data` or `HeteroData`\n- **From NetworkX**: `from_networkx(G)` converts a NetworkX graph directly\n- **From scipy sparse**: `from_scipy_sparse_matrix(adj)` extracts edge_index\n\nRead `references\u002Fcustom_datasets.md` for complete examples with all patterns, CSV loading with encoders, and the MovieLens walkthrough.\n\n## Explainability\n\nPyG provides `torch_geometric.explain` for interpreting GNN predictions:\n\n```python\nfrom torch_geometric.explain import Explainer, GNNExplainer\n\nexplainer = Explainer(\n    model=model,\n    algorithm=GNNExplainer(epochs=200),\n    explanation_type='model',\n    node_mask_type='attributes',\n    edge_mask_type='object',\n    model_config=dict(\n        mode='multiclass_classification',\n        task_level='node',\n        return_type='log_probs',\n    ),\n)\n\nexplanation = explainer(data.x, data.edge_index, index=10)\nexplanation.visualize_graph()           # Important subgraph\nexplanation.visualize_feature_importance(top_k=10)  # Feature importance\n```\n\nAvailable algorithms: `GNNExplainer` (optimization-based), `PGExplainer` (parametric, trained), `CaptumExplainer` (gradient-based via Captum), `AttentionExplainer` (attention weights). Works for both homogeneous and heterogeneous graphs.\n\nRead `references\u002Fexplainability.md` for all algorithms, heterogeneous explanations, evaluation metrics, and PGExplainer training.\n\n## Common Pitfalls\n\n1. **edge_index shape**: Must be `[2, num_edges]`, not `[num_edges, 2]`. Transpose if needed.\n2. **Forgetting activations**: Conv layers don't include ReLU\u002Fetc — add them manually.\n3. **Self-loops in hetero bipartite**: Don't use `add_self_loops=True` when source and dest node types differ. Use skip connections instead.\n4. **NeighborLoader slicing**: Only the first `batch.batch_size` nodes are your seed nodes. Slice predictions and labels accordingly.\n5. **Undirected graphs**: If your graph is undirected, include edges in both directions in `edge_index`, or use `T.ToUndirected()`.\n6. **Lazy init**: Models with `-1` input channels need one forward pass with `torch.no_grad()` before training to initialize parameters.\n7. **Global pooling for graph tasks**: Use `global_mean_pool(x, batch)` (not manual reshape) to aggregate node features to graph-level.\n8. **num_neighbors alignment**: Keep `len(num_neighbors)` equal to the number of GNN layers. More hops than layers wastes compute; fewer means wasted model capacity.\n\n## Agent operating procedure\n\n1. **Check the environment.** Confirm the Python environment and library versions (`python -c \"import pkg; print(pkg.__version__)\"`) and inspect the data's shape, types and missing values.\n2. **Pin down the inputs.** Confirm formats, identifiers and parameters from the data or the user. Ask rather than guess any value that changes the result.\n3. **Run a small version first.** Run on a sample or a single fold first and check runtime and memory.\n4. **Execute the full task** using the instructions and references above.\n5. **Validate the result.** Use held-out data, fixed random seeds and appropriate metrics; check for leakage; report uncertainty (CIs, std over seeds).\n6. **Report.** State what was run (versions, commands, parameters), what was checked, and what is still uncertain.\n\n| If this happens | Do this |\n|---|---|\n| Out-of-memory or very slow execution | Subsample, use chunked or lazy computation, or reduce model size, and tell the user what changed. |\n| A function, flag or endpoint in these instructions is missing in the installed version | Check the installed version's own documentation (`help()`, `--help`, official docs), adapt, and tell the user. Never invent an API. |\n| A required input, identifier or parameter is ambiguous | Ask the user, or state the assumption explicitly before running. |\n\n**Integrity rules**\n\n- Never fabricate results, parameters, identifiers, citations or statistics. If something cannot be run or verified, say so plainly.\n- Never report a metric you did not compute in this session; show the code path that produced every number.\n- Treat version-specific details here as possibly outdated: confirm them against the official documentation for the installed version.\n- Ask before actions that cost money, consume shared GPUs or cloud quota, touch personal or patient data, or cannot be undone.\n\n## Related skills\n\n- `networkx`: Create, analyze, and visualize complex networks and graphs in Python with NetworkX.\n- `torchdrug`: Build and troubleshoot TorchDrug 0.2.1 workflows for molecular graphs, property prediction, self-supervised pretraining, molecule generatio…\n",{"name":5,"license":15,"metadata":49,"description":7,"compatibility":54},{"tags":50,"version":51,"category":52,"maintainer":53},"graph neural networks, PyTorch Geometric, GNN, deep learning","1.2","data-science-and-ml","Kalaris Labs","Requires Python 3.10+, PyTorch 2.6+, and torch-geometric 2.7.x. Optional extension wheels (pyg-lib, torch-scatter, torch-sparse, torch-cluster) must match your PyTorch\u002FCUDA build from https:\u002F\u002Fdata.pyg.org\u002Fwhl.","main","0da4485785ee599388900be50db1635489d53056",".agents\u002Fskills\u002Fkal-torch-geometric","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6","https:\u002F\u002Fdisha6.6.thenitishkr.in\u002F","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh","www.thenitishkr","thenitishkr | AI • Cyber-security • Research\r\n","2026-11-08 03:33:25",{"source":8,"skillName":5,"commands":65,"prompt":75,"zipAvailable":76},[66,69,72],{"tool":67,"command":68},"npx","npx skills add Tashima-Tarsh\u002FDisha6.6 --skill torch-geometric",{"tool":70,"command":71},"bunx","bunx skills add Tashima-Tarsh\u002FDisha6.6 --skill torch-geometric",{"tool":73,"command":74},"pnpm","pnpm dlx skills add Tashima-Tarsh\u002FDisha6.6 --skill torch-geometric","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-torch-geometric\u002FSKILL.md",true,[78,84,88,92,96,100],{"path":79,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fcustom_datasets.md","REFERENCE","参考文档",7277,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-torch-geometric\u002Freferences\u002Fcustom_datasets.md",{"path":85,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Fexplainability.md",6420,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-torch-geometric\u002Freferences\u002Fexplainability.md",{"path":89,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":90,"sourceHtmlUrl":91},"references\u002Fheterogeneous.md",7935,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-torch-geometric\u002Freferences\u002Fheterogeneous.md",{"path":93,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":94,"sourceHtmlUrl":95},"references\u002Flink_prediction.md",8386,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-torch-geometric\u002Freferences\u002Flink_prediction.md",{"path":97,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":98,"sourceHtmlUrl":99},"references\u002Fmessage_passing.md",4266,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-torch-geometric\u002Freferences\u002Fmessage_passing.md",{"path":101,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":102,"sourceHtmlUrl":103},"references\u002Fscaling.md",8688,"https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fkal-torch-geometric\u002Freferences\u002Fscaling.md",[105,135,160,187,212,236],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":116,"publishedAt":44},"01M6QRD07D4TGNDK6VJ4EHF8BV","youtube-full","Use when the user needs YouTube transcripts, video search, channel browsing, playlist extraction, or content monitoring. Trigger phrases: 'get the transcript for', 'search YouTube for', 'what are the latest videos on', 'list this playlist', 'monitor this channel', or any request involving a YouTube URL, video ID, or @handle. Do NOT use for downloading video or audio files, YouTube engagement data (likes, comments), or private\u002Fage-restricted videos.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fyoutube-full\u002FSKILL.md",[111],{"categoryNo":112,"categoryName":113,"taxonomyType":114,"taxonomyTypeDesc":115},"01JBSEEDCAT000000000000016","图像与多媒体","SCENARIO","使用场景",[117,118,119,120,121,122,38,123,124,125,126,127,128,129,130,131,27,132,133,134],"youtube full","youtube","full","transcript","search","monitoring","Video","Audio","list","files","do","get","age","trigger","URL","browsing","request","youtube transcripts",{"skillNo":136,"name":137,"nameZh":6,"description":138,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":141,"publishedAt":44},"01M6QRCJ3112VYPA97YG7KGMC2","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fx-twitter-growth\u002FSKILL.md",[],[142,143,144,145,121,146,147,148,149,150,151,152,153,154,155,156,157,158,159,27],"twitter","x twitter growth","growth","research","content","engineering","plan","web search","competitors","analyze","engine","write","strategy","use","platform","grow","posting","competitive",{"skillNo":161,"name":162,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":169,"publishedAt":44},"01M6QRBN3EHQNJY42RERP7A149","write-a-skill","Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, build, or author a new skill.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwrite-a-skill\u002FSKILL.md",[166],{"categoryNo":167,"categoryName":168,"taxonomyType":114,"taxonomyTypeDesc":115},"01JBSEEDCAT000000000000023","Skill与智能体开发",[170,153,171,172,173,174,175,176,155,177,178,55,179,180,181,182,183,184,185,186],"write a skill","github","create","https","productivity","matt pocock","direct","example","build","new skill","structure","new agent","resources","with","tree","progressive disclosure","author",{"skillNo":188,"name":189,"nameZh":6,"description":190,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":191,"categories":192,"keywords":193,"publishedAt":44},"01M6QRB6G8P33PNGAF9Y69EJ9T","wrap-up","Close out a launched Claude Managed Agent — recap every primitive the founder now owns, regenerate the single-file overview page, and suggest the next 1-2 upgrades. Use when the user says \"wrap up\", \"close this out\", \"what do I own now\", \"give me the summary\", \"recap the agent\", or when the orchestrator routes phase=wrap-up. primitives_inventory.py tables everything owned (agent, environment, session, memory, outcome, deployment); overview_page.py regenerates a self-contained .\u002Fmy-agent\u002Fagent-overview.html; upgrade_suggester.py ranks the next moves from recorded deferrals plus standing hardening steps. Companion to run-without-you; the last stop before phase=done.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwrap-up\u002FSKILL.md",[],[194,195,196,197,198,199,200,201,202,155,203,127,204,205,206,207,208,209,210,211],"wrap up","up","wrap","gemini","deployment","run","file","hardening","closeout","stop","upgrade","founder","close","companion","you","tables","directions","phase",{"skillNo":213,"name":214,"nameZh":6,"description":215,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":216,"categories":217,"keywords":219,"publishedAt":44},"01M6QRA5AYC1RBFZ39GTWGS3N8","workflow-builder","Design and write deterministic multi-agent workflow scripts (.js files in .claude\u002Fworkflows\u002F) for Claude Code's Workflow tool. Use when a user wants to build, create, author, scaffold, or run a custom Claude Code workflow, orchestrate sub-agents (fan-out, pipeline, loop, judge-panel), or automate a repeatable multi-step task across fresh-context agents.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fworkflow-builder\u002FSKILL.md",[218],{"categoryNo":167,"categoryName":168,"taxonomyType":114,"taxonomyTypeDesc":115},[220,221,222,223,224,172,199,225,226,227,228,229,153,230,126,231,232,233,234,235],"workflow","workflow builder","builder","design","workflows","code","orchestrate","pipeline","loop","multi-agent","context","across","fresh","scripts","judge","claude code workflow",{"skillNo":237,"name":238,"nameZh":6,"description":239,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":240,"categories":241,"keywords":242,"publishedAt":44},"01M6QR7QMCZESKQA0ERW1E657M","weekly-review","Use when someone wants to run a weekly review, close open loops, audit stalled projects and commitments, get their system back to trusted, restart a lapsed review habit, or says \"\u002Fcs:weekly-review\". Walks David Allen's three-phase loop — GET CLEAR, GET CURRENT, GET CREATIVE — with deterministic scripts that inventory open loops, gate the checklist with named gaps, and score commitment health 0-100.","https:\u002F\u002Fgithub.com\u002FTashima-Tarsh\u002FDisha6.6\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fweekly-review\u002FSKILL.md",[],[243,244,245,246,247,248,249,250,251,228,252,253,254,255,256,257,128,258,259,211],"review","weekly review","weekly","deterministic scripts","reflect","feeds","inventory","open","team","projects","project-management","scanner","conversation","back","project","sprint","cadence"]