Official agent skill

Benchmark Pyrefly

by facebook in facebook/pyrefly

Run Pyrefly benchmarks locally via Buck or Cargo, including PyTorch real-world LSP benchmarks.

OfficialMITAuto-check passedAI & LLM Engineering

Install Benchmark Pyrefly

skills CLI
$ npx skills add facebook/pyrefly --skill benchmark-pyrefly -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install facebook/pyrefly benchmark-pyrefly --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/facebook/pyrefly.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/benchmark-pyrefly .claude/skills/benchmark-pyrefly && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
benchmark-pyrefly
GitHub stars
7.1k
Token cost
~1.8k tokens
SKILL.md length
772 words
Files
1
Skills in repo
6
Repo updated
First seen
Licence
MIT

At a glance

Run Pyrefly benchmarks locally via Buck or Cargo, including PyTorch real-world LSP benchmarks.

  • User asks to benchmark pyrefly performance
  • SKILL.md covers Micro benchmarks (fast), PyTorch benchmarks (heavy,…, TSP benchmark (fast) and Updating the PyTorch pin
  • Calls cargo
  • Run pyrefly bench

What it does

Benchmark Pyrefly is an agent skill from facebook/pyrefly, published by the product's own GitHub organization. Run Pyrefly benchmarks locally via Buck or Cargo, including PyTorch real-world LSP benchmarks. Use when user asks to benchmark pyrefly performance, run pyrefly bench, compare cold start vs error propagation, or update PyTorch benchmark pin.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Deep learning. It works with PyTorch and Python. The repository describes itself as: A fast type checker and language server for Python. The licence is MIT.

When your agent uses it

  • User asks to benchmark pyrefly performance
  • Run pyrefly bench
  • Compare cold start vs error propagation
  • Update PyTorch benchmark pin

Example prompts

  • “/benchmark-pyrefly”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 6bc6ea9. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • cargo

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Benchmark Pyrefly loads about 1.8k tokens when it runs. Until then it costs about 65 tokens; SKILL.md has 772 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~65
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from facebook/pyrefly at commit 6bc6ea9, republished under its MIT licence (© facebook). 772 words, ~1,809 tokens.

Download SKILL.mdSave it as .claude/skills/benchmark-pyrefly/SKILL.md (or your agent's skills folder).
name
benchmark-pyrefly
description
Run Pyrefly benchmarks locally via Buck or Cargo, including PyTorch real-world LSP benchmarks. Use when user asks to benchmark pyrefly performance, run pyrefly bench, compare cold start vs error propagation, or update PyTorch benchmark pin.

Benchmarking Pyrefly

Use this skill when asked to benchmark pyrefly performance, run a pyrefly bench, compare cold-start vs error-propagation latency, or update the PyTorch benchmark pin. All benches live in pyrefly/pyrefly/benches/ and use Criterion.

Build mode matters: always build optimized, or the numbers are meaningless. Buck uses @fbcode//mode/opt (or @fbcode//mode/opt-clang-thinlto for final numbers). Cargo cargo bench already uses the optimized bench profile; cargo run/cargo build would need --release. Debug builds run 3-10x slower and are not comparable.

Never run two benchmarks in parallel — they compete for CPU and memory and the timings become unreliable.

Micro benchmarks (fast)

Deterministic, single-threaded microbenchmarks of type-checker internals. Cheap to run, good for a quick signal.

  • Buck: buck2 run @fbcode//mode/opt fbcode//pyrefly/pyrefly:micro_bench -- --bench
  • Cargo: cargo bench --bench micro

Source: pyrefly/pyrefly/benches/micro.rs.

PyTorch benchmarks (heavy, walltime)

Three real-world benchmarks run over a pinned, multi-gigabyte PyTorch checkout (15k+ Python files) across all cores. They are walltime benchmarks (threads, I/O, a long cold start), not deterministic unit tests — distinct from the micro benchmarks. Two drive the actual LSP server (cold_start, error_propagation); one runs a cold batch check (full_check).

All three ship in one target — buck pytorch_bench, cargo bench pytorch — and you select an individual one at runtime with a Criterion name filter rather than picking a separate target. They live under pyrefly/pyrefly/benches/pytorch/, one module file per bench:

  • pytorch/main.rs — crate root; declares the modules and calls criterion_main! aggregating the benchmarks' Criterion groups.
  • pytorch/common.rs — shared PyTorch-checkout acquisition harness and standard LSP args.
  • pytorch/cold_start.rs — the cold-start benchmark. Fresh server per iteration; opens torch/distributed/pipelining/_backward.py and queries go-to-definition of the Parameter import. Proxy for time-to-first-index. Criterion id pytorch/cold_start_go_to_definition.
  • pytorch/error_propagation.rs — the error-propagation benchmark. Warm server; edits torch/nn/__init__.py to rebind Parameter to an int and waits for the resulting type error to surface in the distant dependent _backward.py. Proxy for incremental edit-propagation latency. Criterion id pytorch/error_propagation.
  • pytorch/full_check.rs — the full-check benchmark. Fresh State per iteration; runs exactly what pyrefly check (project mode, no file args) does from inside the checkout — discovers the project and checks every project file across all cores. Proxy for whole-project batch throughput (not interactive latency). Criterion id pytorch/full_check.
Time cost

These are slow. A cold-start iteration is ~3-5 s on a 64-thread devvm; error-propagation is ~2-3 s and full-check ~1-1.5 s per iteration. Criterion's sample floor is 10, so budget roughly 2-4 minutes per benchmark. Do not run them in CI Sandcastle by default — they are manual/heavy (the PyTorch http_archive dep is labeled manual).

Run commands

Run all benchmarks:

bash
# Buck (internal)
buck2 run @fbcode//mode/opt fbcode//pyrefly/pyrefly:pytorch_bench -- --bench
# Cargo (OSS)
cargo bench --bench pytorch

Run just one, selecting it by Criterion name filter:

bash
# Buck (internal) — cold start
buck2 run @fbcode//mode/opt fbcode//pyrefly/pyrefly:pytorch_bench -- --bench cold_start
# Buck (internal) — error propagation
buck2 run @fbcode//mode/opt fbcode//pyrefly/pyrefly:pytorch_bench -- --bench error_propagation
# Buck (internal) — full check
buck2 run @fbcode//mode/opt fbcode//pyrefly/pyrefly:pytorch_bench -- --bench full_check
# Cargo (OSS)
cargo bench --bench pytorch -- cold_start
cargo bench --bench pytorch -- error_propagation
cargo bench --bench pytorch -- full_check

Useful flags (append after -- for buck; pass directly for cargo):

  • --list — list the benches in the binary instead of running them, e.g. buck2 run @fbcode//mode/opt fbcode//pyrefly/pyrefly:pytorch_bench -- --list.
  • --quick — quicker, lower-confidence run.
  • --noplot — skip Criterion report rendering. Required on a headless devserver with no gnuplot and no usable font: the plotters backend otherwise panics after a bench finishes with BackendError(FontError(FontUnavailable)). Timings are unaffected. Example: buck2 run @fbcode//mode/opt fbcode//pyrefly/pyrefly:pytorch_bench -- --bench --noplot.
Show full SKILL.md (289 more words)Show less
PyTorch source acquisition

The PyTorch source (~550 MB unpacked, 68 MB tar.gz) is pinned by a single 40-hex commit in pyrefly/pyrefly/benches/pytorch_pin.bzl — there is no git submodule. That file is loaded by BUCK and parsed by the shared common module. Two providers:

  • Internal (buck): fetches the pinned tarball from Manifold via http_archive and passes its path to the benches in PYREFLY_PYTORCH_BENCH_PATH. No github egress; Buck CAS caches it.
  • OSS (cargo): shallow-clones the pinned rev from github into a per-rev temp cache on first run (needs git + github.com egress), reused after.

Set PYREFLY_PYTORCH_BENCH_PATH to an existing checkout to bypass both. If the checkout can't be obtained, the bench prints a skip notice and exits cleanly.

Output location

Criterion writes to target/criterion/ (HTML plots, CSV samples, estimates.json). Because buck run / cargo bench run from the cell root, it lands at the fbsource repo root target/criterion/. It is ephemeral — do not commit it, and do not add repo-root ignore entries (it is already gitignored appropriately).

TSP benchmark (fast)

benches/tsp.rs -- buck tsp_bench, cargo bench tsp, Criterion id tsp/get_computed_type_unopened_cached. Durable regression coverage for the TSP unopened-file solve-reuse fix (D118537886): repeats an identical getComputedType request, on a stable snapshot, against one never-opened, unreferenced module deliberately expensive to solve, over the plain in-process main connection. Server spawn, fixture generation, and the first cold request are unmeasured; each measured iteration is one logical request. Portable, no pinned checkout, no manual label.

bash
buck2 run @fbcode//mode/opt fbcode//pyrefly/pyrefly:tsp_bench -- --bench
cargo bench --bench tsp

Updating the PyTorch pin

Run on a machine with github access (devvm/Sandcastle have no egress):

bash
pyrefly/pyrefly/benches/update_revision.sh <40-hex-sha>

It clones the rev, archives a tarball, rewrites pytorch_pin.bzl (rev + sha256), and uploads the tarball to Manifold.

After a pin bump, re-check PARAM_LINE / PARAM_COL in pytorch/cold_start.rs — they encode the position of Parameter in _backward.py, and the cold-start bench asserts if they drift.

© facebook, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/benchmark-pyrefly of facebook/pyrefly.

Open the folder on GitHubat commit 6bc6ea9

Compare with similar skills

Benchmark Pyrefly next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Benchmark Pyrefly compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Benchmark Pyrefly this skillfacebook/pyrefly7.1k—~1.8kAutomated safety check: PassMIT
Document Public APIspytorch/pytorch104k—~4.2kAutomated safety check: PassCustom licence
ExecuTorch Cortex-M Backendpytorch/executorch5.1k—~872Automated safety check: PassCustom licence
PyTorch Lightning TrainingOrchestra-Research/AI-Research-SKILLs13k7 repos~2.3kAutomated safety check: PassMIT
Ako4allTongmingLAIC/AKO4ALL369—~4kAutomated safety check: PassMIT
Homepage Generatorwanshuiyin/ARIS-in-AI-Offer580—~4.8kAutomated safety check: NotesMIT

Similar skills

  • Document Public APIs

    pytorch/pytorch

    Document undocumented public APIs in PyTorch by removing functions from coverageignorefunctions and coverageignoreclasses in docs/source/conf.py, running Sphinx coverage, and adding the appropriate…

    104k GitHub stars~4.2k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • ExecuTorch Cortex-M Backend

    pytorch/executorch

    Developer guide for the Cortex-M (CMSIS-NN) backend in ExecuTorch: quantization pipeline, pass manager, tests and adding new ops.

    5.1k GitHub stars~872 tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • PyTorch Lightning Training

    Orchestra-Research/AI-Research-SKILLs

    Shows how to organize PyTorch training with Lightning's LightningModule and Trainer, covering validation, DDP, callbacks and learning-rate scheduling.

    13k GitHub starsUsed in 7 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed
  • Ako4all

    TongmingLAIC/AKO4ALL

    Drive an agentic loop that iteratively optimizes a GPU kernel for maximum speedup.

    369 GitHub stars~4k tokensUpdated 23 days ago
    AI & LLM EngineeringAuto-check passed
  • Homepage Generator

    wanshuiyin/ARIS-in-AI-Offer

    Generate a fact-checked academic personal homepage from a CV, optionally augmented by an existing manual homepage and an assets directory.

    580 GitHub stars~4.8k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check: notes
  • Paddle Op Dev

    PaddlePaddle/Paddle

    PaddlePaddle (飞桨) C++ 算子开发指南。提供从 YAML 配置、InferMeta 函数、Kernel 实现、Python API 封装、单元测试到编译验证的完整算子开发流程指导。在以下场景使用此 skill:(1) 为 Paddle 框架新增 C++ 算子 (2) 修改或调试已有 Paddle 算子 (3) 编写算子的 YAML…

    24k GitHub stars~1.3k tokensUpdated 8 days ago
    AI & LLM EngineeringAuto-check passed

More from facebook/pyrefly

  • Add Torch Shapes Example

    facebook/pyrefly

    Official

    A skill your agent uses when adding a new PyTorch model to Pyrefly's shape-tracking example corpus under tensor-shapes/pyrefly-torch-stubs/examples — i.e.

    7.1k GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • Modify Shaped Array Dsl

    facebook/pyrefly

    Official

    A skill your agent uses when Pyrefly computes a wrong tensor shape (or is missing one that can't be expressed in a stub signature) and you need to add or fix a shape-DSL rule.

    7.1k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Official

    Port a PyTorch model to use pyrefly's tensor shape type system (Tensor[[B, C, H, W]], Int[T]).

    7.1k GitHub stars~13k tokensUpdated today
    Auto-check passed
  • Score Pyrefly Change

    facebook/pyrefly

    Official

    Produces a scorecard evaluating a pyrefly change on correctness and quality.

    7.1k GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Review Pyrefly Diff

    facebook/pyrefly

    Official

    Reviews a comma separated pyrefly diff according to the pyrefly review best practices.

    7.1k GitHub stars~863 tokensUpdated today
    Auto-check passed

Works with

Questions about Benchmark Pyrefly

What does Benchmark Pyrefly do?

Run Pyrefly benchmarks locally via Buck or Cargo, including PyTorch real-world LSP benchmarks. Benchmark Pyrefly is an agent skill from facebook/pyrefly, published by the product's own GitHub organization. Run Pyrefly benchmarks locally via Buck or Cargo, including PyTorch real-world LSP benchmarks.

When should I use Benchmark Pyrefly?

Benchmark Pyrefly fits situations like: user asks to benchmark pyrefly performance; run pyrefly bench; compare cold start vs error propagation; update PyTorch benchmark pin.

How do I install Benchmark Pyrefly in Claude Code?

Run `npx skills add facebook/pyrefly --skill benchmark-pyrefly -a claude-code`. Or copy the skill folder (.agents/skills/benchmark-pyrefly in facebook/pyrefly) into .claude/skills/benchmark-pyrefly in your project. Claude Code loads it when a task matches its description.

How do I install Benchmark Pyrefly in Codex?

Run `npx skills add facebook/pyrefly --skill benchmark-pyrefly -a codex`. Or copy the skill folder (.agents/skills/benchmark-pyrefly in facebook/pyrefly) into .agents/skills/benchmark-pyrefly in your project. Codex loads it when a task matches its description.

Can I use Benchmark Pyrefly in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add facebook/pyrefly --skill benchmark-pyrefly -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/benchmark-pyrefly, .gemini/skills/benchmark-pyrefly, .github/skills/benchmark-pyrefly and .opencode/skills/benchmark-pyrefly in your project.

What does Benchmark Pyrefly need to run?

Going by SKILL.md and its folder, Benchmark Pyrefly needs the command-line tools its instructions call (cargo). Our summary lists: Python 3.

Does Benchmark Pyrefly access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Benchmark Pyrefly safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Benchmark Pyrefly use?

Benchmark Pyrefly is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Benchmark Pyrefly use?

About 1.8k tokens (SKILL.md is roughly 7.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Benchmark Pyrefly?

Skills that share tags, products or a category with Benchmark Pyrefly: Document Public APIs (pytorch/pytorch, 104k stars), ExecuTorch Cortex-M Backend (pytorch/executorch, 5.1k stars), PyTorch Lightning Training (Orchestra-Research/AI-Research-SKILLs, 13k stars) and Ako4all (TongmingLAIC/AKO4ALL, 369 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Benchmark Pyrefly?

facebook (a GitHub organization, an official publisher) maintains it in facebook/pyrefly, which has 7,054 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on October 8, 2026.

Source: facebook/pyrefly on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.