jpskill.com
🛠️ 開発・MCP コミュニティ

run-experiment

機械学習の実験を、ローカル環境やクラウド環境など様々な計算環境で実行し、トレーニングの開始、ジョブの投入、実験スクリプトの実行などを効率的に行うことを支援するSkill。

📜 元の英語説明(参考)

Submit or run an ML experiment on a compute environment (local, SLURM HPC, RunAI/Kubernetes). Use when the user wants to launch a training run, submit a job, run ablations, or execute an experiment script on any compute cluster.

🇯🇵 日本人クリエイター向け解説

一言でいうと

機械学習の実験を、ローカル環境やクラウド環境など様々な計算環境で実行し、トレーニングの開始、ジョブの投入、実験スクリプトの実行などを効率的に行うことを支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o run-experiment.zip https://jpskill.com/download/8060.zip && unzip -o run-experiment.zip && rm run-experiment.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/8060.zip -OutFile "$d\run-experiment.zip"; Expand-Archive "$d\run-experiment.zip" -DestinationPath $d -Force; ri "$d\run-experiment.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して run-experiment.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → run-experiment フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

実験の実行

ML実験を、ローカルマシン、SLURM HPC (Ibex, UWなど)、またはRunAI/Kubernetes (EPFL) のような計算環境に投入します。

コードとともにコミットされる再現可能なジョブスクリプトjobs/ に生成し、実行するための正確な投入コマンドを提供します。

このスキルは、起動されたジョブを計画された実験、証拠アイテム、ワークツリー、またはプロジェクトアクションにリンクする必要がある場合に、research-project-memory と組み合わせて使用します。

用語集:

  • local: エージェントが実行されているマシン。通常はユーザーのMac
  • Git remote: コードの同期に使用されるGitHub/GitLabリモート。例えば origin
  • server: questibex-vscodeepfl-haas のようなSSH/HPC/RunAI実行環境

SLURMまたはRunAIで起動する場合は、Gitリモートを参照する場合を除き、リモート実行ではなくサーバー実行と呼びます。

スキルディレクトリのレイアウト

<installed-skill-dir>/
├── SKILL.md
├── environments.yaml        # 環境プロファイル (新しいクラスタ用に拡張)
└── templates/
    ├── slurm_job.sh         # SLURMテンプレート (Ibex, UW、あらゆるSLURMクラスタ)
    ├── runai_job.sh         # RunAI/Kubernetesテンプレート (EPFL)
    └── local_run.sh         # ローカルtmux/nohupテンプレート

従うべき手順

1. 環境レジストリの読み込み

この SKILL.md を含むディレクトリとして <installed-skill-dir> を解決し、<installed-skill-dir>/environments.yaml を読み込みます。

利用可能な環境を、それぞれ1行の説明とともにユーザーにリスト表示します。

2. 実験の詳細の問い合わせ

ユーザーに単一のメッセージで尋ねます:

  1. Environment: どの計算環境を使用しますか? (environments.yaml から利用可能な選択肢と "other" を表示)
  2. Script / command: 実行するコマンドは何ですか? (例: uv run python train.py --lr 1e-3)
  3. Job name: 短い識別子 (例: baseline-cifar10ablation-no-attn)。デフォルト: スクリプトのベース名 + 日付。
  4. GPU count: GPUの数はいくつですか? (環境プロファイルからのデフォルト、CPUのみの場合は0)
  5. Walltime / time limit: (SLURMのみ) どのくらいの時間ですか? (環境プロファイルからのデフォルト)
  6. Conda env or venv: conda環境の名前、または .venv パス (該当する場合)
  7. Output directory: チェックポイント/結果をどこに保存しますか? (デフォルト: outputs/<job-name>/)
  8. Anything special?: 追加の環境変数、アレイジョブ、特定のGPUタイプ、PVCマウント (RunAI) など。

--env--script--name、または --gpus が引数として渡された場合は、それらの回答を事前に入力します。

3. プロジェクトルートの特定

git rev-parse --show-toplevel 2>/dev/null || pwd

また、短いgitコミットハッシュを取得します:

git rev-parse --short HEAD 2>/dev/null || echo "no-git"

4. ジョブスクリプトの生成

環境タイプに基づいて:

type: slurm (ibex, uw、またはあらゆるSLURMクラスタ)

<installed-skill-dir>/templates/slurm_job.sh からSLURMテンプレートを読み込みます。

すべての {PLACEHOLDER} 変数を埋めます:

Placeholder Value
{PROJECT} プロジェクトディレクトリ名
{ENV_NAME} 環境キー (例: ibex)
{ENV_DISPLAY} プロファイルからの表示名
{DATE} 今日の日付 YYYY-MM-DD
{COMMIT} 短いgit SHA
{JOB_NAME} ユーザーが指定したジョブ名
{SCRIPT_NAME} 生成されたスクリプトのファイル名
{PARTITION} 環境プロファイルのデフォルトから (またはユーザーによるオーバーライド)
{CPUS} プロファイルからの cpus_per_task (またはユーザーによるオーバーライド)
{GPUS} ユーザーが指定したGPU数
{MEM} プロファイルからのデフォルト (またはユーザーによるオーバーライド)
{WALLTIME} ユーザーが指定した、またはプロファイルのデフォルト
{LOG_DIR} outputs/logs/<job-name>
{OUTPUT_DIR} outputs/<job-name>
{PROJECT_ROOT} 絶対プロジェクトルートパス
{CONDA_ENV} ユーザーが指定した環境名
{RUN_COMMAND} ユーザーが指定したコマンド
{SCRATCH} 環境プロファイルからのスクラッチパス

環境プロファイルの common_modules に基づいて、関連する module load 行のコメントを解除します。 ユーザーの回答に基づいて、conda activate または source .venv/activate 行のコメントを解除します。 スクラッチパスが環境プロファイルにある場合は、TMPDIRブロックのコメントを解除します。

出力パス: jobs/<job-name>.sh

type: runai (runaiプロファイル)

<installed-skill-dir>/templates/runai_job.sh からRunAIテンプレートを読み込みます。

プレースホルダーを埋めます:

Placeholder Value
{PROJECT} プロジェクトディレクトリ名
{DATE} 今日の日付
{COMMIT} 短いgit SHA
{JOB_NAME} ユーザーが指定したジョブ名
{SCRIPT_NAME} 生成されたスクリプトのファイル名
{IMAGE} 環境プロファイルの default_image から (ユーザーに確認を求める)
{RUNAI_PROJECT} 環境プロファイルの project から
{GPUS} GPU数
{CPUS} プロファイルデフォルトからのCPU数
{MEM} プロファイルデフォルトからのメモリ
{PVC_FLAGS} プロファイルの pvc_mounts から生成: マウントごとに --pvc claim:path \
{RUN_COMMAND} ユーザーが指定したコマンド

出力パス: jobs/<job-name>-runai.sh

type: local

<installed-skill-dir>/templates/local_run.sh からローカルテンプレートを読み込みます。

同様にプレースホルダーを埋めます。必要に応じてconda/venvのアクティベーションのコメントを解除します。

出力パス: jobs/<job-name>-local.sh

type: other / unknown

ユーザーが environments.yaml にない環境を指定した場合:

  1. 尋ねる: "どのスケジューラを使用しますか? (slurm / runai / other)"
  2. SLURM互換の場合: ユーザーが提供する情報を使用してSLURMテンプレートを使用します。
  3. 真に新しい場合: 最小限の汎用ラッパーを生成し、何を入力するかを説明します。
  4. 提案する: "この環境を今後の使用のために environments.yaml に追加しますか?"

5. ジョブスクリプトの書き込みとプレビュー

プレビューまたは投入の前に、ジョブスクリプトディレクトリ、ログディレクトリ、および出力ディレクトリを作成します:

mkdir -p <project-root>/jobs
mkdir -p <project-root>/outputs/logs/<job-name>
mkdir -p <output-dir>

入力済みのスクリプトを jobs/<job-name>.sh (または -runai.sh / -local.sh) に書き込みます。

レビューのために、生成されたスクリプト全体をユーザーに表示します。

6. 投入コマンドの表示と起動の確認

環境に合わせて調整された、投入するための正確なコマンドを表示します:

SLURM (Ibex / UW / など)

# すでにログインノードにいる場合:
sbatch jobs/<job-name>.sh

# ローカルから投入する場合
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Run Experiment

Submit an ML experiment to a compute environment — local machine, SLURM HPC (Ibex, UW, etc.), or RunAI/Kubernetes (EPFL).

Generates a reproducible job script in jobs/ that is committed alongside the code, then provides the exact submit command to run.

Pair this skill with research-project-memory when a launched job should be linked to a planned experiment, evidence item, worktree, or project action.

Terminology:

  • local: the machine where the agent is running, usually the user's Mac
  • Git remote: GitHub/GitLab remote used for code sync, such as origin
  • server: SSH/HPC/RunAI execution environment such as quest, ibex-vscode, or epfl-haas

When launching on SLURM or RunAI, call it a server run rather than a remote run unless referring to the Git remote.

Skill Directory Layout

<installed-skill-dir>/
├── SKILL.md
├── environments.yaml        # Environment profiles (extend for new clusters)
└── templates/
    ├── slurm_job.sh         # SLURM template (Ibex, UW, any SLURM cluster)
    ├── runai_job.sh         # RunAI/Kubernetes template (EPFL)
    └── local_run.sh         # Local tmux/nohup template

Steps to Follow

1. Read the environment registry

Resolve <installed-skill-dir> as the directory containing this SKILL.md, then read <installed-skill-dir>/environments.yaml.

List the available environments to the user with a one-line description each.

2. Ask for experiment details

Ask the user in a single message:

  1. Environment: Which compute env? (show available choices from environments.yaml + "other")
  2. Script / command: What command to run? (e.g., uv run python train.py --lr 1e-3)
  3. Job name: Short identifier (e.g., baseline-cifar10, ablation-no-attn). Default: script basename + date.
  4. GPU count: How many GPUs? (default from env profile, 0 for CPU-only)
  5. Walltime / time limit: (SLURM only) How long? (default from env profile)
  6. Conda env or venv: Name of the conda environment, or .venv path (if applicable)
  7. Output directory: Where to save checkpoints/results? (default: outputs/<job-name>/)
  8. Anything special?: Extra env vars, array job, specific GPU type, PVC mounts (RunAI), etc.

If --env, --script, --name, or --gpus were passed as arguments, pre-fill those answers.

3. Locate the project root

git rev-parse --show-toplevel 2>/dev/null || pwd

Also capture the short git commit hash:

git rev-parse --short HEAD 2>/dev/null || echo "no-git"

4. Generate the job script

Based on the environment type:

type: slurm (ibex, uw, or any SLURM cluster)

Read the SLURM template from <installed-skill-dir>/templates/slurm_job.sh.

Fill in all {PLACEHOLDER} variables:

Placeholder Value
{PROJECT} project directory name
{ENV_NAME} environment key (e.g., ibex)
{ENV_DISPLAY} display name from profile
{DATE} today's date YYYY-MM-DD
{COMMIT} short git SHA
{JOB_NAME} user-provided job name
{SCRIPT_NAME} filename of the generated script
{PARTITION} from env profile defaults (or user override)
{CPUS} cpus_per_task from profile (or user override)
{GPUS} user-provided GPU count
{MEM} from profile defaults (or user override)
{WALLTIME} user-provided or profile default
{LOG_DIR} outputs/logs/<job-name>
{OUTPUT_DIR} outputs/<job-name>
{PROJECT_ROOT} absolute project root path
{CONDA_ENV} user-provided env name
{RUN_COMMAND} user-provided command
{SCRATCH} scratch path from env profile

Uncomment the relevant module load lines based on the env profile's common_modules. Uncomment the conda activate or source .venv/activate line based on user's answer. If scratch path is in the env profile, uncomment the TMPDIR block.

Output path: jobs/<job-name>.sh

type: runai (runai profile)

Read the RunAI template from <installed-skill-dir>/templates/runai_job.sh.

Fill in placeholders:

Placeholder Value
{PROJECT} project directory name
{DATE} today's date
{COMMIT} short git SHA
{JOB_NAME} user-provided job name
{SCRIPT_NAME} filename of generated script
{IMAGE} from env profile default_image (ask user to confirm)
{RUNAI_PROJECT} from env profile project
{GPUS} GPU count
{CPUS} CPU count from profile defaults
{MEM} memory from profile defaults
{PVC_FLAGS} generated from pvc_mounts in profile: --pvc claim:path \ per mount
{RUN_COMMAND} user-provided command

Output path: jobs/<job-name>-runai.sh

type: local

Read the local template from <installed-skill-dir>/templates/local_run.sh.

Fill in placeholders similarly. Uncomment conda/venv activation as appropriate.

Output path: jobs/<job-name>-local.sh

type: other / unknown

If the user specifies an environment not in environments.yaml:

  1. Ask: "What scheduler does it use? (slurm / runai / other)"
  2. If SLURM-compatible: use the SLURM template with the info the user provides.
  3. If truly novel: generate a minimal generic wrapper and explain what to fill in.
  4. Suggest: "Want me to add this environment to environments.yaml for future use?"

5. Write the job script and preview

Create the job script directory, log directory, and output directory before previewing or submitting:

mkdir -p <project-root>/jobs
mkdir -p <project-root>/outputs/logs/<job-name>
mkdir -p <output-dir>

Write the filled-in script to jobs/<job-name>.sh (or -runai.sh / -local.sh).

Show the user the full generated script for review.

6. Show the submit command and ask to launch

Print the exact command(s) to submit, tailored to the environment:

SLURM (Ibex / UW / etc.)

# If you're already on the login node:
sbatch jobs/<job-name>.sh

# If submitting from your local machine to a server (requires ssh access):
scp jobs/<job-name>.sh <ssh-alias>:<project-root>/jobs/
ssh <ssh-alias> "cd <project-root> && mkdir -p outputs/logs/<job-name> <output-dir> jobs && sbatch jobs/<job-name>.sh"

# Monitor:
squeue -u $USER
sacct -j <jobid> --format=JobID,State,Elapsed,AllocGRES
tail -f outputs/logs/<job-name>/slurm-<jobid>.out

RunAI

bash jobs/<job-name>-runai.sh

# Monitor:
runai list
runai logs <job-name> -f

Local

# Attached (output in terminal):
bash jobs/<job-name>-local.sh

# Detached in tmux:
tmux new-session -d -s <job-name> "bash jobs/<job-name>-local.sh"
tmux attach -t <job-name>

# Background with nohup:
nohup bash jobs/<job-name>-local.sh &

Ask: "Want me to run the submit command now?"

  • If yes and local: run it directly.
  • If yes and server: run the scp + ssh sbatch command (requires ssh key auth to be set up).
  • If no: remind the user that the script is saved in jobs/ and ready to submit.

7. Offer to add to jobs index (optional)

If a jobs/README.md or jobs/index.md exists, offer to append a one-line entry:

| {DATE} | {JOB_NAME} | {ENV_NAME} | {COMMIT} | {RUN_COMMAND_BRIEF} |

If the repo follows the code evidence layout from init-python-project, also offer to create or update a short run pointer under:

docs/runs/<DATE>-<job-name>.md

This file should contain the command, config, commit, output path, expected metric, and monitor command. It should not contain raw logs.

8. Update project memory when present

If the repo has memory/ or a worktree .agent/worktree-status.md, update only verified run pointers:

  • memory/evidence-board.md: add or update the linked EXP-### with job script path, commit, command, output directory, and status planned, submitted, or running only if verified
  • docs/runs/: write a small run pointer when the code repo uses that convention
  • memory/action-board.md: mark the launch action as doing or create a monitor action
  • memory/current-status.md: record the latest known job and what must be checked next
  • <worktree>/.agent/worktree-status.md: link the run to the worktree purpose and exit condition

Do not store queue state, job success, or final metric values as durable facts unless they were verified in this session. Use needs-verification for monitor tasks.


Environment Reference

All environments are defined in environments.yaml. The current known environments:

Key Type Cluster Notes
local local Current machine, tmux/nohup
ibex slurm KAUST Ibex ilogin.ibex.kaust.edu.sa; gpu/batch/himem partitions
uw slurm UW HPC Placeholder — update environments.yaml with actual details
runai runai EPFL RunAI Kubernetes; update project/image in environments.yaml

Adding a New Environment

Edit <installed-skill-dir>/environments.yaml and add a block:

my-cluster:
  type: slurm                       # or runai / local
  display_name: "My University HPC"
  login_node: "login.cluster.edu"
  ssh_alias: mycluster
  scheduler: slurm
  partitions:
    gpu:
      name: gpu
      flag: "--partition=gpu"
      gpu_flag: "--gres=gpu:{count}"
      max_gpus_per_job: 4
  defaults:
    partition: gpu
    gpus: 1
    cpus_per_task: 4
    mem: "32G"
    walltime: "12:00:00"
    max_walltime: "48:00:00"
  storage:
    home: "/home/{user}"
    scratch: "/scratch/{user}"
  module_system: lmod
  common_modules:
    - "cuda/12.1"
    - "python/3.11"
  notes: "..."

Reproducibility Conventions

Every generated job script includes:

  • Git commit hash in the header and as an env var (GIT_COMMIT)
  • Structured output directory: outputs/<job-name>/ for checkpoints, outputs/logs/<job-name>/ for logs
  • Timestamped log files so reruns don't overwrite
  • Exit code propagation so job arrays and downstream scripts detect failures

The jobs/ directory should be committed to git (the scripts are small text files). Actual outputs go to outputs/ which is typically .gitignored.


Example Invocations

/run-experiment                                              # interactive wizard
/run-experiment --env ibex --script train.py --gpus 2
/run-experiment --env local --script eval.py --name eval-baseline
/run-experiment --env runai --gpus 4 --name big-run
/run-experiment --env ibex --script sweep.py --name sweep --gpus 1

Common Patterns

Job Array (SLURM) — hyperparameter sweep

When the user says "I want to sweep over N configs":

  1. Ask for the sweep configs or config file (e.g., configs/sweep.yaml with N entries).
  2. Add #SBATCH --array=0-{N-1}%{max_concurrent} to the script.
  3. Add to the run command: --config configs/sweep.yaml --config-idx $SLURM_ARRAY_TASK_ID
  4. Output dir: outputs/<job-name>/$SLURM_ARRAY_TASK_ID/

Multi-GPU (DDP)

When GPUs > 1 and the env is SLURM:

  • Add --ntasks-per-node={GPUS} directive
  • Wrap command with torchrun --nproc_per_node={GPUS} or srun python -m torch.distributed.launch
  • Ask the user which distributed launcher they use

Interactive Session (Debugging)

When the user wants to debug interactively (not submit a batch job):

Ibex:

srun --partition=gpu --gres=gpu:1 --cpus-per-task=4 --mem=32G --time=2:00:00 --pty bash

RunAI:

runai submit <name> --image <image> --gpu 1 --interactive --stdin -- bash
runai bash <name>

Generate this command directly without creating a script file.