sn-image-doctor について
sn-image-doctor は SenseNova-Skills の環境を診断するコマンドラインスキルです。インストール、Python 依存関係、環境変数を確認し、不足設定の入力を促して `.env` に保存できます。
主な機能
- 01SenseNova-Skills のインストール確認
- 02Python 依存関係の確認
- 03必須環境変数の確認
- 04不足設定の入力と `.env` への保存
- 05設定変更後の環境再読み込み
活用シーン
- 01他のスキル実行前の環境確認
- 02不足している Python パッケージの特定
- 03必須 API 変数の設定
- 04環境設定の問題の診断
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ opensensenova/ sensenova-skills --skill sn-image-doctorインストール後、Claude Code で/sn-image-doctorを入力して読み込まれたか確認します。
同梱ファイルscripts/check_environment.py
詳細
sn-image-doctor
概要
sn-image-doctor は、ほかのスキルを実行する前に SenseNova-Skills 環境を検証するインフラストラクチャスキル(ティア 0)です。SenseNova-Skills プロジェクトが適切にインストールされ、設定されていることを確認します。
このスキルでは、次のような包括的なチェックを行います。
- SenseNova-Skills プロジェクトのインストール確認
- Python 依存関係の検証
- 環境変数の設定確認。必須変数が不足している場合は、対話形式で設定を促し、
.envに保存します - 設定変更後の環境の自動再読み込み。再読み込みに失敗した場合は、エージェントの再起動を提案します
使用方法
環境を検証するには、doctor チェックを実行します。
# Basic check
python scripts/check_environment.py
# Verbose output with detailed diagnostics
python scripts/check_environment.py --verbose
出力形式
テキスト出力
=== SenseNova-Skills Environment Check ===
[1/3] Checking sn-image-base installation...
✅ Installation looks good
[2/3] Checking Python dependencies...
✅ Python 3.11.0
✅ All required packages installed
[3/3] Checking environment variables...
❌ SN_IMAGE_GEN_API_KEY: Image generation API key is not set; configure SN_API_KEY, or configure SN_IMAGE_GEN_API_KEY only for an image-generation-specific override
Some required environment variables are missing.
Enter values below to save them to /path/to/.env.
Press Enter to skip a variable.
SN_API_KEY: <user input>
✅ Saved to /path/to/.env: SN_API_KEY
🔄 Reloading environment...
✅ Environment reloaded successfully
=== Summary ===
✅ Environment is properly configured
再読み込みに失敗した場合、出力でエージェントの再起動が提案されます。
✅ Saved to /path/to/.env: SN_API_KEY
🔄 Reloading environment...
⚠️ Failed to reload environment: <error message>
💡 Suggestion: Restart the agent to apply new configuration
エラー出力
チェックに失敗した場合:
=== SenseNova-Skills Environment Check ===
[1/3] Checking sn-image-base installation...
❌ sn-image-base directory not found
Expected location: /path/to/skills/sn-image-base
[2/3] Checking Python dependencies...
❌ Missing packages: httpx, pillow
Run: pip install -r skills/sn-image-base/requirements.txt
=== Summary ===
❌ Environment check failed
Please fix the errors above before using SenseNova-Skills.
トラブルシューティング
sn-image-base が見つからない
問題: sn-image-base ディレクトリが見つかりません
解決方法:
# Ensure you're in the project root
cd /path/to/SenseNova-Skills
# Verify the directory exists
ls -la skills/sn-image-base
依存関係の不足
問題: 必要な Python パッケージがインストールされていません
解決方法:
# Install dependencies
pip install -r skills/sn-image-base/requirements.txt
# Or use a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r skills/sn-image-base/requirements.txt
環境変数の不足
問題: 必要な環境変数が設定されていません
解決方法:
# If all capabilities use the same gateway, set only the global values.
export SN_API_KEY="your-api-key"
export SN_BASE_URL="https://your-api-endpoint.com"
# Or create a .env file
cat > .env << EOF
SN_API_KEY=your-api-key
SN_BASE_URL=https://token.sensenova.cn/v1
SN_CHAT_TYPE=openai-completions
SN_CHAT_MODEL=sensenova-6.8-flash-lite
EOF
# Load .env file
source .env # Or use a tool like python-dotenv
フォールバックの優先順位は、機能固有の変数 > ドメイン共有変数 > グローバル変数です。たとえば、テキストの呼び出しでは SN_TEXT_API_KEY -> SN_CHAT_API_KEY -> SN_API_KEY、ビジョンの呼び出しでは SN_VISION_API_KEY -> SN_CHAT_API_KEY -> SN_API_KEY、画像生成では SN_IMAGE_GEN_API_KEY -> SN_API_KEY の順に使用されます。
API 接続の問題
問題: API エンドポイントに接続できません
解決方法:
-
ネットワーク接続を確認します
-
ファイアウォールの設定を確認します
-
API エンドポイントの URL が正しいことを確認します
-
curl でテストします。
curl -I https://your-api-endpoint.com
ほかのスキルとの連携
このスキルは、SenseNova-Skills プロジェクトでほかのスキルを使用する前に実行するよう設計されています。
# 1. Run doctor check
python skills/sn-image-doctor/scripts/check_environment.py
# 2. If checks pass, use other skills
python skills/sn-image-base/scripts/sn_agent_runner.py sn-image-generate \
--prompt "A beautiful landscape"
コマンドラインオプション
| オプション | 説明 |
|---|---|
--verbose | 詳細な診断情報を表示します |
--help | ヘルプメッセージを表示します |
終了コード
| コード | 意味 |
|---|---|
0 | すべてのチェックに合格しました |
1 | 1 つ以上のチェックに失敗しました |
関連項目
sn-image-base/SKILL.md- ベースレイヤースキルのドキュメントsn-image-base/references/api_spec.md- API 仕様sn-infographic/SKILL.md- sn-image-base に依存するスキルの例