Terminal Command Execution
Overview
Use this skill to run terminal commands with minimal risk and predictable outcomes. Prefer fast inspection, explicit intent checks, and verification after each state-changing step.
Workflow
- 1. Clarify goal and scope.
- - Infer the exact command target from context (path, service, tool, environment).
- If request is ambiguous and risky, ask one concise clarifying question.
- 2. Pre-flight checks.
- - Confirm working directory and required binaries.
- Inspect current state before changing it (for example
ls, git status, process/listen state). - Prefer non-destructive probes first.
- 3. Execute commands incrementally.
- - Run the smallest command that advances the task.
- For multi-step tasks, validate each step before continuing.
- Use reproducible commands and avoid interactive flows when non-interactive options exist.
- 4. Handle failures systematically.
- - Read stderr first and identify root cause class: permission, path, missing dependency, syntax, network, or runtime state.
- Apply one fix at a time, then re-run only the affected command.
- If privileged/destructive action is required, request user approval before proceeding.
- 5. Verify outcomes.
- - Check exit status and observable state changes.
- For installs, verify with a version/health command.
- For edits, verify resulting files and behavior.
- 6. Report clearly.
- - Summarize what ran, what changed, and current status.
- Include exact next command only when additional user action is required.
Safety Rules
- - Avoid destructive commands by default (
rm -rf, force resets, broad chmod/chown) unless explicitly requested. - Never assume network, permissions, or package managers are available; test first.
- Prefer scoped operations (specific files/paths/services) over global changes.
- Keep secrets out of command output and logs.
Command Patterns
- - Discovery:
pwd, ls -la, rg --files, INLINECODE6 - Validation:
<tool> --version, health/status commands, targeted smoke tests - Diagnostics: inspect logs/errors first, then adjust one variable at a time
终端命令执行
概述
使用此技能以最小风险和可预测的结果运行终端命令。优先进行快速检查、明确意图验证,并在每个状态变更步骤后进行确认。
工作流程
- 1. 明确目标和范围。
- - 从上下文(路径、服务、工具、环境)推断确切的命令目标。
- 如果请求存在歧义且具有风险,提出一个简洁的澄清性问题。
- 2. 预检检查。
- - 确认工作目录和所需的二进制文件。
- 在变更前检查当前状态(例如 ls、git status、进程/监听状态)。
- 优先使用非破坏性的探测命令。
- 3. 增量执行命令。
- - 运行能推进任务的最小命令。
- 对于多步骤任务,在继续前验证每个步骤。
- 使用可复现的命令,并在存在非交互选项时避免交互式流程。
- 4. 系统化处理失败。
- - 首先读取标准错误输出,识别根本原因类别:权限、路径、缺少依赖、语法、网络或运行时状态。
- 每次只应用一个修复方案,然后仅重新运行受影响的命令。
- 如果需要特权/破坏性操作,在继续前请求用户批准。
- 5. 验证结果。
- - 检查退出状态和可观察的状态变更。
- 对于安装操作,使用版本/健康命令进行验证。
- 对于编辑操作,验证生成的文件和行为。
- 6. 清晰报告。
- - 总结运行内容、变更内容以及当前状态。
- 仅在需要用户额外操作时,包含确切的下一个命令。
安全规则
- - 默认避免破坏性命令(rm -rf、强制重置、广泛的 chmod/chown),除非明确要求。
- 切勿假设网络、权限或包管理器可用;先进行测试。
- 优先使用限定范围的操作(特定文件/路径/服务),而非全局变更。
- 将机密信息排除在命令输出和日志之外。
命令模式
- - 发现:pwd、ls -la、rg --files、which <工具>
- 验证:<工具> --version、健康/状态命令、针对性冒烟测试
- 诊断:先检查日志/错误,然后每次调整一个变量