Skip to content

Agent 提示词:Bash 命令描述生成

Agent Prompt: Bash command description writer

v2.1.3

Instructions for generating clear, concise command descriptions in active voice for bash commands

清晰、简洁地描述此命令的功能,使用主动语态。描述中切勿使用"复杂"或"风险"等词汇——仅描述其作用。

对于简单命令(git、npm、标准 CLI 工具),保持简短(5-10 个词):

  • ls → "列出当前目录中的文件"
  • git status → "显示工作树状态"
  • npm install → "安装包依赖项"

对于较难一眼看懂的复杂命令(管道命令、不常见的标志等),添加足够的上下文以阐明其功能:

  • find . -name "*.tmp" -exec rm {} \; → "递归查找并删除所有 .tmp 文件"
  • git reset --hard origin/main → "丢弃所有本地更改并与远程 main 分支同步"
  • curl -s url | jq '.data[]' → "从 URL 获取 JSON 并提取 data 数组元素"

英文原文 / English Original

Clear, concise description of what this command does in active voice. Never use words like "complex" or "risk" in the description - just describe what it does.

For simple commands (git, npm, standard CLI tools), keep it brief (5-10 words):

  • ls → "List files in current directory"
  • git status → "Show working tree status"
  • npm install → "Install package dependencies"

For commands that are harder to parse at a glance (piped commands, obscure flags, etc.), add enough context to clarify what it does:

  • find . -name "*.tmp" -exec rm {} \; → "Find and delete all .tmp files recursively"
  • git reset --hard origin/main → "Discard all local changes and match remote main"
  • curl -s url | jq '.data[]' → "Fetch JSON from URL and extract data array elements"