本文へスキップ
Skillpedia
分析とスプレッドシート7.8k · #13009

spreadsheet-validated-exec

できること

このスキルは、AIエージェントがPythonでスプレッドシートの作業を実行する前に、データソースを確認するよう導きます。アクセスできないデータや不完全なデータで時間を浪費する人向けです。

使う場面

  • ✓スプレッドシートの作業が複数のソースを使い、そのうち1つにアクセスできないかもしれないとき。
  • ✓複数のシートを含む複雑なExcelの作業を実行しようとしているとき。
  • ✓ソースが失敗した場合に、明確なエラーメッセージと代替手段がほしいとき。

スキルのリンク

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/spreadsheet-direct-python-enhanced-enhanced-f0b1db/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/spreadsheet-direct-python-enhanced-enhanced-f0b1db/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“要約を作る前に、元のシートにアクセスでき、データがそろっているか確認してください。失敗した場合は、どの代替手段を使うか教えてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、処理スクリプトを書く前に、各元ファイルやURLに到達でき、期待するフィールドがあるかを確認します。主要なソースに到達できない場合に備えて代替のソースを記録し、複雑な作業は保存済みのファイルから実行します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Validated Python Execution for Spreadsheet Tasks

Overview

This skill extends direct Python execution for spreadsheet operations by adding a mandatory data validation phase before any processing begins. This prevents wasted iterations on inaccessible data sources and provides clear error documentation when data cannot be accessed.

When to Use This Skill

Use validated direct run_shell with Python scripts for spreadsheet operations when:

  • Reading or writing complex Excel files with multiple sheets
  • Data sources have already been validated as accessible
  • You have fallback sources identified in case of access failures
  • 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 Validated Direct Execution?

Beyond standard shell_agent limitations, unvalidated data access causes:

  • Wasted iterations attempting to process non-existent data
  • Unclear error messages when source files are inaccessible
  • No graceful degradation when primary sources fail
  • Missing documentation of why data operations couldn't complete

Direct run_shell with Python validation is more reliable because it:

  • Executes validation in a single step with no iteration limits
  • Provides clearer, immediate error messages for access failures
  • Handles complex operations without step constraints
  • Gives full control over library imports and execution flow
  • Writing scripts to .py files first avoids shell_agent parsing issues with heredocs
  • Documents all access failures for troubleshooting and reporting

Phase 0: Data Source Validation (REQUIRED)

Before writing any spreadsheet processing code, verify your data sources are accessible:

Step 0.1: Verify Data Availability

import os
import requests
from pathlib import Path

# For local files
def verify_local_file(file_path):
    path = Path(file_path)
    if not path.exists():
        raise FileNotFoundError(f"Data file not found: {file_path}")
    if not path.is_file():
        raise ValueError(f"Path is not a file: {file_path}")
    if path.stat().st_size == 0:
        raise ValueError(f"Data file is empty: {file_path}")
    print(f"✓ Local file verified: {file_path} ({path.stat().st_size} bytes)")
    return True

# For remote URLs
def verify_remote_url(url, timeout=30):
    try:
        # Try HEAD request first (lighter than GET)
        response = requests.head(url, timeout=timeout, allow_redirects=True)
        if response.status_code == 405:  # HEAD not allowed, try GET
            response = requests.get(url, timeout=timeout, stream=True)
        response.raise_for_status()
        
        # Check content type if available
        content_type = response.headers.get('Content-Type', '')
        if 'text/html' in content_type and 'excel' not in url.lower():
            print(f"⚠ Warning: URL may return HTML, not data file")
        
        print(f"✓ Remote URL verified: {url} (Status: {response.status_code})")
        return True
    except requests.exceptions.SSLError as e:
        print(f"✗ SSL Error: {str(e)}")
        return False
    except requests.exceptions.ConnectionError as e:
        print(f"✗ Connection Error: {str(e)}")
        return False
    except requests.exceptions.Timeout as e:
        print(f"✗ Timeout Error: {str(e)}")
        return False
    except Exception as e:
        print(f"✗ Verification Failed: {str(e)}")
        return False

Step 0.2: Handle Inaccessible Sources

If primary data source is unavailable:

  1. Check alternative locations:

    • Is data available from a backup URL?
    • Is there a cached/local copy available?
    • Can data be obtained from an API instead of web scraping?
    • Is there an alternative data provider?
  2. Document the failure:

    def log_access_failure(source, error_type, timestamp=None):
        from datetime import datetime
        if not timestamp:
            timestamp = datetime.now().isoformat()
        
        error_log = {
            'timestamp': timestamp,
            'source': source,
            'error_type': error_type,
            'alternatives_attempted': [],
            'resolution': 'pending'
        }
        
        # Save to error log file
        import json
        with open('data_acce
    
よくある質問

ソースが見つからない場合はどうなりますか?

スキルは、エラーを明確に報告し、利用可能な場合は一覧にある代替ソースを使うよう述べています。

なぜ処理の前に確認するのですか?

データがない場所での無駄な試行を避けるため、先に確認すべきだとスキルは述べています。

数式や書式設定も扱いますか?

はい。スキルは、データを確認した後の数式、書式設定、変換を扱うと述べています。

詳細

作者による元の説明

Execute Python scripts for spreadsheets with prerequisite data validation and source accessibility checks

repo: HKUDS/AgentPilot

人気

GitHubのスター
7.8k
ランキング
#13009
ライセンス
MIT
更新日
2026/11/1

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル