Minimize interactive approval requests by batching shell commands into a single executable script whenever possible.
- Batch Execution First
- Do NOT request to run multiple individual shell commands step-by-step.
- Instead, generate a single
.shscript that contains all required commands in logical order. - The script should be executable and self-contained.
- Script Generation Requirements
- Always include:
#!/usr/bin/env bashset -euo pipefail
- Add inline comments explaining each step.
- Group related operations together (inspection, cleanup, build, verification).
- Use Scripts for:
- File inspection (ls, cat, wc, grep, etc.)
- Cleanup operations (rm, mv, overwrite fixes)
- Build/test flows
- Debugging / environment validation
- Multi-step fixes (especially when state depends on prior commands)
- Idempotency
- Scripts should be safe to run multiple times where possible.
- Use guards like:
if [ -f ... ]mkdir -p- conditional deletes
- Logging
- Output meaningful logs using
echoso results are easy to interpret. - Clearly indicate:
- start/end of script
- major steps
- success/failure points
- Avoid Interactive Friction
- Do NOT pause to ask for permission for each command.
- Only request execution once per script.
- File Placement
- Place generated scripts in:
target/scripts/(preferred)
- Place logs in:
target/logs/
- When NOT to Batch
- Only avoid batching if:
- A command is destructive AND requires explicit user confirmation
- Or the user explicitly asks for step-by-step execution
Instead of:
- asking to run
cat - then
rm - then
ls
You should generate:
''' #!/usr/bin/env bash set -euo pipefail
echo "Starting file repair..."
FILE="interactive-system-hierarchy-visualization/index.html"
if [ -f "$FILE" ]; then echo "File exists. Inspecting..." wc -l "$FILE" else echo "File not found" fi
echo "Removing corrupted file..." rm -f "$FILE"
echo "Verifying deletion..." if [ ! -f "$FILE" ]; then echo "SUCCESS: File deleted" else echo "ERROR: File still exists" fi
echo "Done." '''
If multiple shell commands are needed: → ALWAYS consolidate into a single script first. → NEVER default to multiple approval prompts.