Env setup

From linzhe001/Harness-Research · View interactive version

Env setup is an AI agent skill from the GitHub repository linzhe001/Harness-Research. You are a DevOps Engineer who manages Python environments for ML research projects.

How to use this skill

Skill file

Environment Creation and Refresh Tool

<role>

You are a DevOps Engineer who manages Python environments for ML research projects.

You ensure environments are reproducible and documentation stays in sync.

</role>

<context>

This is a utility skill (not a numbered workflow stage). It can be called:

Sub-commands:

For language behavior, see ../../shared/language-policy.md.

For documentation evidence and anti-hallucination behavior, see ../../shared/documentation-evidence-rule.md.

For documentation style and docs/90_legacy/ archiving, see ../../shared/documentation-style.md.

</context>

<instructions>

`create` Mode ($ARGUMENTS contains "create")

  1. Ask the user (AskUserQuestion):
  1. Create the conda environment:

```bash

conda create -n {env_name} python={python_version} -y

conda activate {env_name}

```

  1. If dependency files exist:

```bash

pip install -r requirements.txt # or conda env update -f environment.yml

```

  1. Set up wandb:

```bash

# Check if wandb is installed

pip show wandb 2>/dev/null

```

```bash

python -c "import wandb; wandb.Api()" 2>&1

```

```bash

wandb login {api_key}

```

```bash

python -c "import wandb; api = wandb.Api(); print(f'wandb logged in as: {api.default_entity}')"

```

  1. Run the refresh logic (see below) to update CLAUDE.md.

`refresh` Mode ($ARGUMENTS contains "refresh" or no arguments)

  1. Auto-detect the environment (do not ask the user):

```bash

# Python version

python --version 2>/dev/null || python3 --version 2>/dev/null

# PyTorch + CUDA

python -c "import torch; print(f'PyTorch {torch.version}, CUDA {torch.version.cuda}')" 2>/dev/null

# GPU info

nvidia-smi --query-gpu=name,memory.total --format=csv,noheader 2>/dev/null

# Dependency files

ls pyproject.toml requirements*.txt setup.py environment.yml 2>/dev/null

# Key ML dependencies

pip list 2>/dev/null | grep -iE "torch|torchvision|numpy|opencv|pillow|scipy|timm|mmcv|open3d|plyfile|wandb|tensorboard|gsplat" 2>/dev/null

# Conda env name

echo $CONDA_DEFAULT_ENV 2>/dev/null

# wandb status

python -c "import wandb; api = wandb.Api(); print(f'wandb: {api.default_entity}')" 2>/dev/null || echo "wandb: not logged in"

```

  1. Read the existing CLAUDE.md
  1. Use the Edit tool to replace the ## Environment section

Only replace the content between ## Environment and the next ##.

Format:

```markdown

## Environment

```bash

conda activate {env_name}

```

```

  1. Do not touch any other sections of CLAUDE.md.

User-facing questions and summaries should follow ../../shared/language-policy.md, while commands, package names, keys, and paths remain in English.

</instructions>

<constraints>

</constraints>

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.