[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XC1VHFHWB3FZ0GDMAEDCNG":3,"skill-same:01M6XC1VHFHWB3FZ0GDMAEDCNG":68},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":37,"linkOnly":38,"markdownContent":39,"markdownBody":40,"frontMatter":41,"refName":42,"commitSha":43,"skillDirectory":44,"forksCount":13,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":47,"install":48,"resources":61},"01M6XC1VHFHWB3FZ0GDMAEDCNG","spreadsheet-source-validated",null,"Execute Python scripts for spreadsheet operations with mandatory source data validation and fallback protocols","UF-gzj\u002Fopenspace-claude-evolution","UF-gzj","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F272393507?v=4","01M6XBCZB755P01VVYGQWPYZY3","01M6XBCZFJA5AREA17WGETA3FW",0,"MIT","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fspreadsheet-direct-python-enhanced-enhanced-2e6773\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000004","电子表格","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31,32,33,34,35,36],"spreadsheet","source","spreadsheet source validated","python","validation","protocols","data","execute","operations","fallback","data validation","scripts","with","for","2026-11-10 10:12:30",false,"---\nname: spreadsheet-source-validated\ndescription: Execute Python scripts for spreadsheet operations with mandatory source data validation and fallback protocols\n---\n\n# Validated Python Execution for Spreadsheet Tasks\n\n## Pre-Execution Data Validation\n\n**CRITICAL**: Before attempting any spreadsheet operations, validate that your source data is accessible and complete.\n\n### Step 1: Verify Data Source Availability\n\n```python\nimport os\nimport sys\nfrom pathlib import Path\n\ndef validate_source_data(source_paths):\n    \"\"\"Validate all required data sources before processing.\"\"\"\n    missing = []\n    inaccessible = []\n    \n    for path in source_paths:\n        p = Path(path)\n        if not p.exists():\n            missing.append(str(path))\n        elif not os.access(path, os.R_OK):\n            inaccessible.append(str(path))\n    \n    if missing:\n        print(f\"ERROR: Missing data sources: {', '.join(missing)}\", file=sys.stderr)\n        return False\n    if inaccessible:\n        print(f\"ERROR: Inaccessible data sources: {', '.join(inaccessible)}\", file=sys.stderr)\n        return False\n    \n    print(f\"VALIDATED: {len(source_paths)} source(s) available\")\n    return True\n\n# Usage\nsources = ['input.xlsx', 'reference_data.csv']\nif not validate_source_data(sources):\n    sys.exit(1)\n```\n\n### Step 2: Verify Data Integrity\n\n```python\nimport pandas as pd\nfrom openpyxl import load_workbook\n\ndef validate_spreadsheet_integrity(file_path, required_sheets=None, required_columns=None):\n    \"\"\"Check spreadsheet structure before processing.\"\"\"\n    try:\n        # Check file is readable\n        wb = load_workbook(file_path, read_only=True)\n        \n        # Verify required sheets exist\n        if required_sheets:\n            missing_sheets = [s for s in required_sheets if s not in wb.sheetnames]\n            if missing_sheets:\n                print(f\"ERROR: Missing sheets: {missing_sheets}\", file=sys.stderr)\n                wb.close()\n                return False\n        \n        # Verify required columns (sample first sheet)\n        if required_columns:\n            ws = wb.active\n            headers = [cell.value for cell in ws[1]]\n            missing_cols = [c for c in required_columns if c not in headers]\n            if missing_cols:\n                print(f\"ERROR: Missing columns: {missing_cols}\", file=sys.stderr)\n                wb.close()\n                return False\n        \n        wb.close()\n        print(f\"VALIDATED: Spreadsheet structure OK\")\n        return True\n        \n    except Exception as e:\n        print(f\"ERROR: Cannot validate spreadsheet: {str(e)}\", file=sys.stderr)\n        return False\n```\n\n### Step 3: External Data Source Verification\n\nFor data retrieved from APIs, websites, or external services:\n\n```python\nimport requests\nfrom urllib3.exceptions import SSLError, MaxRetryError\n\ndef validate_external_source(url, timeout=30, max_retries=2):\n    \"\"\"Verify external data source is accessible.\"\"\"\n    for attempt in range(max_retries + 1):\n        try:\n            response = requests.head(url, timeout=timeout, allow_redirects=True)\n            if response.status_code == 200:\n                print(f\"VALIDATED: External source accessible ({url})\")\n                return True\n            else:\n                print(f\"WARNING: External source returned {response.status_code}\", file=sys.stderr)\n        except (SSLError, MaxRetryError, requests.ConnectionError) as e:\n            if attempt == max_retries:\n                print(f\"ERROR: External source inaccessible after {max_retries + 1} attempts: {url}\", file=sys.stderr)\n                return False\n            print(f\"RETRY {attempt + 1}\u002F{max_retries}: {str(e)}\", file=sys.stderr)\n    \n    return False\n```\n\n## When to Use This Skill\n\nUse validated Python execution for spreadsheet operations when:\n\n- **Source data must be verified** before processing begins\n- Reading or writing complex Excel files with multiple sheets\n- External data sources (APIs, websites) must be accessed first\n- Applying formulas, formatting, or data transformations\n- Working with `openpyxl`, `pandas`, or similar libraries\n- The operation involves multiple steps that could exceed agent step limits\n- You need precise control over error handling and debugging\n- **Fallback data sources** should be identified if primary sources fail\n\n## Handling Inaccessible Data Sources\n\n### Protocol for Failed Data Access\n\n1. **Document the failure** with specific error messages\n2. **Identify alternative sources** (see Alternative Sources section below)\n3. **Report the blockage** clearly before attempting workarounds\n4. **Limit retry attempts** to 3 before escalating\n\n### Alternative Data Source Identification\n\nWhen primary data sources are inaccessible:\n\n```python\nALTERNATIVE_SOURCES = {\n    'epa_water_data': [\n        'https:\u002F\u002Fdataservices.epa.illinois.gov\u002Fswap',  # Primary\n        'https:\u002F\u002Fwww.epa.gov\u002Fsafewater\u002Fdata-and-reports',  # Federal fallback\n        'https:\u002F\u002Fwaterdata.usgs.gov\u002Fnwis',  # USGS fallback\n    ],\n    'financial_data': [\n        'internal_database.xlsx',  # Primary\n        'backup_financial_data.csv',  # Local backup\n        'request_from_stakeholder',  # Manual acquisition\n    ]\n}\n\ndef try_alternative_sources(source_key):\n    \"\"\"Iterate through alternative sources until one succeeds.\"\"\"\n    alternatives = ALTERNATIVE_SOURCES.get(source_key, [])\n    \n    for i, source in enumerate(alternatives):\n        print(f\"Attempting alternative {i + 1}\u002F{len(alternatives)}: {source}\")\n        if source.startswith('http'):\n            if validate_external_source(source):\n                return source\n        else:\n            if Path(source).exists():\n                print(f\"SUCCESS: Alternative source found: {source}\")\n                return source\n    \n    print(f\"ERROR: All alternatives exhausted for {source_key}\", file=sys.stderr)\n    return None\n```\n\n### Error Reporting Protocol\n\n```python\ndef report_data_access_failure(source, error_type, alternatives_tried=0):\n    \"\"\"Standardized error reporting for data access failures.\"\"\"\n    error_report = {\n        'timestamp': datetime.now().isoformat(),\n        'source': source,\n        'error_type': error_type,\n        'alternatives_tried': alternatives_tried,\n        'action_required': 'Manual data acquisition or source configuration update'\n    }\n    \n    print(\"=\" * 60, file=sys.stderr)\n    print(\"DATA ACCESS FAILURE REPORT\", file=sys.stderr)\n    print(\"=\" * 60, file=sys.stderr)\n    for key, value in error_report.items():\n        print(f\"{key}: {value}\", file=sys.stderr)\n    print(\"=\" * 60, file=sys.stderr)\n    \n    return error_report\n```\n\n## Why Direct Execution?\n\nThe `shell_agent` tool can:\n\n- Hit maximum step limits on complex multi-step operations\n- Produce unexplained errors on formatting operations\n- Fail on intricate spreadsheet reads\u002Fwrites due to iterative parsing\n- Fail to parse heredoc syntax correctly, causing 'unknown error' failures\n\nDirect `run_shell` with Python is more reliable because it:\n\n- Executes in a single step with no iteration limits\n- Provides clearer, immediate error messages\n- Handles complex operations without step constraints\n- Gives full control over library imports and execution flow\n- Writing scripts to `.py` files first avoids shell_agent parsing issues with heredocs\n\n## How to Use\n\n### Recommended Pattern: Validate Then Execute\n\n```bash\n# Step 1: Write validation script\ncat > validate_sources.py \u003C\u003C 'EOF'\nimport sys\nfrom pathlib import Path\n\nsources = ['input.xlsx', 'config.json']\nmissing = [s for s in sources if not Path(s).exists()]\n\nif missing:\n    print(f\"BLOCKED: Missing sources: {missing}\", file=sys.stderr)\n    sys.exit(1)\n\nprint(\"VALIDATED: All sources available\")\nEOF\n\n# Step 2: Run validation\npython3 validate_sources.py || exit 1\n\n# Step 3: Write processing script\ncat > process_spreadsheet.py \u003C\u003C 'EOF'\nimport openpyxl\n# Your spreadsheet code here\nEOF\n\n# Step 4: Execute processing\npython3 process_spreadsheet.py\n\n# Step 5: Clean up (optional)\nrm validate_sources.py\n```\n\n### Complete Workflow Example\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nComplete workflow: Validate -> Process -> Report\n\"\"\"\nimport sys\nfrom pathlib import Path\nfrom datetime import datetime\nfrom openpyxl import load_workbook\n\ndef main():\n    # PHASE 1: Validation\n    print(f\"[{datetime.now().isoformat()}] Starting validation...\")\n    \n    source_file = 'input_data.xlsx'\n    if not Path(source_file).exists():\n        print(f\"ERROR: Source file not found: {source_file}\", file=sys.stderr)\n        # Check for alternatives\n        for alt in ['backup_input.xlsx', 'data_backup.csv']:\n            if Path(alt).exists():\n                print(f\"FALLBACK: Using alternative: {alt}\")\n                source_file = alt\n                break\n        else:\n            print(\"ERROR: No alternative sources available\", file=sys.stderr)\n            sys.exit(1)\n    \n    # PHASE 2: Processing\n    print(f\"[{datetime.now().isoformat()}] Processing {source_file}...\")\n    try:\n        wb = load_workbook(source_file)\n        ws = wb.active\n        \n        # Your operations here\n        for row in ws.iter_rows(min_row=2):\n            pass  # Process data\n        \n        wb.save('output.xlsx')\n        print(f\"SUCCESS: Processed {ws.max_row - 1} rows\")\n        \n    except Exception as e:\n        print(f\"ERROR: Processing failed: {str(e)}\", file=sys.stderr)\n        sys.exit(1)\n    \n    # PHASE 3: Cleanup\n    print(f\"[{datetime.now().isoformat()}] Complete\")\n\nif __name__ == '__main__':\n    main()\n```\n\n## Best Practices\n\n1. **ALWAYS validate sources first** before any spreadsheet operations\n2. **Prefer file-based execution** for complex scripts: write to `.py` file first, then execute via `run_shell`\n3. **Identify 2-3 alternative sources** for critical data before starting\n4. **Import only needed libraries** to reduce execution time\n5. **Print clear success\u002Ferror messages** for debugging\n6. **Save intermediate results** for complex multi-step transformations\n7. **Test with small data** before scaling to large spreadsheets\n8. **Use pandas for data manipulation** and openpyxl for formatting when both are needed\n9. **Clean up temporary script files** after execution if they won't be reused\n10. **Document all access failures** with timestamps and error details\n\n## When NOT to Use This Skill\n\n- Simple single-cell reads\u002Fwrites (use shell_agent or basic commands)\n- Operations that require interactive user input\n- Tasks where you need the agent to iteratively refine the approach\n- When source data is guaranteed available (skip validation overhead)\n\n## Common Libraries\n\n| Library | Best For |\n|---------|----------|\n| `openpyxl` | Reading\u002Fwriting .xlsx files, formatting, formulas |\n| `pandas` | Data manipulation, analysis, merging datasets |\n| `xlrd` | Reading older .xls files (read-only) |\n| `xlsxwriter` | Creating new .xlsx files with advanced formatting |\n| `requests` | Validating external API\u002Fdata sources |\n| `pathlib` | Cross-platform file path validation |\n\n## Troubleshooting\n\n**Issue**: Heredoc syntax fails with 'unknown error' when using shell_agent\n- **Solution**: Write the Python script to a `.py` file first, then execute it with `python3 script.py`. This pattern is significantly more reliable than inline heredoc execution when shell_agent is the executor.\n\n**Issue**: Source data validation fails\n- **Solution**: \n  1. Check file paths are absolute or relative to working directory\n  2. Verify file permissions with `ls -la`\n  3. Try alternative sources from your fallback list\n  4. Report the failure with complete error details before proceeding\n\n**Issue**: External data source inaccessible (SSL\u002Fproxy errors)\n- **Solution**:\n  1. Try HTTP instead of HTTPS if appropriate\n  2. Disable SSL verification temporarily: `requests.get(url, verify=False)`\n  3. Check proxy settings in environment variables\n  4. **After 3 failed attempts, switch to alternative source or report blockage**\n  5. Do NOT exhaust 30+ iterations on a single inaccessible source\n\n**Issue**: FileNotFoundError\n- **Solution**: Verify the file path is absolute or relative to the working directory; check for alternative backup files\n\n**Issue**: PermissionError\n- **Solution**: Ensure the file is not open in another application; check file permissions\n\n**Issue**: MemoryError on large files\n- **Solution**: Process data in chunks using pandas `chunksize` parameter\n\n**Issue**: Formatting not applying\n- **Solution**: Ensure you're modifying cell styles before saving, and use `.copy()` for style objects\n\n**Issue**: Data validation passes but processing fails\n- **Solution**: Add more detailed integrity checks (column types, value ranges, row counts)\n","# Validated Python Execution for Spreadsheet Tasks\n\n## Pre-Execution Data Validation\n\n**CRITICAL**: Before attempting any spreadsheet operations, validate that your source data is accessible and complete.\n\n### Step 1: Verify Data Source Availability\n\n```python\nimport os\nimport sys\nfrom pathlib import Path\n\ndef validate_source_data(source_paths):\n    \"\"\"Validate all required data sources before processing.\"\"\"\n    missing = []\n    inaccessible = []\n    \n    for path in source_paths:\n        p = Path(path)\n        if not p.exists():\n            missing.append(str(path))\n        elif not os.access(path, os.R_OK):\n            inaccessible.append(str(path))\n    \n    if missing:\n        print(f\"ERROR: Missing data sources: {', '.join(missing)}\", file=sys.stderr)\n        return False\n    if inaccessible:\n        print(f\"ERROR: Inaccessible data sources: {', '.join(inaccessible)}\", file=sys.stderr)\n        return False\n    \n    print(f\"VALIDATED: {len(source_paths)} source(s) available\")\n    return True\n\n# Usage\nsources = ['input.xlsx', 'reference_data.csv']\nif not validate_source_data(sources):\n    sys.exit(1)\n```\n\n### Step 2: Verify Data Integrity\n\n```python\nimport pandas as pd\nfrom openpyxl import load_workbook\n\ndef validate_spreadsheet_integrity(file_path, required_sheets=None, required_columns=None):\n    \"\"\"Check spreadsheet structure before processing.\"\"\"\n    try:\n        # Check file is readable\n        wb = load_workbook(file_path, read_only=True)\n        \n        # Verify required sheets exist\n        if required_sheets:\n            missing_sheets = [s for s in required_sheets if s not in wb.sheetnames]\n            if missing_sheets:\n                print(f\"ERROR: Missing sheets: {missing_sheets}\", file=sys.stderr)\n                wb.close()\n                return False\n        \n        # Verify required columns (sample first sheet)\n        if required_columns:\n            ws = wb.active\n            headers = [cell.value for cell in ws[1]]\n            missing_cols = [c for c in required_columns if c not in headers]\n            if missing_cols:\n                print(f\"ERROR: Missing columns: {missing_cols}\", file=sys.stderr)\n                wb.close()\n                return False\n        \n        wb.close()\n        print(f\"VALIDATED: Spreadsheet structure OK\")\n        return True\n        \n    except Exception as e:\n        print(f\"ERROR: Cannot validate spreadsheet: {str(e)}\", file=sys.stderr)\n        return False\n```\n\n### Step 3: External Data Source Verification\n\nFor data retrieved from APIs, websites, or external services:\n\n```python\nimport requests\nfrom urllib3.exceptions import SSLError, MaxRetryError\n\ndef validate_external_source(url, timeout=30, max_retries=2):\n    \"\"\"Verify external data source is accessible.\"\"\"\n    for attempt in range(max_retries + 1):\n        try:\n            response = requests.head(url, timeout=timeout, allow_redirects=True)\n            if response.status_code == 200:\n                print(f\"VALIDATED: External source accessible ({url})\")\n                return True\n            else:\n                print(f\"WARNING: External source returned {response.status_code}\", file=sys.stderr)\n        except (SSLError, MaxRetryError, requests.ConnectionError) as e:\n            if attempt == max_retries:\n                print(f\"ERROR: External source inaccessible after {max_retries + 1} attempts: {url}\", file=sys.stderr)\n                return False\n            print(f\"RETRY {attempt + 1}\u002F{max_retries}: {str(e)}\", file=sys.stderr)\n    \n    return False\n```\n\n## When to Use This Skill\n\nUse validated Python execution for spreadsheet operations when:\n\n- **Source data must be verified** before processing begins\n- Reading or writing complex Excel files with multiple sheets\n- External data sources (APIs, websites) must be accessed first\n- Applying formulas, formatting, or data transformations\n- Working with `openpyxl`, `pandas`, or similar libraries\n- The operation involves multiple steps that could exceed agent step limits\n- You need precise control over error handling and debugging\n- **Fallback data sources** should be identified if primary sources fail\n\n## Handling Inaccessible Data Sources\n\n### Protocol for Failed Data Access\n\n1. **Document the failure** with specific error messages\n2. **Identify alternative sources** (see Alternative Sources section below)\n3. **Report the blockage** clearly before attempting workarounds\n4. **Limit retry attempts** to 3 before escalating\n\n### Alternative Data Source Identification\n\nWhen primary data sources are inaccessible:\n\n```python\nALTERNATIVE_SOURCES = {\n    'epa_water_data': [\n        'https:\u002F\u002Fdataservices.epa.illinois.gov\u002Fswap',  # Primary\n        'https:\u002F\u002Fwww.epa.gov\u002Fsafewater\u002Fdata-and-reports',  # Federal fallback\n        'https:\u002F\u002Fwaterdata.usgs.gov\u002Fnwis',  # USGS fallback\n    ],\n    'financial_data': [\n        'internal_database.xlsx',  # Primary\n        'backup_financial_data.csv',  # Local backup\n        'request_from_stakeholder',  # Manual acquisition\n    ]\n}\n\ndef try_alternative_sources(source_key):\n    \"\"\"Iterate through alternative sources until one succeeds.\"\"\"\n    alternatives = ALTERNATIVE_SOURCES.get(source_key, [])\n    \n    for i, source in enumerate(alternatives):\n        print(f\"Attempting alternative {i + 1}\u002F{len(alternatives)}: {source}\")\n        if source.startswith('http'):\n            if validate_external_source(source):\n                return source\n        else:\n            if Path(source).exists():\n                print(f\"SUCCESS: Alternative source found: {source}\")\n                return source\n    \n    print(f\"ERROR: All alternatives exhausted for {source_key}\", file=sys.stderr)\n    return None\n```\n\n### Error Reporting Protocol\n\n```python\ndef report_data_access_failure(source, error_type, alternatives_tried=0):\n    \"\"\"Standardized error reporting for data access failures.\"\"\"\n    error_report = {\n        'timestamp': datetime.now().isoformat(),\n        'source': source,\n        'error_type': error_type,\n        'alternatives_tried': alternatives_tried,\n        'action_required': 'Manual data acquisition or source configuration update'\n    }\n    \n    print(\"=\" * 60, file=sys.stderr)\n    print(\"DATA ACCESS FAILURE REPORT\", file=sys.stderr)\n    print(\"=\" * 60, file=sys.stderr)\n    for key, value in error_report.items():\n        print(f\"{key}: {value}\", file=sys.stderr)\n    print(\"=\" * 60, file=sys.stderr)\n    \n    return error_report\n```\n\n## Why Direct Execution?\n\nThe `shell_agent` tool can:\n\n- Hit maximum step limits on complex multi-step operations\n- Produce unexplained errors on formatting operations\n- Fail on intricate spreadsheet reads\u002Fwrites due to iterative parsing\n- Fail to parse heredoc syntax correctly, causing 'unknown error' failures\n\nDirect `run_shell` with Python is more reliable because it:\n\n- Executes in a single step with no iteration limits\n- Provides clearer, immediate error messages\n- Handles complex operations without step constraints\n- Gives full control over library imports and execution flow\n- Writing scripts to `.py` files first avoids shell_agent parsing issues with heredocs\n\n## How to Use\n\n### Recommended Pattern: Validate Then Execute\n\n```bash\n# Step 1: Write validation script\ncat > validate_sources.py \u003C\u003C 'EOF'\nimport sys\nfrom pathlib import Path\n\nsources = ['input.xlsx', 'config.json']\nmissing = [s for s in sources if not Path(s).exists()]\n\nif missing:\n    print(f\"BLOCKED: Missing sources: {missing}\", file=sys.stderr)\n    sys.exit(1)\n\nprint(\"VALIDATED: All sources available\")\nEOF\n\n# Step 2: Run validation\npython3 validate_sources.py || exit 1\n\n# Step 3: Write processing script\ncat > process_spreadsheet.py \u003C\u003C 'EOF'\nimport openpyxl\n# Your spreadsheet code here\nEOF\n\n# Step 4: Execute processing\npython3 process_spreadsheet.py\n\n# Step 5: Clean up (optional)\nrm validate_sources.py\n```\n\n### Complete Workflow Example\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nComplete workflow: Validate -> Process -> Report\n\"\"\"\nimport sys\nfrom pathlib import Path\nfrom datetime import datetime\nfrom openpyxl import load_workbook\n\ndef main():\n    # PHASE 1: Validation\n    print(f\"[{datetime.now().isoformat()}] Starting validation...\")\n    \n    source_file = 'input_data.xlsx'\n    if not Path(source_file).exists():\n        print(f\"ERROR: Source file not found: {source_file}\", file=sys.stderr)\n        # Check for alternatives\n        for alt in ['backup_input.xlsx', 'data_backup.csv']:\n            if Path(alt).exists():\n                print(f\"FALLBACK: Using alternative: {alt}\")\n                source_file = alt\n                break\n        else:\n            print(\"ERROR: No alternative sources available\", file=sys.stderr)\n            sys.exit(1)\n    \n    # PHASE 2: Processing\n    print(f\"[{datetime.now().isoformat()}] Processing {source_file}...\")\n    try:\n        wb = load_workbook(source_file)\n        ws = wb.active\n        \n        # Your operations here\n        for row in ws.iter_rows(min_row=2):\n            pass  # Process data\n        \n        wb.save('output.xlsx')\n        print(f\"SUCCESS: Processed {ws.max_row - 1} rows\")\n        \n    except Exception as e:\n        print(f\"ERROR: Processing failed: {str(e)}\", file=sys.stderr)\n        sys.exit(1)\n    \n    # PHASE 3: Cleanup\n    print(f\"[{datetime.now().isoformat()}] Complete\")\n\nif __name__ == '__main__':\n    main()\n```\n\n## Best Practices\n\n1. **ALWAYS validate sources first** before any spreadsheet operations\n2. **Prefer file-based execution** for complex scripts: write to `.py` file first, then execute via `run_shell`\n3. **Identify 2-3 alternative sources** for critical data before starting\n4. **Import only needed libraries** to reduce execution time\n5. **Print clear success\u002Ferror messages** for debugging\n6. **Save intermediate results** for complex multi-step transformations\n7. **Test with small data** before scaling to large spreadsheets\n8. **Use pandas for data manipulation** and openpyxl for formatting when both are needed\n9. **Clean up temporary script files** after execution if they won't be reused\n10. **Document all access failures** with timestamps and error details\n\n## When NOT to Use This Skill\n\n- Simple single-cell reads\u002Fwrites (use shell_agent or basic commands)\n- Operations that require interactive user input\n- Tasks where you need the agent to iteratively refine the approach\n- When source data is guaranteed available (skip validation overhead)\n\n## Common Libraries\n\n| Library | Best For |\n|---------|----------|\n| `openpyxl` | Reading\u002Fwriting .xlsx files, formatting, formulas |\n| `pandas` | Data manipulation, analysis, merging datasets |\n| `xlrd` | Reading older .xls files (read-only) |\n| `xlsxwriter` | Creating new .xlsx files with advanced formatting |\n| `requests` | Validating external API\u002Fdata sources |\n| `pathlib` | Cross-platform file path validation |\n\n## Troubleshooting\n\n**Issue**: Heredoc syntax fails with 'unknown error' when using shell_agent\n- **Solution**: Write the Python script to a `.py` file first, then execute it with `python3 script.py`. This pattern is significantly more reliable than inline heredoc execution when shell_agent is the executor.\n\n**Issue**: Source data validation fails\n- **Solution**: \n  1. Check file paths are absolute or relative to working directory\n  2. Verify file permissions with `ls -la`\n  3. Try alternative sources from your fallback list\n  4. Report the failure with complete error details before proceeding\n\n**Issue**: External data source inaccessible (SSL\u002Fproxy errors)\n- **Solution**:\n  1. Try HTTP instead of HTTPS if appropriate\n  2. Disable SSL verification temporarily: `requests.get(url, verify=False)`\n  3. Check proxy settings in environment variables\n  4. **After 3 failed attempts, switch to alternative source or report blockage**\n  5. Do NOT exhaust 30+ iterations on a single inaccessible source\n\n**Issue**: FileNotFoundError\n- **Solution**: Verify the file path is absolute or relative to the working directory; check for alternative backup files\n\n**Issue**: PermissionError\n- **Solution**: Ensure the file is not open in another application; check file permissions\n\n**Issue**: MemoryError on large files\n- **Solution**: Process data in chunks using pandas `chunksize` parameter\n\n**Issue**: Formatting not applying\n- **Solution**: Ensure you're modifying cell styles before saving, and use `.copy()` for style objects\n\n**Issue**: Data validation passes but processing fails\n- **Solution**: Add more detailed integrity checks (column types, value ranges, row counts)\n",{"name":5,"description":7},"main","0650921d63895de3997bc81f1ff1d0ac67032072","gdpval_bench\u002Fskills\u002Fspreadsheet-direct-python-enhanced-enhanced-2e6773","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution","https:\u002F\u002Fgithub.com\u002FUF-gzj","2026-04-16 09:31:03",{"source":8,"skillName":5,"commands":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add UF-gzj\u002Fopenspace-claude-evolution --skill spreadsheet-source-validated",{"tool":54,"command":55},"bunx","bunx skills add UF-gzj\u002Fopenspace-claude-evolution --skill spreadsheet-source-validated",{"tool":57,"command":58},"pnpm","pnpm dlx skills add UF-gzj\u002Fopenspace-claude-evolution --skill spreadsheet-source-validated","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fspreadsheet-direct-python-enhanced-enhanced-2e6773\u002FSKILL.md",true,[62],{"path":63,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":66,"sourceHtmlUrl":67},".skill_id","OTHER","其他",64,"https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fspreadsheet-direct-python-enhanced-enhanced-2e6773\u002F.skill_id",[69,92,107,116,144,160],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":37},"01M6XCCXD3NCM2YKR3WNGBASPC","write-special-chars-ts-check","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, plus a reliable TypeScript type-checking step that filters output to only the newly-written files to avoid being misled by pre-existing errors.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[76,77,78,79,80,81,82,83,36,84,85,86,87,88,89,90,91,26],"check","write","write special chars ts check","typescript","filters","characters","Existing","type-checking","errors","script","output","type","files","only","template","file",{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":37},"01M6XCCT7E3J922Q345PBGSHPN","write-special-chars-readback","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, with mandatory post-write verification via read_file and cleanup of \u002Ftmp helper scripts.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[99,100,77,91,101,26,102,103,34,104,105,90,106,35,81,36,85],"readback","write special chars readback","helper","post","via","cleanup","read","verification",{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":37},"01M6XCCMQX1R8B6FECWB3P63T7","write-special-chars-heredoc","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) by using a Python heredoc script executed via shell.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[114,77,81,115,85,103,90,91,26,36],"write special chars heredoc","shell",{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":127,"publishedAt":37},"01M6XCCG41M994JJEX6VN52PEP","worldmonitor-reference","Curated architecture index of the WorldMonitor open-source dashboard. Reference for extracting patterns — vanilla TypeScript, Panel class hierarchy, service layer, CSS grid, API edge functions, refresh scheduler, and 60+ data source integrations.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[122],{"categoryNo":123,"categoryName":124,"taxonomyType":125,"taxonomyTypeDesc":126},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[128,129,130,131,132,79,133,134,135,136,24,36,137,138,139,140,141,142,143,29],"reference","worldmonitor","worldmonitor reference","architecture","dashboard","css","scheduler","layer","hierarchy","extracting","panel","patterns","edge functions","integrations","open","api",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":37},"01M6XCCCHWNKG2W4VH9E6A10HF","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[151,152,153,154,36,155,35,156,157,158,159],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":161,"name":162,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":166,"publishedAt":37},"01M6XCC7X8PKMR2DEW91XGHYSV","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[167,168,169,170,171,172,91,173,174,175],"directory","verify directory structure","structure","verify","access","first","issues","diagnose","file access"]