‹ 首页

excel-creation-fallback

@hkuds · 收录于 5 天前 · 上游提交 1 周前

Use shell_agent as fallback when execute_code_sandbox fails for Excel file operations

适合你,如果需要在沙箱失败时仍能操作 Excel 文件

/ 通过 npx 安装 校验哈希
npx oh-my-skill add hkuds/openspace/excel-creation-fallback
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- hkuds/openspace/excel-creation-fallback
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify hkuds/openspace/excel-creation-fallback
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
6920GitHub stars
~758上下文体积 · 单文件
索引托管

怎么用

商店整理自技能原文 · 版本 2c5cc40 · 表述以原文为准
它做什么

当代码沙箱无法生成Excel文件时,Claude会自动改用shell_agent来处理:安装所需依赖、编写并运行代码、自动重试修复错误,最终生成文件。

什么时候触发

当用openpyxl等库在代码沙箱中创建或修改Excel文件失败(如导入错误、缺少依赖、反复出错)时触发。

装好后可以这样说
Claude会处理依赖和格式,确保文件可用。
Claude会自动安装openpyxl并编写代码生成。
技能原文 SKILL.md作者撰写 · MIT · 2c5cc40

Excel File Creation Fallback

When execute_code_sandbox fails for openpyxl or Excel operations, delegate to shell_agent which can autonomously handle dependency and environment issues.

When to Use
  • execute_code_sandbox fails with import errors for openpyxl or related libraries
  • The sandbox environment lacks required dependencies
  • You need to create or modify Excel files with complex requirements
  • Repeated sandbox execution failures for file I/O operations
Steps
Step 1: Attempt with execute_code_sandbox first

Try creating the Excel file using Python's openpyxl library in the code sandbox:

from openpyxl import Workbook

wb = Workbook()
ws = wb.active
ws.append(['Column1', 'Column2', 'Column3'])
wb.save('output.xlsx')
Step 2: If it fails, switch to shell_agent

Delegate the task to shell_agent with a clear, comprehensive task description:

Create an Excel file named 'output.xlsx' with the following structure:
- Sheet 1: Data with columns [Date, Metric, Value]
- Include sample data rows with realistic values
- Apply basic formatting (bold headers, cell borders)
- Add a summary section with totals or averages
- Save the file in the current directory
Step 3: Let shell_agent handle the environment

The shell_agent will:

  • Decide whether to use Python or Bash
  • Install dependencies if needed (e.g., pip install openpyxl)
  • Write and execute the code
  • Automatically retry and fix errors (up to several rounds)
  • Confirm the file was created successfully
Example Task Descriptions
Basic Excel file:
Create an Excel file named 'sales_report.xlsx' with headers: Date, Product, Quantity, Price, Total. Add 10 sample rows of data and a formula column for Total (Quantity * Price).
Complex Excel with formatting:
Create an Excel file with multiple sheets:
- Sheet 'Summary': Key metrics and totals
- Sheet 'Details': Full transaction data with columns [ID, Date, Customer, Amount, Status]
- Apply conditional formatting to highlight amounts over 1000
- Add borders to all cells and bold headers
Tiered pricing structure:
Create an Excel file with a tiered pricing table:
- Column A: Quantity thresholds (0, 100, 500, 1000)
- Column B: Unit price at each tier
- Column C: Discount percentage (e.g., 15% discount over 1000 units)
- Include a financial summary section with projections
Why This Pattern Works

shell_agent has several advantages over execute_code_sandbox for file creation tasks:

| Feature | execute_code_sandbox | shell_agent | |---------|---------------------|-------------| | Dependency installation | Manual/preset only | Autonomous | | Error recovery | Returns error | Auto-retries and fixes | | Tool selection | Python only | Python, Bash, or other | | Filesystem access | Sandbox-limited | Full workspace access | | Verification | None | Can verify file creation |

Troubleshooting

If shell_agent also struggles:

  1. Be more specific - Include exact column names, data types, and formatting requirements
  2. Provide sample data - Include example rows to clarify expected output
  3. Break it down - For complex files, request creation in stages
  4. Check permissions - Ensure the target directory is writable
Alternative Approaches

If shell_agent is unavailable or unsuitable:

  • Use run_shell with explicit commands (if you know the exact syntax)
  • Check for alternative libraries (xlsxwriter, pandas with openpyxl engine)
  • Use CSV as intermediate format, then convert to Excel
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。