Agent skill

Worktree Env Setup

by meta-pytorch in meta-pytorch/attention-gym

Sets up an isolated per-worktree Python environment for attention-gym development using nightly PyTorch and the CI-mirroring uv flow.

BSD-3-ClauseAuto-check passedDevelopment

Install Worktree Env Setup

skills CLI
$ npx skills add meta-pytorch/attention-gym --skill worktree-env-setup -a claude-code

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

GitHub CLI
$ gh skill install meta-pytorch/attention-gym worktree-env-setup --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/meta-pytorch/attention-gym.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/worktree-env-setup .claude/skills/worktree-env-setup && 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
worktree-env-setup
GitHub stars
1.3k
Token cost
~858 tokens
SKILL.md length
415 words
Files
1
Skills in repo
3
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

Sets up an isolated per-worktree Python environment for attention-gym development using nightly PyTorch and the CI-mirroring uv flow.

  • Creating a new git worktree
  • SKILL.md covers Setup, Running commands and Verifying isolation
  • Calls uv, python and pytest; reaches download.pytorch.org
  • A worktree lacks a local .venv

What it does

Worktree Env Setup is an agent skill from meta-pytorch/attention-gym. Sets up an isolated per-worktree Python environment for attention-gym development using nightly PyTorch and the CI-mirroring uv flow. Use when creating a new git worktree or when a worktree lacks a local .venv.

Its SKILL.md is about 860 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 Development, covering Git worktrees. It works with Git, Python, PyTorch and pytest. The repository describes itself as: Helpful tools and examples for working with flex-attention. The licence is BSD-3-Clause.

When your agent uses it

  • Creating a new git worktree
  • A worktree lacks a local .venv

Example prompts

  • “/worktree-env-setup”

Requirements

  • Python 3

What it can do on your machine

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

    • uv
    • python
    • pytest

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

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • download.pytorch.org

    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

Worktree Env Setup loads about 858 tokens when it runs. Until then it costs about 57 tokens; SKILL.md has 415 words of instructions outside code blocks.

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

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 meta-pytorch/attention-gym at commit 0beac51, republished under its BSD-3-Clause licence (© meta-pytorch). 415 words, ~858 tokens.

Download SKILL.mdSave it as .claude/skills/worktree-env-setup/SKILL.md (or your agent's skills folder).
name
worktree-env-setup
description
Sets up an isolated per-worktree Python environment for attention-gym development using nightly PyTorch and the CI-mirroring uv flow. Use when creating a new git worktree or when a worktree lacks a local .venv.

Worktree Environment Setup

Each attention-gym worktree gets its own .venv so editable installs, concurrent agents, and test runs never cross-import another checkout. Never reuse a shared env's editable install across worktrees, and never ln -s another worktree's .venv as a shortcut: an editable install is a .pth file naming one checkout, so a shared env makes every other worktree run that checkout's sources. A fresh uv venv plus hard-linked wheels costs seconds; a wrong import costs hours. If .venv already exists as a symlink, rm .venv and rebuild it below.

Setup

From the worktree root (mirrors .github/workflows/test.yml):

bash
uv venv --python 3.13
source .venv/bin/activate
uv pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu132
uv pip install --prerelease allow -e '.[tests,linear,dev]'

Notes:

  • uv hard-links wheels from its cache, so after the first nightly download this takes seconds and costs almost no extra disk per worktree.
  • Activate .venv before installing so an already-active foreign environment is not modified.
  • --prerelease allow is required for the flash-attn-4 beta in [tests]. [tests] omits FlashAttention on aarch64, so its transitive CuTeDSL pin does not apply there or to linear-only installs. When updating CuTeDSL, run pytest -n 6 test/test_kda_bwd_wy_compile.py to catch NVVM binding changes without a Blackwell GPU, then validate forward/backward numerics on supported hardware.
  • A .venv symlink into another worktree is not isolation: its editable .pth still points at that worktree, so pytest imports the other checkout's attn_gym. Replace it with a real per-worktree env.
  • Do not use uv sync/uv.lock: nightly torch churns daily and CI uses the imperative uv pip flow above, not a lockfile.
  • Drop [linear] if CuTeDSL/TVM-FFI kernels are not needed (CPU-only work).
  • [tests] and [cudnn] are declared conflicting extras in pyproject.toml; keep them in separate environments. For cuDNN worktrees, install -e '.[cudnn,dev]' pytest pytest-xdist instead; cuDNN tests import-skip optional FlashAttention coverage.
Show full SKILL.md (139 more words)Show less

Running commands

Prefer the worktree's own interpreter — either activate .venv first, or use uv run --no-sync pytest test (matches CI exactly). Never invoke a Python from another worktree or a shared ~/.venvs/* env for attn_gym imports.

Verifying isolation

bash
cd /tmp && python -c "import attn_gym; print(attn_gym.__file__)"

The printed path must be inside the current worktree. If it points at another checkout, the editable install is wrong — rerun the -e '.[tests,linear,dev]' install from this worktree root.

Run the check from outside the repo root. From the root, python -c puts the current directory first on sys.path and masks a wrong editable install, while python agent_space/script.py and pytest (whose test/ has no __init__.py) put the script directory first and silently import the other checkout. A .venv symlinked to another worktree's env fails exactly this way: edits appear to have no effect because the kernels compile from the other tree.

© meta-pytorch, BSD-3-Clause. 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/worktree-env-setup of meta-pytorch/attention-gym.

Open the folder on GitHubat commit 0beac51

Compare with similar skills

Worktree Env Setup 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.

Worktree Env Setup compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Worktree Env Setup this skillmeta-pytorch/attention-gym1.3k—~858Automated safety check: PassBSD-3-Clause
Skyvern Version BumpSkyvern-AI/skyvern23k—~1kAutomated safety check: NotesAGPL-3.0
Adk Setupgoogle/adk-python22k—~993Automated safety check: NotesApache-2.0
ExecuTorch Cortex-M Backendpytorch/executorch5.1k—~872Automated safety check: PassCustom licence
Burla Parallel Dev ClustersBurla-Cloud/burla263—~1.6kAutomated safety check: PassCustom licence
Spec Kitty Git Workflowspec-kitty/spec-kitty1.7k—~2.3kAutomated safety check: PassMIT

Similar skills

  • Skyvern Version Bump

    Skyvern-AI/skyvern

    Walks through a Skyvern open-source release bump: update the version, rebuild the Python and TypeScript SDKs with Fern, commit, and open a pull request.

    23k GitHub stars~1k tokensUpdated today
    DevelopmentAuto-check: notes
  • Adk Setup

    google/adk-python

    Official

    Sets up a local ADK Python development environment in a git clone of the open-source adk-python repository: a uv virtual environment, all dependency extras, pre-commit hooks, and a first unit-test…

    22k GitHub stars~993 tokensUpdated today
    DevelopmentAuto-check: notes
  • 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
  • Sets up an isolated Burla dev cluster per git worktree so several agents can work in parallel, and explains when to use local-dev or remote-dev.

    263 GitHub stars~1.6k tokensUpdated 14 days ago
    DevelopmentAuto-check passed
  • Spec Kitty Git Workflow

    spec-kitty/spec-kitty

    Understand how Spec Kitty manages git: what git operations Python handles automatically, what agents must do manually, worktree lifecycle, auto-commit behavior, merge execution, and the safe-commit…

    1.7k GitHub stars~2.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Compare Codegen

    hw-native-sys/pypto

    Compare codegen output (.pto files and pass dumps) between origin/main and the current branch for a given test case.

    125 GitHub stars~1.4k tokensUpdated 7 days ago
    DevelopmentAuto-check passed

More from meta-pytorch/attention-gym

  • Validating Pytorch Custom Ops

    meta-pytorch/attention-gym

    Ensures new Attention Gym eager, Triton, CuTeDSL, and external-library implementations are torch.compile-friendly and correctly registered.

    1.3k GitHub stars~6.4k tokensUpdated yesterday
    Auto-check passed
  • Cutedsl Tunable Kernel Template

    meta-pytorch/attention-gym

    Adds an Attention Gym tuning adapter to a CuTeDSL op using typed input-aware configs, cached fake-tensor TVM-FFI compilation, parallel candidate compilation, and sequential GPU benchmarking.

    1.3k GitHub stars~4.1k tokensUpdated yesterday
    Auto-check passed

Questions about Worktree Env Setup

What does Worktree Env Setup do?

Sets up an isolated per-worktree Python environment for attention-gym development using nightly PyTorch and the CI-mirroring uv flow. Worktree Env Setup is an agent skill from meta-pytorch/attention-gym. Sets up an isolated per-worktree Python environment for attention-gym development using nightly PyTorch and the CI-mirroring uv flow.

When should I use Worktree Env Setup?

Worktree Env Setup fits situations like: creating a new git worktree; A worktree lacks a local .venv.

How do I install Worktree Env Setup in Claude Code?

Run `npx skills add meta-pytorch/attention-gym --skill worktree-env-setup -a claude-code`. Or copy the skill folder (.agents/skills/worktree-env-setup in meta-pytorch/attention-gym) into .claude/skills/worktree-env-setup in your project. Claude Code loads it when a task matches its description.

How do I install Worktree Env Setup in Codex?

Run `npx skills add meta-pytorch/attention-gym --skill worktree-env-setup -a codex`. Or copy the skill folder (.agents/skills/worktree-env-setup in meta-pytorch/attention-gym) into .agents/skills/worktree-env-setup in your project. Codex loads it when a task matches its description.

Can I use Worktree Env Setup 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 meta-pytorch/attention-gym --skill worktree-env-setup -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/worktree-env-setup, .gemini/skills/worktree-env-setup, .github/skills/worktree-env-setup and .opencode/skills/worktree-env-setup in your project.

What does Worktree Env Setup need to run?

Going by SKILL.md and its folder, Worktree Env Setup needs the command-line tools its instructions call (uv, python and pytest). Our summary lists: Python 3.

Does Worktree Env Setup access the network?

SKILL.md names 1 domain. In commands or code: download.pytorch.org; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Worktree Env Setup 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 Worktree Env Setup use?

Worktree Env Setup is published under the BSD-3-Clause licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Worktree Env Setup use?

About 858 tokens (SKILL.md is roughly 3.4k 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 Worktree Env Setup?

Skills that share tags, products or a category with Worktree Env Setup: Skyvern Version Bump (Skyvern-AI/skyvern, 23k stars), Adk Setup (google/adk-python, 22k stars), ExecuTorch Cortex-M Backend (pytorch/executorch, 5.1k stars) and Burla Parallel Dev Clusters (Burla-Cloud/burla, 263 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Worktree Env Setup?

meta-pytorch (a GitHub organization) maintains it in meta-pytorch/attention-gym, which has 1,254 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on October 6, 2026.

Source: meta-pytorch/attention-gym on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.