Agent skill · software engineering · pytorch

pyrefly-type-coverage

Migrate a file to use stricter Pyrefly type checking with annotations required for all functions, classes, and attributes.

Why this skill is useful

Adds specific commands and configurations for enforcing stricter type checking with Pyrefly that the AI wouldn't reliably generate on its own.

What it needs

Requires lintrunner, pyrefly installed locally. About 7k tokens when loaded. Last updated 2026-08-07. 102,253 stars on the source repository.

What this skill does

Pyrefly Type Coverage Skill Prerequisites The file must live in a project with a pyrefly.toml. pyrefly, lintrunner, and the project's test runner must be on PATH. If any are missing, stop and ask whether a conda environment needs activating — don't install or substitute (per repo CLAUDE.md). Step 1: Remove file-level type-check suppressions Delete any of these from the top of the file (pyrefly honors # mypy: ignore-errors for mypy compat, so that one must go too): Step 2: Add a sub-config entry to pyrefly.toml IMPORTANT: Setting any error key in [sub-config.errors] overrides only that key relative to the parent — but enabling unannotated-return / unannotated-parameter / implicit-any will resurface errors that were previously hidden file-wide. If you see unrelated errors (e.g., bad-param-name-override) flooding the output, mirror the parent config's setting for that key in the sub-config to silence them. Step 3: Run pyrefly Goal: resolve all unannotated-return, unannotated-parameter, and implicit-any errors by adding annotations — see Step 4's ladder. These three target categories are always resolvable; never suppress them with # pyrefly: ignore. The single exception is @compatibility(isbackwardcompatible=True) (Step 4). Other categories (bad-argument-type, missing-attribute, …) are real type bugs. Handle them by where pyrefly reports them: Reported in another file (path != target): leave it. Don't widen scope. If the error is now blocking the target, suppress at the report site with pyrefly: ignore[<category>] # TODO. Reported in the target file but the message names a symbol defined elsewhere (e.g., bad-return because an imported function's annotation is wrong): suppress locally with the same TODO comment. Don't invent a cast() that papers over the upstream gap. Reported in the target file, originates locally: fix it. Use # pyrefly: ignore[...] only as a last resort, and only on non-target categories. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills pytorch/pyrefly-type-coverage

View the source on GitHub

Browse the @skills marketplace