torch-scan: Skill for Claude Code

.agents/skills/torchscan/SKILL.md

torchscan is a skill for Claude Code, Codex from frgfm/torch-scan. It costs 56 tokens per session (1,296 once invoked), scanned A, original, Apache-2.0.

A tool for inspecting PyTorch models and measuring their operators, computation, and peak memory use. PyTorch is a Python framework for building and running machine-learning models.

In plain words
What is it for?
Use it to inspect model structure, count parameters, measure FLOPs and memory for a workload, compare model versions, and find unsupported operations.
Why use it?
It provides reports and comparisons while showing when measurements are incomplete or unavailable, so results are not mistaken for exact totals.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

This is frgfm/torch-scan's own configuration. It tells Claude Code and Codex how to work on torch-scan itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything torch-scan configures →

Reuse

Borrowing it

Nothing to install: this file belongs to frgfm/torch-scan. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/frgfm/torch-scan/main/.agents/skills/torchscan/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/frgfm/torch-scan

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for torchscan

README.md
[![agentmods](https://agentmods.dev/badge/skills/frgfm/torch-scan/torchscan/github.svg)](https://agentmods.dev/skills/frgfm/torch-scan/torchscan)
Your own site
<a href="https://agentmods.dev/skills/frgfm/torch-scan/torchscan"><img src="https://agentmods.dev/badge/skills/frgfm/torch-scan/torchscan/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for torchscan

Your own site · 80×15
<a href="https://agentmods.dev/skills/frgfm/torch-scan/torchscan"><img src="https://agentmods.dev/badge/skills/frgfm/torch-scan/torchscan.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,296 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00056 $0.01296
Opus 5.5 $0.00022 $0.00518
Sonnet 5.5 $0.00011 $0.00259
Haiku 4.5 $0.00006 $0.00130

Measured 4d ago against content hash aedeffa279df, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

torchscan scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/torchscan/SKILL.md · 80 lines

How it starts

The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TorchScan

Use the smallest API that answers the request:

  • crawl_module(...): JSON-serializable module report.
  • summary(...): printed table plus the same report.
  • mode="structure" on either API: hierarchy, shapes, calls, parameters, and buffers with less overhead.
  • measure_workload(workload, device=..., work_units=...): selected FLOPs, latency/throughput, and PyTorch memory in a BenchmarkReport with a terminal summary. Optional profile=True; RSS needs an explicit rss_command. Unreleased; install main. Passes share caller state; use a repeatable workload.
  • measure_flops(workload): operator FLOPs for one zero-argument workload call.
  • measure_peak_memory(workload, device=...): backend-specific PyTorch peak memory.
  • measure_peak_rss(command): Linux/macOS child-process lifetime RSS, including loading and imports.
  • profile_workload(workload, device=...): one instrumented operator diagnostic pass; not clean latency.
  • measure_latency(workload, device=..., inputs=...): first-call time, warmed block-average timing, and explicit work-unit throughput. Unreleased; install main. The callable is invoked repeatedly and owns its state.
  • compare_reports(before, after): pure same-schema comparison.
  • compare_benchmarks(before, after, check=...): compatible workload comparison with an owner-supplied output check.
  • python -m torchscan.autoresearch workload.json --output RUN: start with the owner's model reference, args/kwargs descriptors or saved inputs with batch size one, and inference workload. Collect latency/throughput, scoped PyTorch peak memory and clean child-process RSS without writing an experiment script. Add --candidate-model module:factory for automatic reference checks and repeated keep/discard/inconclusive evaluation. Unreleased; install the development version.
  • render_report(report): offline model HTML/SVG or benchmark/comparison HTML, without remeasurement.

Workflow

  1. Reuse the project's model and representative inputs. Do not download weights without permission.
  2. Prefer args and kwargs for real calls; use input_shape only for simple synthetic tensors.
  3. Use strict=True when incomplete module metrics must stop automation.
  4. Serialize the report directly. Never parse the summary table.
  5. Check every metric's status and preserve diagnostics.
  6. Ask the owner for thresholds. TorchScan measures; it does not decide whether a model fits.

Read the full file on GitHub · 80 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago Changed · +15 lines aedeffa279df
  2. 20d ago Changed 8877ce445dcf
  3. 27d ago Changed · +3 lines b8e945adced0
  4. 1mo ago Changed · +10 lines f0c07f5868c1
  5. 1mo ago Changed · +2 lines e1d1c7304225
  6. 1mo ago Changed · +2 lines e582fc7e8a66
  7. 2mo ago First seen · 48 lines · 56 tokens per session scan A bfbfdb6b2916

Subscribe to this mod's changes

torchscan is a skill published in the GitHub repository frgfm/torch-scan (221 stars, last pushed yesterday), licensed Apache-2.0. It adds 56 tokens to every session and 1,296 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

torchscan compared with skills from other repositories

torchscan next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
torchscanfrgfm/torch-scanSkill221yesterdayApache-2.0A56Claude Code, Codex
physicsnemo-shard-tensorNVIDIA/physicsnemoSkill3.4kyesterdayApache-2.0A152Claude Code, Codex
physicsnemo-discoverNVIDIA/physicsnemoSkill3.4kyesterdayApache-2.0A124Claude Code, Codex
trlbenchflow-ai/skillsbenchSkill1.9k2d agoApache-2.0A100Claude Code, Codex
deep-learningericrisco/rsc-harnessSkill5032d agoMITA102Claude Code, Codex
perforatedaiPerforatedAI/PerforatedAISkill240yesterdayApache-2.0A133Claude Code, Codex
single-cell-multi-omics-analysis-scviPharMolix/OpenBioMedSkill1.1k3mo agoMITA94Claude Code, Codex