robust-file-creation
できること
このスキルは、自動のツールが壊れたときに、プロジェクトのフォルダとファイルを手作業で作るための方法をAIエージェントに与えます。フォルダとファイルの一式を確実に作る必要がある人向けです。
使う場面
- ✓コードのサンドボックスやヘルパーエージェントが、フォルダやファイルの作成で失敗するとき。
- ✓中に複数のファイルがある、入れ子のフォルダ構造が必要なとき。
- ✓ファイルのツールのエラーで、プロジェクトの進行が止まっているとき。
スキルのリンク
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/robust-file-creation/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“ウェブサイトのフォルダと最初のファイルを作ってください。自動のツールがこれで失敗し続けているので、シェルを使ってください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、mkdir -pで各フォルダを作ります。このコマンドは親のフォルダも作ります。その後、ファイルを一つずつ書き、構造が正しいかを確認するため一覧表示することもできます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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
よくある質問
mkdirに-pを付けるのはなぜですか?
-pを付けると親のフォルダも作られるので、パス全体を一つのコマンドで作れるからです。
ファイルを一つずつ書くのはなぜですか?
ファイルの作成をまとめないよう、スキルは述べています。こうすると、各ステップを確認しやすくなります。
結果は後で確認できますか?
はい。フォルダとファイルが存在するかを確かめるための一覧表示のコマンドを、スキルは勧めています。
詳細
作者による元の説明
Fallback to run_shell and write_file when execute_code_sandbox or shell_agent fail on filesystem operations
repo: HKUDS/AgentPilot
人気
- GitHubのスター
- 7.8k
- ランキング
- #12975
- ライセンス
- MIT
- 更新日
- 2026/11/1
コメント
- …
このリポジトリの他のスキル
agentpilot
7.8kエージェントが、作業を準備し、変更案を提案してテストし、評価するAgentPilotのループを実行することで、プロジェクトを段階的に改善できるよう支援します。
openspace
7.8kエージェントが、スキルを保存し取り出すツールであるOpenSpaceをセットアップし、MCPを通じてAIアプリに接続できるよう支援します。
rsi-arena
7.8kエージェントが、AIMEやTerminal-Benchなどの標準的なAIベンチマークテストをセットアップして実行し、異なる改善方法を比較できるよう支援します。
experiment-guide
7.8kエージェントが、プログラムを改善する方法を調べる間に、小さな実験を計画し、その結果を読み、発見を記録できるよう支援します。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。