Skip to content
Skillpedia
General coding7.8k · #12881

fallback-file-ops

What it does

This skill is a fallback for making folders and files when higher-level tools return vague errors or silently fail. It is for people whose AI project setup keeps failing.

When to use it

  • ✓When the sandbox returns an unknown error while creating a file or folder.
  • ✓When a helper says it created a file, but the file is not actually there.
  • ✓When I need a nested project folder structure built correctly.

Skill link

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/fallback-file-ops/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/fallback-file-ops/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Create the project folder structure with several nested folders and files. The helper keeps failing, so please use the shell.”

5 new skills a week. 1 minute to read.

How it works

The AI switches to shell commands such as mkdir and redirected writes, then checks each item with ls or a test command to confirm it exists.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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_sandbox returns 'unknown error' on file/directory creation
  • shell_agent fails 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_shell for all filesystem operations (mkdir, write, copy, move)
  • Continue using execute_code_sandbox or shell_agent for 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

  1. Be explicit: Always use full paths or confirm working directory
  2. Create parent directories: Use mkdir -p for nested structures
  3. Verify before proceeding: Check files exist before dependent operations
  4. Log tool switches: Note when you fall back to run_shell for debugging
  5. 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
FAQ

How does the AI know a step failed?

It watches for unknown error messages, or files that do not appear after a claimed success.

Which commands are used?

Commands such as mkdir -p, echo or cat with a heredoc, plus ls or test to check the results.

Is verification required?

Yes, the guide says to verify each file or folder after it is created.

Details

Original description by the author

Use run_shell as fallback when execute_code_sandbox or shell_agent fail on filesystem operations

repo: HKUDS/AgentPilot

Popularity

GitHub stars
7.8k
Ranking position
#12881
License
MIT
Updated
11/1/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills