robust-file-creation
What it does
This skill gives the AI agent a manual way to create project folders and files when its automated tools break. It is for people who need a set of folders and files built reliably.
When to use it
- ✓When the code sandbox or helper agent fails on creating folders or files.
- ✓When you need a nested folder structure with several files inside it.
- ✓When progress on a project is blocked by file tool errors.
Skill link
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/robust-file-creation/SKILL.mdCopy 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
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Create the project folders and starter files for my website. The automatic tools keep failing on this.”
5 new skills a week. 1 minute to read.
How it works
The agent makes each folder with mkdir -p, which also creates any parent folders. It then writes each file one at a time, and it can list the result to confirm the structure is correct.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Robust File Creation Strategy
When creating complex project structures, automated tools like execute_code_sandbox and shell_agent may fail with 'unknown error' on filesystem operations. This skill provides a reliable fallback strategy using explicit shell commands.
When to Use
Apply this pattern when:
execute_code_sandboxfails with unknown error on file/directory creationshell_agentfails to complete filesystem operations after retries- You need to create nested directory structures with multiple files
- Task progress is blocked by filesystem tool failures
Fallback Procedure
Step 1: Detect the Failure
When either execute_code_sandbox or shell_agent fails on filesystem operations (especially after automatic retries), immediately switch to the manual hybrid approach.
Step 2: Create Directories Explicitly
Use run_shell with mkdir -p for each required directory:
run_shell command="mkdir -p /path/to/nested/directory"
The -p flag ensures parent directories are created automatically.
Step 3: Write Files Individually
Use write_file tool for each file with explicit path and content:
write_file path="/path/to/file.py" content="..."
Do not attempt to batch multiple file creations in a single operation.
Step 4: Verify Creation (Optional)
Confirm the structure was created correctly:
run_shell command="ls -la /path/to/directory"
# or
run_shell command="tree /path/to/directory"
Complete Example Flow
[execute_code_sandbox fails on project setup]
↓
[run_shell mkdir -p src/components]
[run_shell mkdir -p src/utils]
[run_shell mkdir -p tests]
↓
[write_file path="src/main.py" content="..."]
[write_file path="src/components/widget.py" content="..."]
[write_file path="tests/test_main.py" content="..."]
↓
[run_shell ls -la src/ # verify]
Best Practices
- Create all directories first before writing any files to avoid path errors
- Write files one at a time rather than attempting batch operations
- Use absolute or clearly relative paths to avoid ambiguity
- Verify after creation when working on critical deliverables
- Document the structure in comments or SKILL.md if it's complex
Why This Works
run_shellexecutes commands directly without the abstraction layer that can failwrite_fileis a primitive operation with fewer failure modes- Separating directory creation from file writing isolates potential failure points
- Explicit commands are easier to debug when issues occur
Anti-Patterns to Avoid
❌ Don't keep retrying the same failing execute_code_sandbox command
❌ Don't attempt to create complex nested structures in a single Python script via sandbox
❌ Don't assume directories exist before writing files to them
❌ Don't skip verification on critical project scaffolding
FAQ
Why use mkdir with the -p flag?
The -p flag creates the parent folders too, so the whole path is made in one command.
Why write files one at a time?
The skill says not to batch file creations, which keeps each step simple to check.
Can I check the result afterward?
Yes, the skill suggests a listing command to confirm the folders and files exist.
Details
Original description by the author
Fallback to run_shell and write_file when execute_code_sandbox or shell_agent fail on filesystem operations
repo: HKUDS/AgentPilot
Popularity
- GitHub stars
- 7.8k
- Ranking position
- #12975
- License
- MIT
- Updated
- 11/1/2026
Comments
- …
More skills from this repository
agentpilot
7.8kHelps your agent improve a project step by step by preparing a task and running the AgentPilot loop that proposes, tests and scores changes.
openspace
7.8kHelps your agent set up OpenSpace, a tool that stores and fetches agent skills, and connect it to your AI app through MCP.
rsi-arena
7.8kHelps your agent set up and run standard AI benchmark tests, such as AIME and Terminal-Bench, to compare different improvement methods.
experiment-guide
7.8kHelps your agent plan small experiments, read their results and record findings while it investigates how to improve a program.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.