python-spreadsheet-debug
できること
このスキルは、Pythonのスプレッドシートの作業のための、順序立てた確認の手順をAIエージェントに与えます。スプレッドシートのスクリプトが失敗し、問題が環境にあるのかスクリプトにあるのかを突き止めたい人向けです。
使う場面
- ✓シェルの出力が読みにくく、スプレッドシートのスクリプトが失敗するとき。
- ✓Pythonやライブラリがないかバージョンが違うかもしれないと思うとき。
- ✓本番の作業の前に、ファイルが読めることを確かめる小さなテストの実行をしたいとき。
スキルのリンク
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/python-spreadsheet-debug/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“スプレッドシートのスクリプトが、はっきりした理由もなく失敗します。Pythonとpandasが動くか確かめてから、ファイルが読めるかをテストしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、使っているPythonとそのバージョンを確認し、必要な各ライブラリを一つずつインポートします。次に、ファイルを読んで行数などの要約を表示する短いテストのスクリプトを、全体の作業の前に実行します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Python Spreadsheet Debugging Workflow
When executing Python scripts for spreadsheet/data processing tasks, use this systematic debugging approach to efficiently isolate environment configuration issues from script logic errors, especially when run_shell returns opaque errors.
Step 1: Verify Python Environment
First, confirm the Python interpreter path and version to ensure you're working in the expected environment:
which python python3
python --version
python3 --version
This identifies whether Python is available and which version is being used.
Step 2: Test Library Imports in Isolation
Before running your full script, verify that required libraries can be imported successfully. Test each critical import individually:
python -c "import pandas; print('pandas:', pandas.__version__)"
python -c "import openpyxl; print('openpyxl:', openpyxl.__version__)"
python -c "import xlrd; print('xlrd:', xlrd.__version__)"
Replace library names based on your script's requirements. This identifies missing dependencies or version conflicts early.
Step 3: Run Minimal Test Script
Create and execute a minimal script that exercises only the core functionality without full business logic:
# test_minimal.py
import pandas as pd
# Test 1: Can we read a file?
try:
df = pd.read_excel('sample.xlsx')
print(f"✓ File read successful: {len(df)} rows")
except Exception as e:
print(f"✗ File read failed: {e}")
# Test 2: Can we perform basic operations?
try:
result = df.groupby('category')['amount'].sum()
print(f"✓ GroupBy operation successful")
except Exception as e:
print(f"✗ Operation failed: {e}")
Run this with: python test_minimal.py
Purpose: This isolates whether the issue is with file access, library functionality, or specific script logic.
Step 4: Execute Full Script
Once the minimal test passes, run the complete script:
python your_script.py
If errors occur now, you know the environment is correctly configured and can focus on debugging the specific logic.
Quick Diagnostic Command
For rapid diagnosis, run all checks in sequence:
echo "=== Python Version ===" && python --version && \
echo "=== Key Imports ===" && python -c "import pandas, openpyxl; print('OK')" && \
echo "=== Ready for full script ==="
Common Issues and Resolutions
| Symptom | Likely Cause | Resolution |
|---|---|---|
ModuleNotFoundError |
Missing package | pip install <package-name> |
ImportError with version |
Version conflict | Check pip list, reinstall specific version |
FileNotFoundError |
Wrong path/context | Verify working directory with pwd |
PermissionError |
File access | Check file permissions or path |
When to Use This Pattern
run_shellreturns cryptic or truncated error messages- Script worked previously but suddenly fails
- Deploying to a new environment or container
- Debugging spreadsheet processing with pandas, openpyxl, xlrd, etc.
Benefits
- Fast isolation: Identifies environment vs. logic issues within seconds
- Incremental confidence: Each passing step narrows the problem space
- Reusable pattern: Apply consistently across all Python spreadsheet tasks
よくある質問
なぜライブラリを一つずつインポートするのですか?
どのライブラリが足りないか、壊れているかが正確に分かり、修正が速くなるからです。
最小限のテストのスクリプトは何をしますか?
スプレッドシートを読もうとして行数を表示し、基本が動くことを確かめます。
Excelファイルだけに使えますか?
いいえ。CSVファイルやほかの表形式のデータにも当てはまります。
詳細
作者による元の説明
Systematic Python debugging workflow for spreadsheet tasks to isolate environment issues from script logic
repo: HKUDS/AgentPilot
人気
- GitHubのスター
- 7.8k
- ランキング
- #12963
- ライセンス
- MIT
- 更新日
- 2026/11/1
コメント
- …
このリポジトリの他のスキル
agentpilot
7.8kエージェントが、作業を準備し、変更案を提案してテストし、評価するAgentPilotのループを実行することで、プロジェクトを段階的に改善できるよう支援します。
openspace
7.8kエージェントが、スキルを保存し取り出すツールであるOpenSpaceをセットアップし、MCPを通じてAIアプリに接続できるよう支援します。
rsi-arena
7.8kエージェントが、AIMEやTerminal-Benchなどの標準的なAIベンチマークテストをセットアップして実行し、異なる改善方法を比較できるよう支援します。
experiment-guide
7.8kエージェントが、プログラムを改善する方法を調べる間に、小さな実験を計画し、その結果を読み、発見を記録できるよう支援します。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。