spreadsheet-validated-execution
できること
このスキルは、AIエージェントがソースデータを確認してから、openpyxlやpandasを使ったスプレッドシートの作業をPythonで行うよう導きます。入力の慎重な確認が必要な、複数手順のExcel作業を行う人向けです。
使う場面
- ✓複数のシートを持つ複雑なExcelファイルを読み書きするスプレッドシートの作業をするとき。
- ✓ブックに数式、書式設定、または変換を適用する必要があるとき。
- ✓複数手順のジョブがエージェントのステップ上限を超えるかもしれず、スクリプトとして保存すべきとき。
スキルのリンク
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/spreadsheet-direct-python-enhanced-enhanced/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“売上ブックに書式設定と数式を適用してください。ただし、先に元ファイルがあり、完全であるか確認してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、ソースにアクセスでき、想定した構造があるかを確認します。その後、Pythonの処理をスクリプトファイルに書いて実行します。主要なソースが失敗した場合は、指定された代替ソースを使います。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Direct Python Execution for Spreadsheet Tasks
When to Use This Skill
Use this skill for spreadsheet operations that require verified source data:
- Before processing: Verify data sources are accessible and contain expected data
- Reading or writing complex Excel files with multiple sheets
- Applying formulas, formatting, or data transformations
- Working with
openpyxl,pandas, or similar libraries - The operation involves multiple steps that could exceed agent step limits
- You need precise control over error handling and debugging
- Complex scripts benefit from file-based execution for better reliability
Critical: Data Source Validation First
Always validate data availability before attempting spreadsheet operations. This prevents wasted iterations on unavailable data.
Pre-Execution Validation Checklist
- Verify source accessibility: Test connection to data URLs/files before building processing scripts
- Confirm data format: Ensure source data matches expected structure (columns, sheets, file type)
- Check data completeness: Validate required fields/rows are present
- Identify fallback sources: Document alternative data sources if primary is unavailable
Validation Script Pattern
import sys
import os
from pathlib import Path
def validate_source(source_path, required_fields=None):
"""Validate data source before processing"""
if not Path(source_path).exists():
return False, f"Source file not found: {source_path}"
try:
# Check file is readable and non-empty
if os.path.getsize(source_path) == 0:
return False, "Source file is empty"
if required_fields:
# Validate structure using pandas
import pandas as pd
df = pd.read_excel(source_path, nrows=1)
missing = set(required_fields) - set(df.columns)
if missing:
return False, f"Missing required columns: {missing}"
return True, "Source validated"
except Exception as e:
return False, f"Validation error: {str(e)}"
# Usage
valid, message = validate_source('input.xlsx', ['ID', 'Date', 'Value'])
if not valid:
print(f"ABORT: {message}", file=sys.stderr)
sys.exit(1)
print(f"OK: {message}")
Handling Inaccessible Data Sources
When primary data sources are unavailable:
- Report clearly: Document the specific error (SSL, timeout, file not found)
- Attempt fallbacks: Check alternative sources in priority order:
- Local cached copies of the data
- Alternative API endpoints or URLs
- Different file formats from the same source
- Contact information for data provider
- Graceful degradation: If partial data is available, document what's missing
- Escalation protocol: For persistent failures, provide:
- Exact error messages and timestamps
- URLs/paths that were attempted
- Workarounds already tried
- Recommended next steps for human intervention
Example: Multi-Source Fallback Pattern
import sys
from pathlib import Path
sources = [
'data/wells_current.xlsx', # Primary: latest data
'data/wells_backup.xlsx', # Fallback 1: backup copy
'data/wells_archive.xlsx', # Fallback 2: archived version
'/cached/wells_data.xlsx', # Fallback 3: system cache
]
selected_source = None
for source in sources:
if Path(source).exists():
selected_source = source
print(f"Using fallback source: {source}")
break
if not selected_source:
print("CRITICAL: No data sources available", file=sys.stderr)
print("Attempted sources:", file=sys.stderr)
for s in sources:
print(f" - {s}", file=sys.stderr)
sys.exit(1)
# Proceed with selected_source
- Reading or writing complex Excel files with multiple sheets
- Applying formulas, formatting, or data transformations
- Working with
openpyxl,pandas, or similar libraries - The operation involves multiple steps that could exceed agent step limits
- You need precise control over error handling and debugging
- Complex scripts benefit from file-based execution for better reliability
Why Direct Execution?
The shell_agent tool can:
- Hit maximum step limits on complex multi-step operations
- Produce unexplained errors on formatting operations
- Fail on intricate spreadsheet reads/writes due to iterative parsing
- Fail to parse heredoc syntax correctly,
よくある質問
なぜ作業をスクリプトとして保存するのですか?
スキルは、複雑な複数手順の作業では、ファイルベースのスクリプトの方が信頼性が高いと述べています。
どのライブラリを使いますか?
スキルは、スプレッドシート作業の主要なライブラリとして、openpyxlとpandasを挙げています。
ソースにアクセスできない場合はどうしますか?
エージェントは失敗を記録し、代替ソースが特定されていれば、それを使います。
詳細
作者による元の説明
Execute Python scripts with prerequisite data validation and fallback strategies for inaccessible sources
repo: HKUDS/AgentPilot
人気
- GitHubのスター
- 7.8k
- ランキング
- #13010
- ライセンス
- 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出力もできます。