Leverage shell_agent for autonomous file creation and modification with automatic tool selection and error recovery
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-shell-agent-file-ops-19de791b3c9b ,按照其中的说明把「shell-agent-file-ops」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Use shell_agent for file operations when you want the tool to autonomously decide how to accomplish the task (Python vs Bash, which commands to use, error recovery) rather than manually selecting specific tools like write_file or run_shell.
Use this pattern when:
Delegate to shell_agent with a clear natural-language task description.
Task description to shell_agent:
Create a comprehensive SOAP note file containing four sections:
Subjective, Objective, Assessment, and Plan. Include all relevant
patient visit details in a professional medical format.
The shell_agent will:
Task description to shell_agent:
Update all configuration files in the config/ directory to add
a new setting "timeout: 300" under the general section.
Task description to shell_agent:
Create a project structure with README.md, src/main.py, and
tests/test_main.py. Include appropriate content in each file
based on a Python data processing project template.
Be specific about content requirements - Describe what should be in the file(s), not just that files should be created.
Include format specifications - Mention desired formats (markdown, JSON, CSV, etc.) when relevant.
Specify file locations - Include paths when files should be in specific directories.
Let shell_agent handle complexity - Don't pre-decide the implementation approach; trust the autonomous selection.
Check the output - Review what shell_agent created to ensure it meets requirements.
Use direct tools instead when:
run_shellwrite_file directlywrite_file❌ Don't over-specify the implementation:
Use Python to write a file called notes.md with this content...
✅ Do describe the desired outcome:
Create a notes.md file with comprehensive documentation about...
❌ Don't use shell_agent for simple direct operations:
Write "hello" to hello.txt
✅ Do use write_file directly for simple cases:
write_file(path="hello.txt", content="hello")
This pattern shifts focus from implementation mechanics to task intent, leveraging shell_agent's autonomous decision-making for file operations that benefit from intelligent tool selection and automatic error recovery.