Official agent skill

Modify Shaped Array Dsl

by facebook in facebook/pyrefly

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.

OfficialMITAuto-check passedAI & LLM Engineering

Install Modify Shaped Array Dsl

skills CLI
$ npx skills add facebook/pyrefly --skill modify-shaped-array-dsl -a claude-code

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

GitHub CLI
$ gh skill install facebook/pyrefly modify-shaped-array-dsl --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/modify-shaped-array-dsl .claude/skills/modify-shaped-array-dsl && 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
modify-shaped-array-dsl
GitHub stars
7.1k
Token cost
~1.2k tokens
SKILL.md length
617 words
Files
1
Skills in repo
6
Repo updated
First seen
Licence
MIT

At a glance

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.

  • Pyrefly computes a wrong tensor shape (or is missing one that cant be expressed in a stub signature) and you need to add
  • SKILL.md covers How the DSL works (the…, Test the layer you change and Contributing the change
  • Calls cargo
  • Fix a shape-DSL rule

What it does

Modify Shaped Array Dsl is an agent skill from facebook/pyrefly, published by the product's own GitHub organization. Use 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. Requires a Pyrefly checkout (fbsource or a clone); not usable from a pip/site-packages install.

Its SKILL.md is about 1.2k 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. It works with Python and Rust. The repository describes itself as: A fast type checker and language server for Python. The licence is MIT.

When your agent uses it

  • Pyrefly computes a wrong tensor shape (or is missing one that cant be expressed in a stub signature) and you need to add
  • Fix a shape-DSL rule

Example prompts

  • “/modify-shaped-array-dsl”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 0e44796. 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

Modify Shaped Array Dsl loads about 1.2k tokens when it runs. Until then it costs about 69 tokens; SKILL.md has 617 words of instructions outside code blocks.

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

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 0e44796, republished under its MIT licence (© facebook). 617 words, ~1,172 tokens.

Download SKILL.mdSave it as .claude/skills/modify-shaped-array-dsl/SKILL.md (or your agent's skills folder).
name
modify-shaped-array-dsl
description
Use 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. Requires a Pyrefly checkout (fbsource or a clone); not usable from a pip/site-packages install.

You are modifying Pyrefly's tensor-shape DSL — the logic that computes the output shape of a torch op from its input shapes.

This skill points at code; it does not duplicate it. Read the files below to learn the details. What follows is only the map and the invariant you must uphold (add a unit test).

How the DSL works (the 30-second version)

A shape rule is a Python function in tensor-shapes/pyrefly-torch-stubs/torch-stubs/_shapes.pyi, decorated with @type_shape_dsl_function, that computes a type-level value using a restricted Python subset. Public stubs call the function directly in return annotations, for example Tensor[reshape(Shape, Target)]. The checker validates and evaluates these calls; CPython treats the decorator as a runtime no-op.

There are two kinds of change. A stub-only change edits _shapes.pyi and the public return annotation to compose existing operations. A DSL-kernel change edits the Rust validator or evaluator to add a genuinely new operation; reach for it only when the rule cannot be expressed by composing the existing DSL.

For a stub parameter that accepts either an integer tuple or list, use IntTupleOrList[Values] with Values: IntTuple. Direct, unstarred list literals bind their values; existing and starred lists remain gradual, while direct literals containing non-integers are rejected. This is a stub-signature feature, not a reason to add list handling to a DSL kernel.

The type-level DSL implementation lives primarily in crates/pyrefly_types/src/type_level_dsl.rs, with separate modules for type system operations such as MapIntTuples. The symbolic dimension algebra it uses lives in crates/pyrefly_types/src/dimension.rs.

Preserve tensor types in numeric formulas

Integer/float arithmetic overloads can sometimes cause a tensor expression to lose type information during overload selection. In tensor code, make formulas explicitly floating-point when the result is intended to remain a tensor. For example, multiply an exponent by 1.0, or use a floating-point base such as 2.0 instead of 2. These equivalent forms steer overload selection toward floating-point tensor arithmetic.

Spell gradual shapes canonically

Use int for a gradual dimension, IntTuple for a gradual whole shape, and bare Int for a gradual shape integer. For example, prefer Tensor[[int, 3]] to Tensor[[Any, 3]], Tensor[IntTuple] to Tensor[Any], and Int to Int[Any]. The Any spellings remain legal for compatibility, but use them only when a test specifically exercises Any propagation.

Show full SKILL.md (252 more words)Show less

Test the layer you change

For a stub-only change in _shapes.pyi that composes existing DSL operations, add a focused test to that library's static shape corpus and a runtime cross-check where possible. Do not duplicate the stub rule in pyrefly/lib/test/shape_dsl.rs; such a test does not exercise the implementation that changed.

For a DSL-kernel change, add a targeted test in pyrefly/lib/test/shape_dsl.rs. An end-to-end example alone does not pin the kernel behavior, so explicitly cover the relevant algebra and edge cases. Read nearby type-level DSL tests before adding one. Use assert_type when the expected type is expressible and inline # E: ... markers for diagnostics. Tests for the retained V1 kernel compatibility path are isolated in the legacy module and should not be used as templates for new rules.

Run a kernel test with:

  • buck: buck test fbcode//pyrefly:test-library -- <test_name>
  • cargo: cargo test <test_name>

After a DSL-kernel (Rust) change you must rebuild before the checker sees it: buck build fbcode//pyrefly:pyrefly (or cargo build). Stub-only _shapes.pyi edits need no rebuild.

For any DSL-kernel or broader Pyrefly core change that modifies shape manipulation semantics (as opposed to only editing torch/numpy stubs), the default verification gate is:

bash
tensor-shapes/run_all_shape_tests.py

This gate runs the shape-relevant Rust unit tests plus the non-runtime tensor-shape corpus tests, and defaults to cargo with automatic buck fallback. Use --mode buck or --mode cargo when you need to pin the backend, and add --include-runtime-tests only when runtime coverage is relevant.

Contributing the change

  • fbsource: land as a diff.
  • clone: open a PR against the stubs / Rust source in place.

© 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/modify-shaped-array-dsl of facebook/pyrefly.

Open the folder on GitHubat commit 0e44796

Compare with similar skills

Modify Shaped Array Dsl 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.

Modify Shaped Array Dsl compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Modify Shaped Array Dsl this skillfacebook/pyrefly7.1k—~1.2kAutomated safety check: PassMIT
Hugging Face TokenizersOrchestra-Research/AI-Research-SKILLs13k7 repos~3.4kAutomated safety check: PassMIT
Add Comfyui NodeMooshieblob1/MooshieUI207—~936Automated safety check: PassAGPL-3.0
Test Runnernoumena-labs/Sipp121—~854Automated safety check: PassApache-2.0
Logfire Instrumentationpydantic/skills140—~6.1kAutomated safety check: PassMIT
Nemo Relay InstallNVIDIA/NeMo-Relay190—~1.7kAutomated safety check: PassApache-2.0

Similar skills

  • Hugging Face Tokenizers

    Orchestra-Research/AI-Research-SKILLs

    Shows how to load, train and use fast Hugging Face tokenizers, with BPE, WordPiece and Unigram models, padding, truncation and alignment tracking.

    13k GitHub starsUsed in 7 repos~3.4k tokens
    AI & LLM EngineeringAuto-check passed
  • Add Comfyui Node

    Mooshieblob1/MooshieUI

    Adds a custom ComfyUI Python node to MooshieUI — Python class in mooshienodes.py, Rust required-class registration, and optional workflow template chain hookup.

    207 GitHub stars~936 tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed
  • Test Runner

    noumena-labs/Sipp

    Runs the narrowest relevant tests to validate changes. An agent skill from noumena-labs/Sipp.

    121 GitHub stars~854 tokensUpdated 17 days ago
    AI & LLM EngineeringAuto-check passed
  • Official

    Add Pydantic Logfire observability to application code — traces, logs, metrics, and AI/agent spans.

    140 GitHub stars~6.1k tokensUpdated 6 days ago
    AI & LLM EngineeringAuto-check passed
  • Nemo Relay Install

    NVIDIA/NeMo-Relay

    Official

    A skill your agent uses when choosing or running NeMo Relay installation for the CLI, Python, Node.js, Rust, OpenClaw, or maintained framework integrations, or when explaining Hermes Agent's…

    190 GitHub stars~1.7k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Check Runtime Parity

    ayutaz/piper-plus

    推論パスの canonical Python (exportonnx.py / vits/models.py:VitsModel.infer) を変更した PR で、6 ランタイム (Python runtime / Rust / Go / C / C++ / WASM) の inference path が追随しているかを git diff で確認。PR

    218 GitHub stars~972 tokensUpdated yesterday
    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
  • Benchmark Pyrefly

    facebook/pyrefly

    Official

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

    7.1k GitHub stars~1.8k 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 Modify Shaped Array Dsl

What does Modify Shaped Array Dsl do?

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. Modify Shaped Array Dsl is an agent skill from facebook/pyrefly, published by the product's own GitHub organization. Use 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.

When should I use Modify Shaped Array Dsl?

Modify Shaped Array Dsl fits situations like: pyrefly computes a wrong tensor shape (or is missing one that cant be expressed in a stub signature) and you need to add; fix a shape-DSL rule.

How do I install Modify Shaped Array Dsl in Claude Code?

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

How do I install Modify Shaped Array Dsl in Codex?

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

Can I use Modify Shaped Array Dsl 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 modify-shaped-array-dsl -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/modify-shaped-array-dsl, .gemini/skills/modify-shaped-array-dsl, .github/skills/modify-shaped-array-dsl and .opencode/skills/modify-shaped-array-dsl in your project.

What does Modify Shaped Array Dsl need to run?

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

Does Modify Shaped Array Dsl 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 Modify Shaped Array Dsl 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 Modify Shaped Array Dsl use?

Modify Shaped Array Dsl 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 Modify Shaped Array Dsl use?

About 1.2k tokens (SKILL.md is roughly 4.7k 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 Modify Shaped Array Dsl?

Skills that share tags, products or a category with Modify Shaped Array Dsl: Hugging Face Tokenizers (Orchestra-Research/AI-Research-SKILLs, 13k stars), Add Comfyui Node (Mooshieblob1/MooshieUI, 207 stars), Test Runner (noumena-labs/Sipp, 121 stars) and Logfire Instrumentation (pydantic/skills, 140 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Modify Shaped Array Dsl?

facebook (a GitHub organization, an official publisher) maintains it in facebook/pyrefly, which has 7,051 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on October 7, 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.