long-running-taskslisted
Install: claude install-skill jajupmochi/claude-config
# /long-running-tasks
Choose the right mechanism when a task will take more than a few minutes.
## Decision tree
```
Task duration estimate?
├─ < 30 seconds → run synchronous (default)
├─ 30s – 2 min → run synchronous, watch for timeout
├─ 2 – 10 min → Bash with `run_in_background: true`, then Monitor for completion
├─ 10 min – 1h → background subagent (`Task` with `run_in_background: true`); main agent continues with other work
└─ > 1 hour → consider refactoring; or use a CronCreate for scheduled recurrence; consider whether the model session itself will reach context limits before completion
```
## Tool reference
### `Bash` with `run_in_background: true`
For shell commands > 2 min:
```python
Bash(command="<long-running-cmd>", run_in_background=True, timeout=600000)
```
Returns control immediately. Use `Monitor` (or `BashOutput`) to check status.
### `Monitor` tool
Watches a background process for events. **Costs no tokens while waiting** (event-driven, not polled):
```python
Monitor(...)
```
Wakes the agent only when an event of interest occurs. Use for "wait for build to finish" / "watch a log file for an error pattern".
### Background subagent (`Task` with `run_in_background: true`)
For tasks needing reasoning + tool use, not just shell:
```python
Task(
description="<one-line>",
subagent_type="general-purpose",
prompt="<self-contained prompt — the agent has no context from this conversation>",
run_in_background=True,
)
```
Subagent runs ind