robust-file-creation
ما الذي تفعله
تمنح هذه المهارة وكيل الذكاء الاصطناعي طريقة يدوية لإنشاء مجلدات مشروع وملفات عندما تتعطل أدواته الآلية. وهي مناسبة لمن يحتاج إلى بناء مجموعة من المجلدات والملفات بشكل موثوق.
متى تستخدمها
- ✓عندما تفشل بيئة الشيفرة أو الوكيل المساعد في إنشاء مجلدات أو ملفات.
- ✓عندما أحتاج إلى بنية مجلدات متداخلة فيها عدة ملفات.
- ✓عندما يتوقف تقدم مشروع بسبب أخطاء أدوات الملفات.
رابط المهارة
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/robust-file-creation/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“أنشئ مجلدات مشروع موقعي وملفات البداية الخاصة به. الأدوات الآلية تفشل باستمرار في هذا العمل.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يُنشئ الوكيل كل مجلد بالأمر 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
- آخر تحديث
- 1/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
agentpilot
7.8kيساعد وكيلك على تحسين مشروع خطوة بخطوة، بتجهيز مهمة وتشغيل حلقة AgentPilot التي تقترح التغييرات وتختبرها وتقيّمها.
openspace
7.8kيساعد وكيلك على إعداد OpenSpace، وهو أداة تخزن مهارات الوكلاء وتسترجعها، وربطه بتطبيق الذكاء الاصطناعي عبر MCP.
rsi-arena
7.8kيساعد وكيلك على إعداد اختبارات معيارية مثل AIME وTerminal-Bench وتشغيلها، لمقارنة طرق التحسين المختلفة.
experiment-guide
7.8kيساعد وكيلك على تخطيط تجارب صغيرة وقراءة نتائجها وتسجيل ما يتعلمه أثناء التحقيق في طرق تحسين برنامج.
مهارات مشابهة
diffs
394kيتيح لوكيلك إنتاج فرق تعديلات حقيقي يمكن مشاركته، كرابط عرض أو ملف صورة، بدلاً من ملخص مكتوب يدوياً.
coding-agent
394kيساعد وكيلك على تسليم مهمة برمجة كبيرة إلى Codex أو Claude Code أو OpenCode كعامل في الخلفية، ثم متابعة تقدمها.
gh-issues
394kيساعد وكيلك على إيجاد مشكلات GitHub واختيار ما ستعمل عليه، وفتح طلبات سحب بالإصلاحات، ومتابعة تعليقات المراجعة.