Agent Skillszzatpku/AgentFactory › execute_shell_command

execute_shell_command

GitHub

提供执行标准 Bash shell 命令的能力,用于文件导航、读取及包安装等。需通过子代理间接调用,支持安全拦截与输出截断,适用于环境配置和基础系统交互任务。

skills/tools/shell_command/SKILL.md zzatpku/AgentFactory

Trigger Scenarios

需要执行文件系统操作如 ls, cat 需要安装 Python 依赖包如 pip install 需要运行非交互式 Shell 命令

Install

npx skills add zzatpku/AgentFactory --skill execute_shell_command -g -y
More Options

Non-standard path

npx skills add https://github.com/zzatpku/AgentFactory/tree/master/skills/tools/shell_command -g -y

Use without installing

npx skills use zzatpku/AgentFactory@execute_shell_command

指定 Agent (Claude Code)

npx skills add zzatpku/AgentFactory --skill execute_shell_command -a claude-code -g -y

安装 repo 全部 skill

npx skills add zzatpku/AgentFactory --all -g -y

预览 repo 内 skill

npx skills add zzatpku/AgentFactory --list

SKILL.md

Frontmatter
{
    "name": "execute_shell_command",
    "description": "Execute standard Bash shell commands in a non-interactive environment. Supports file system navigation, reading, pip installation and so on. The current work_dir for shell command executing will be a temp dir."
}

Shell Command Tool

⚠️ IMPORTANT RESTRICTION: You CANNOT use this tool directly! To execute shell commands, you MUST first create a subagent (using create_subagent skill) and then run it (using run_subagent skill). Direct execution of shell commands is not allowed.

execute_shell_command: A bridge to the local operating system shell. Allows execution of standard Bash commands.

Usage

from tools import execute_shell_command

# List files
output = execute_shell_command("ls -la")

# Read a file
content = execute_shell_command("cat -n README.md")

Parameters

Parameter Type Default Description
command str required The Bash command to execute

Returns

Returns a single string containing the command's standard output (stdout) and standard error (stderr) combined.

Note: 1. Safety Interception: Commands like rm, rmdir, shred are strictly forbidden and will return an error string. 2. Output Truncation: If the output exceeds 5000 characters, it will be truncated. Use head, tail, or grep for large files.

Example

from tools import execute_shell_command

# 1. Inspect current directory
print(execute_shell_command("ls -F"))

# 2. Install a package (if network is available)
print(execute_shell_command("pip install pandas"))

# 3. Read a specific part of a file (safe for large files)
print(execute_shell_command("head -n 20 data.csv"))

Tips

  • Non-Interactive: Do NOT use interactive tools like vim, nano, or python (without -c). The process will hang.
  • Reading Files: Prefer cat -n filename to see line numbers, which is helpful for editing later.
  • Large Files: Avoid cat on large files. Use head -n 50 filename to peek, or grep to search.
  • Environment: You are in a standard Bash environment. You can use pipes: ls -la | grep .py.
  • State: The working directory is persistent. cd folder works for subsequent commands.
  • Environment Setup: Use this tool to install Python packages and other dependencies needed by your subagent. For example: pip install playwright && playwright install chromium, pip install pandas, etc.

Version History

  • df92287 Current 2026-07-25 08:38

Same Skill Collection

skills/meta/create_subagent/SKILL.md
skills/meta/finish/SKILL.md
skills/meta/list_saved_subagents/SKILL.md
skills/meta/modify_subagent/SKILL.md
skills/meta/run_subagent/SKILL.md
skills/meta/view_subagent_code/SKILL.md
skills/tools/google_search/SKILL.md
skills/tools/jina_reader/SKILL.md
skills/tools/mask/local_search/SKILL.md
skills/tools/mask/open_page/SKILL.md
skills/tools/playwright/SKILL.md

Metadata

Files
0
Version
df92287
Hash
9b91938d
Indexed
2026-07-25 08:38

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 05:58
浙ICP备14020137号-1 $mapa de visitantes$