| name | command-execution-principles |
| description | Safe command execution: input sanitization, timeout handling, output capture, error propagation. For spawning processes, shell commands, system calls. |
| user-invocable | false |
Command Execution Principles
Security
- ❌
exec(userInput), shell("rm " + userFile)
- ✅ Argument lists (no shell string concat), validate/sanitize all args
- Never run as root/admin without explicit human approval. Elevated perms required → STOP and request auth.
- Least-privilege service accounts
Portability
- Use language stdlib over shell commands (file I/O APIs instead of cat/cp/mv)
- Test on all target OS (path joining functions, not / concatenation)
Error Handling
- Check exit codes (non-zero = failure)
- Capture + log stderr
- Set timeouts for long-running
- Handle "command not found" gracefully
Non-Interactive Mode (MANDATORY for AI Agents)
AI agents CANNOT interact with interactive prompts. All commands MUST run non-interactively. A stuck prompt = a stuck agent = wasted time.
Environment Variables (set before ANY npm/yarn/pnpm command)
export CI=true
export npm_config_yes=true
export YARN_ENABLE_IMMUTABLE_INSTALLS=false
npm / npx
npx -y create-vite@latest ./my-app -- --template vue-ts
npx -y create-next-app@latest ./my-app --ts --eslint --app --use-npm
CI=true npm install
CI=true npm ci
npx create-vite@latest my-app
npm init
npm create vite
Scaffolding Tools (create-vite, create-next-app, etc.)
Every scaffolding tool has a non-interactive mode. You MUST find and use it.
- Run
--help first to discover non-interactive flags before scaffolding
- Always pass all required options (template, name, etc.) as CLI flags
- Common patterns:
create-vite: --template <template> (must specify template to skip prompt)
create-next-app: --ts --eslint --app --use-npm (pass all choices as flags)
create-react-app: pass project name as argument
npm init <initializer>: use npm create <initializer> -- <flags> with --yes or template flags
- If a tool still prompts, pipe
yes | as last resort: yes | npx -y create-tool ...
pnpm
pnpm install --no-frozen-lockfile
pnpm create vite my-app --template vue-ts
pnpm install
Yarn (v2+/Berry)
yarn install --no-immutable
yarn create vite my-app --template vue-ts
General Rule
If any command could potentially prompt for user input:
- Search for
--yes, --no-interactive, --non-interactive, or --batch flag
- Set
CI=true in the environment
- Pass all choices as explicit CLI flags (never rely on defaults that trigger prompts)
- Test with
echo "" | command if unsure whether it prompts
Violation: running an interactive command that blocks the agent is a critical failure.
Checklist
Related
- Security Mandate GEMINI.md § Security Mandate
- Security Principles GEMINI.md § Security Principles
- Dependency Management @.gemini/skills/dependency-management-principles/SKILL.md