跳到正文
Skillpedia
智能体7.8k · #12997

shell-agent-file-ops

它能做什么

这项技能帮助 AI 智能体把文件工作交给 shell 智能体,例如创建文档或更新配置文件。它适合希望说明需要什么、而不是说明怎么做的人。

适用场景

  • ✓当你需要创建或修改文件,而最佳方法并不明确的时候。
  • ✓当你希望文件任务具有自动错误处理和重试功能的时候。
  • ✓当你更愿意描述结果,而不是挑选具体工具的时候。

技能链接

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/shell-agent-file-ops/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/shell-agent-file-ops/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请更新我配置文件夹中的每个配置文件,添加 300 的超时设置。具体怎么做请让 shell 智能体自行判断。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会给 shell 智能体一项用自然语言描述的任务。shell 智能体会选择 Python 或 Bash,编写并运行代码,通过多轮重试处理错误,然后返回结果。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Shell Agent File Operations

Purpose

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.

When to Use

Use this pattern when:

  • You need to create, modify, or organize files
  • The optimal approach (Python script, Bash commands, direct file write) is unclear
  • You want automatic error handling and retry logic
  • You prefer to describe what to accomplish rather than how

How to Use

Basic Pattern

Delegate to shell_agent with a clear natural-language task description.

Example: Create a Document File

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:

  1. Decide whether to use Python or Bash
  2. Write and execute the appropriate code
  3. Handle any errors automatically (up to several retry rounds)
  4. Return the result

Example: Modify Existing Files

Task description to shell_agent:

Update all configuration files in the config/ directory to add
a new setting "timeout: 300" under the general section.

Example: Complex File Operations

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.

Best Practices

  1. Be specific about content requirements - Describe what should be in the file(s), not just that files should be created.

  2. Include format specifications - Mention desired formats (markdown, JSON, CSV, etc.) when relevant.

  3. Specify file locations - Include paths when files should be in specific directories.

  4. Let shell_agent handle complexity - Don't pre-decide the implementation approach; trust the autonomous selection.

  5. Check the output - Review what shell_agent created to ensure it meets requirements.

Comparison: When NOT to Use This Pattern

Use direct tools instead when:

  • You already know the exact command/script to run → use run_shell
  • You have the exact file content ready → use write_file directly
  • The operation is trivial (single-line file write) → use write_file
  • You need fine-grained control over the implementation

Anti-Patterns to Avoid

❌ 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")

Summary

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.

常见问题

它能同时修改多个文件吗?

可以。这项技能的示例会一次性更新某个文件夹中的所有配置文件。

它处理哪些类型的文件?

这项技能给出了文档、笔记和配置文件的例子。

我需要懂命令吗?

不需要。你描述任务,shell 智能体负责处理命令。

详情

作者的原始描述

Leverage shell_agent for autonomous file creation and modification with automatic tool selection and error recovery

repo: HKUDS/AgentPilot

热度

GitHub 星标
7.8k
排名
#12997
许可证
MIT
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能