Chuyển đến nội dung
Skillpedia
Phân tích và bảng tính7.8k · #13009

spreadsheet-validated-exec

Skill này làm gì

Skill này giúp AI agent xác nhận nguồn dữ liệu trước khi chạy công việc bảng tính bằng Python. Nó dành cho những người có công việc tốn thời gian vì dữ liệu không truy cập được hoặc chưa đầy đủ.

Khi nào nên dùng

  • ✓Khi một công việc bảng tính dùng nhiều nguồn và một nguồn có thể không truy cập được.
  • ✓Khi sắp chạy một công việc Excel phức tạp với nhiều sheet.
  • ✓Khi bạn muốn có thông báo lỗi rõ ràng và kế hoạch dự phòng nếu một nguồn thất bại.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/spreadsheet-direct-python-enhanced-enhanced-f0b1db/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Kiểm tra các sheet nguồn của tôi có truy cập được và đầy đủ trước khi bạn làm bản tóm tắt. Nếu một nguồn lỗi, hãy cho tôi biết bạn sẽ dùng phương án dự phòng nào.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent kiểm tra mỗi file hoặc URL nguồn có truy cập được và chứa các trường mong đợi trước khi viết script xử lý. Nó ghi chú các nguồn dự phòng phòng khi nguồn chính không truy cập được, và chạy các công việc phức tạp từ một file đã lưu.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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
    
Câu hỏi thường gặp

Điều gì xảy ra nếu nguồn bị thiếu?

Skill yêu cầu báo lỗi rõ ràng và dùng nguồn dự phòng đã liệt kê nếu có.

Tại sao kiểm tra trước khi xử lý?

Skill lưu ý rằng kiểm tra trước giúp tránh lãng phí các lần thử vào dữ liệu không có.

Nó có xử lý công thức và định dạng không?

Có, skill bao gồm công thức, định dạng và các phép biến đổi sau khi dữ liệu đã được kiểm tra.

Chi tiết

Mô tả gốc của tác giả

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

repo: HKUDS/AgentPilot

Độ phổ biến

Sao GitHub
7.8k
Vị trí xếp hạng
#13009
Giấy phép
MIT
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự