run-with-timeout
Run commands with timeout protection to prevent hanging. Use for potentially long-running tests or operations.
When & Why to Use This Skill
The run-with-timeout skill is a critical utility for developers and automated agents designed to execute shell commands with a safety time limit. It prevents system processes from hanging indefinitely, ensures resource availability, and provides predictable exit codes (like 124 for timeouts) to help maintain the stability of automated workflows and scripts.
Use Cases
- Automated Testing: Prevent CI/CD pipelines from stalling by setting a maximum execution time for test suites that might encounter deadlocks or infinite loops.
- Data Processing: Safely run long-running data migration or extraction scripts with a hard cutoff to avoid overlapping executions or excessive resource consumption.
- Remote Server Management: Execute maintenance commands on remote environments where network instability or process hangs could otherwise lead to unresponsive agent sessions.
- Batch Scripting: Wrap unpredictable third-party binaries or scripts to ensure they do not exceed their allocated time window in a larger automation sequence.
| name | run-with-timeout |
|---|---|
| description | Run commands with timeout protection to prevent hanging. Use for potentially long-running tests or operations. |
Run With Timeout
Execute commands with timeout protection.
.claude/skills/run-with-timeout/scripts/run-with-timeout.sh 60 ./test-script.sh
Returns exit code 124 if timeout exceeded, otherwise command's exit code.