env-fix

An automated troubleshooting command for environment problems that stop tests from running.

In plain words
What is it for?
Use it when tests fail because the project setup is incomplete or inconsistent, including problems with Node.js, Python packages, databases, Redis, or other external services.
Why use it?
It finds common setup causes such as missing packages, unset environment variables, incorrect configuration, unavailable services, or an incompatible runtime version.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/classmethod/tsumiki/env-fix
Clone the repo
git clone --depth 1 https://github.com/classmethod/tsumiki
Per session 73 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,565 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00073 $0.01565
Opus 5 $0.00036 $0.00783
Sonnet 5 $0.00015 $0.00313
Haiku 4.5 $0.00007 $0.00156

Measured yesterday against content hash 859f5b7c9ea5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

env-fix scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf node_modules && npm install
commands/env-fix.md · 133 lines

How it starts

The opening of the file, as written. The whole thing — 133 lines — stays where its author put it; the contents beside it link to each section on GitHub.

環境依存問題を解消して。

context

test_command: {{test_command}} (テスト実行コマンド。未指定の場合は npm test)
test_file: {{test_file}} (対象テストファイル。未指定の場合は全テスト)
error_output: {{error_output}} (エラー出力内容)
error_classification: {{error_classification}} (エラー分類。⚙️設定・環境問題 / 📦依存関係問題)
max_retry: 2 (最大リトライ回数)

step

step0: プロジェクトコンテキストの確認

以下のファイルが存在する場合は読み取り、テスト実行方法や環境要件を把握する:

  • CLAUDE.md — テスト実行方法、環境設定の指示
  • README.md — セットアップ手順、必要な環境変数、外部サービス要件
  • AGENTS.md — エージェント向けの開発ルール、環境関連の注意事項

test_command が未指定の場合は、これらの情報から適切なテストコマンドを決定する。

step1: 環境問題の分析

  1. エラー出力の確認

    • error_output が提供されている場合はそれを分析
    • 提供されていない場合はテストを実行してエラーを取得
  2. 原因分析(Task tool, subagent_type: Explore, thoroughness: medium

    • 以下の環境問題パターンに沿って分析:
      • 依存パッケージ不足/不整合: package.json と node_modules の不一致、lockfile の不整合
      • 環境変数未設定: 必要な環境変数が未定義、.env ファイルの不備
      • 設定ファイル不備: 設定ファイルの不足、パス設定の誤り
      • 外部サービス未起動: DB、Redis、メッセージキュー等の未起動
      • Node.js/ランタイムバージョン不整合: .nvmrc / .node-version との不一致
    • 修正可能な問題と手動対応が必要な問題を分類

step2: 自動修正の試行

問題種別に応じた修正を実施:

  1. 依存パッケージ不足/不整合の場合

    # lockfileとの同期
    npm ci
    
    • npm ci が失敗した場合:
    rm -rf node_modules && npm install
    
    • Python の場合:
    pip install -r requirements.txt
    
  2. 環境変数未設定の場合

    • .env.example / .env.sample / .env.template が存在するか確認
    • 存在する場合: .env.test または .env にコピー
    • 存在しない場合: エラーメッセージから必要な環境変数を特定し、テスト用デフォルト値で .env.test を生成
    • 注意: 機密情報(APIキー等)はプレースホルダで記載し、レポートで手動設定を推奨
  3. 設定ファイル不備の場合

    • テンプレートや既存設定からの生成
    • パス設定の修正(相対パス/絶対パスの変換)
    • 不足プロパティの追加
  4. 外部サービス未起動の場合

    • docker-compose.yml / compose.yml が存在するか確認
    • 存在する場合:
    docker compose up -d
    
    • 存在しない場合: 手動起動が必要としてレポート
  5. ランタイムバージョン不整合の場合

    • .nvmrc / .node-version の内容を報告
    • 自動修正は行わず、レポートで推奨バージョンを記載

step3: テスト再実行による確認

  1. テストを再実行
    {{test_command}} 2>&1
    
    • test_file が指定されている場合:
    {{test_command}} -- {{test_file}} 2>&1
    

Read the full file on GitHub · 133 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 133 lines · 73 tokens per session scan C 859f5b7c9ea5

Subscribe to this mod's changes

env-fix is a command published in the GitHub repository classmethod/tsumiki (974 stars, last pushed 25d ago), licensed MIT. It adds 73 tokens to every session and 1,565 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.