Skip to content
cccskills
FreePublished on GitHub

fallback-file-ops

Recover from failed file and directory operations by switching to run_shell, a shell command tool. Create nested folders, write files, and verify each result before continuing with tasks that depend on those files.

OriginalShow the original description

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

See how to install

Good for

  • Retry file creation after an unknown error
  • Create nested project folders explicitly
  • Write files containing multiple lines
  • Confirm files and folders exist before continuing

Files included (2)

  • SKILL.md2.8 KB
  • .skill_id31 B

SKILL.md (original)

Review the instructions the agent will receive before you install.

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

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Prepare audio stems, the separate parts of a track, for mixing by matching their durations with silence, loops, or crossfades. Verify each generated and processed file before moving to the next production step.

  • Match audio parts with different durations
  • Extend drums and melodic parts using suitable methods
  • Check audio specifications before mixing
HKUDS/OpenSpace7.8KUpdated Aug 13, 2026

Produce audio in separate stems, meaning individual instrument tracks, and verify each output as you go. Align track lengths with silence, loops, or crossfades, then apply effects, mix a master, and package the files.

  • Align instrument tracks to a reference audio file
  • Choose how to extend tracks that are too short
  • Verify audio properties after generation and effects
HKUDS/OpenSpace7.8KUpdated Aug 13, 2026

Build serverless endpoints that relay external API requests for a dashboard while keeping API keys on the server. Includes Vercel examples for input checks, caching, cross-origin access, and consistent JSON responses.

  • Connect a dashboard to external APIs without exposing API keys
  • Create endpoints for stock quotes and news
  • Standardize API responses and error handling
HKUDS/OpenSpace7.8KUpdated Aug 13, 2026

Produce a master track and separate audio parts through a structured Python workflow. Apply filters and reverb, export WAV files with consistent settings, package them in a ZIP archive, and check that the deliverables meet the requested specifications.

  • Export a master track with separate audio parts
  • Apply filters and reverb to audio
  • Check duration and format across deliverables
HKUDS/OpenSpace7.8KUpdated Aug 13, 2026

Keep document creation moving when web searches and page retrieval repeatedly fail. The skill preserves the original task, uses the model’s existing knowledge, and clearly identifies information that could not be checked against external sources.

  • Continue drafting after repeated web retrieval failures
  • Preserve task requirements during network errors
  • Mark information that could not be externally verified
HKUDS/OpenSpace7.8KUpdated Aug 13, 2026

When Python execution repeatedly fails in execute_code_sandbox, use a file-based alternative: save the script, run it through the shell, and capture results or errors. The guidance covers paths, imports, timeouts, structured output, and optional cleanup.

  • Retry Python work through the shell after repeated sandbox failures
  • Run longer tasks with an adjusted timeout
  • Execute Python work that needs multiple files or system utilities
HKUDS/OpenSpace7.8KUpdated Aug 13, 2026

See all skills by HKUDS

Report a problem with this skill