$npx -y skills add omnigentx/jarvis --skill terminal-executionGuide for using the execute tool to run shell commands in workspace. Use when agent needs to: build/test code, run scripts, check system status, install dependencies, or execute deployment commands.
| 1 | # Terminal Execution Skill |
| 2 | |
| 3 | Guide for using the `execute` tool to run shell commands safely and efficiently. |
| 4 | |
| 5 | ## When to Use Terminal |
| 6 | |
| 7 | ✅ **USE when:** |
| 8 | - Build/compile code (`uv run`, `npm run build`) |
| 9 | - Run tests (`pytest`, `npm run test:unit`) |
| 10 | - Check system status (`docker ps`, `systemctl status`) |
| 11 | - Install dependencies (`pip install`, `npm install`, `apt-get`) |
| 12 | - Quick file/folder checks (`ls`, `find`, `grep`, `cat`) |
| 13 | - Git operations (`git status`, `git diff`, `git log`) |
| 14 | - Docker operations (`docker compose up`, `docker build`) |
| 15 | - Migration scripts, seed data |
| 16 | |
| 17 | ❌ **DO NOT use when:** |
| 18 | - Reading/writing files → use `filesystem` tools (`read_text_file`, `write_file`) |
| 19 | - GitHub API operations → use `github` tools |
| 20 | - Long interactive sessions → out of scope |
| 21 | |
| 22 | ## Execute Tool Syntax |
| 23 | |
| 24 | The `execute` tool (built-in from ShellRuntime) takes a single parameter: |
| 25 | |
| 26 | ``` |
| 27 | execute(command="<shell command>") |
| 28 | ``` |
| 29 | |
| 30 | **Key characteristics:** |
| 31 | - Runs in the **workspace directory** (not home dir) |
| 32 | - **90s timeout** — process killed if no output for 90s |
| 33 | - **Watchdog**: warns every 30s if no output |
| 34 | - Output **auto-truncated** if too long (prevents token overflow) |
| 35 | - Returns **exit code** at end: `process exit code was 0` |
| 36 | - Each call is a **separate shell session** — env vars and `cd` don't persist |
| 37 | - **No shell prefix needed**: correct `"ls -la"`, wrong `"bash -c ls -la"` |
| 38 | |
| 39 | ## Efficient Patterns |
| 40 | |
| 41 | ### Chain Commands |
| 42 | ```bash |
| 43 | cd repo && npm install && npm test # Sequential (stops on error) |
| 44 | echo "=== Tests ===" ; pytest ; echo "=== Lint ===" ; ruff check . # Run all |
| 45 | ``` |
| 46 | |
| 47 | ### Check Before Acting |
| 48 | ```bash |
| 49 | docker info > /dev/null 2>&1 && echo "Docker OK" || echo "Docker NOT running" |
| 50 | lsof -ti:8000 && echo "Port 8000 in use" || echo "Port 8000 available" |
| 51 | ``` |
| 52 | |
| 53 | ### Filter Long Output |
| 54 | ```bash |
| 55 | docker logs container_name 2>&1 | tail -20 # Last 20 lines |
| 56 | grep -r "ERROR" logs/ | head -10 # Find errors |
| 57 | find . -name "*.py" | wc -l # Count files |
| 58 | ``` |
| 59 | |
| 60 | ### Build & Test |
| 61 | ```bash |
| 62 | cd backend && uv run pytest --tb=short -q 2>&1 | tail -20 |
| 63 | cd frontend && npm run test:unit 2>&1 | tail -20 |
| 64 | docker compose -f docker-compose.yaml build --no-cache 2>&1 | tail -30 |
| 65 | ``` |
| 66 | |
| 67 | <safety_rules> |
| 68 | 🔴 NEVER: |
| 69 | - `rm -rf /` or any unrestricted recursive delete |
| 70 | - Expose secrets/tokens/passwords via stdout |
| 71 | - Run `curl | bash` from untrusted sources |
| 72 | - Modify system files outside workspace (`/etc/`, `/usr/`) |
| 73 | - Kill system processes (`kill -9 1`, `killall`) |
| 74 | |
| 75 | 🟡 CAUTION: |
| 76 | - `rm -rf` → always specify exact path, check first |
| 77 | - `chmod`/`chown` → only within workspace |
| 78 | - `docker system prune` → ask user first |
| 79 | - `apt-get install` / `pip install` → only in venv/container |
| 80 | |
| 81 | 🟢 SAFE: |
| 82 | - All read-only commands (`ls`, `cat`, `grep`, `find`, `docker ps`) |
| 83 | - Build/test commands within workspace |
| 84 | - Read-only git commands (`status`, `log`, `diff`) |
| 85 | </safety_rules> |
| 86 | |
| 87 | <error_handling> |
| 88 | When a command fails: |
| 89 | 1. Read stderr FIRST — usually contains root cause |
| 90 | 2. DO NOT retry immediately — analyze the error first |
| 91 | 3. Try a simpler command — isolate the issue |
| 92 | 4. Report clearly — include command + error output |
| 93 | </error_handling> |
| 94 | |
| 95 | ## Combining with Other Skills |
| 96 | |
| 97 | | Skill | Terminal Use | |
| 98 | |-------|-------------| |
| 99 | | `code-review` | Run tests to verify fixes | |
| 100 | | `git-workflow` | `git status`, `git diff`, `git log` | |
| 101 | | `cicd-pipeline` | Validate workflow, local builds | |
| 102 | | `test-driven-development` | `pytest`, `npm test` | |
| 103 | | `jarvis-knowledge` | Explore codebase structure | |