fallback-file-ops
Use run_shell as fallback when execute_code_sandbox or shell_agent fail on filesystem operations
适合你,如果文件操作经常因沙箱限制而失败
/ 通过 npx 安装 校验哈希
npx oh-my-skill add hkuds/openspace/fallback-file-ops/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- hkuds/openspace/fallback-file-ops/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify hkuds/openspace/fallback-file-ops安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
6920GitHub stars
~593上下文体积 · 单文件
索引托管
怎么用
商店整理自技能原文 · 版本 2c5cc40 · 表述以原文为准它做什么
当使用代码沙箱或shell工具创建文件/目录失败时,Claude会自动改用run_shell命令直接执行,并验证操作是否成功。
什么时候触发
当execute_code_sandbox或shell_agent返回'unknown error',或文件操作无声失败(如目录未创建)时触发。
装好后可以这样说
Claude会用test命令通过run_shell验证。
技能原文 SKILL.md
Fallback File Operations
Purpose
When execute_code_sandbox or shell_agent fail with 'unknown error' on filesystem operations, fall back to run_shell with explicit mkdir and file write commands. This hybrid approach is more reliable for creating complex project structures.
When to Apply
execute_code_sandboxreturns 'unknown error' on file/directory creationshell_agentfails to write files or create nested directories- You need to create complex project structures with multiple levels
Procedure
Step 1: Detect Tool Failure
Monitor for these failure patterns:
- Error message contains "unknown error"
- File operations silently fail (file not created)
- Directory creation returns success but directory doesn't exist
Step 2: Switch to run_shell
When failures occur, immediately switch to run_shell for filesystem operations:
# Create directory structure explicitly run_shell: mkdir -p /path/to/nested/directory # Write files using shell redirection or echo run_shell: echo "content" > /path/to/file.txt # Or use cat with heredoc for multi-line files run_shell: cat > /path/to/file.txt << 'EOF' line 1 line 2 EOF
Step 3: Verify Creation
After each operation, verify the file/directory was created:
run_shell: ls -la /path/to/created/item run_shell: test -f /path/to/file && echo "File exists" run_shell: test -d /path/to/dir && echo "Directory exists"
Step 4: Continue with Hybrid Approach
- Use
run_shellfor all filesystem operations (mkdir, write, copy, move) - Continue using
execute_code_sandboxorshell_agentfor code execution, compilation, or other non-filesystem tasks - Document which tool handles which operation for clarity
Example: Creating Project Structure
# Failed attempt with execute_code_sandbox execute_code_sandbox: create directory src/components # Fallback with run_shell run_shell: mkdir -p src/components run_shell: mkdir -p src/utils run_shell: mkdir -p tests/unit run_shell: echo "// Component file" > src/components/Button.tsx run_shell: echo "// Utility file" > src/utils/helpers.ts
Best Practices
- Be explicit: Always use full paths or confirm working directory
- Create parent directories: Use
mkdir -pfor nested structures - Verify before proceeding: Check files exist before dependent operations
- Log tool switches: Note when you fall back to run_shell for debugging
- Batch operations: Group related file operations in consecutive run_shell calls
Common Pitfalls
- Don't assume filesystem state after tool failure
- Don't mix tools for the same file operation (pick one and stick with it)
- Don't skip verification steps when using fallback
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →
评论
登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。
…