Quay lại danh sách
Claude Code NativeĐộ khó: intermediate

/background

Detach the current session to run as a background agent and free your terminal — monitor it with `claude agents`.

Dùng được với:Claude

Khi nào dùng

Use when kicking off a long-running task (large refactor, batch migration) and want to reclaim your terminal while it runs.

Ví dụ sử dụng

/background
/background finish the migration and open a PR when done
# alias: /bg

Select Model

<skill name="/background">
<purpose>
# /background — Claude Code Built-in Command

Alias: `/bg`

## What It Does
**Detaches the current session** from your terminal and runs it as a background agent. Your terminal is freed immediately. The session continues working autonomously.

## Usage
```
/background
```

### With a final instruction before detaching
```
/background finish the migration, run all tests, and open a PR when done
```

## Monitoring the Background Session
```bash
claude agents          # list all running background sessions
claude agents attach   # re-attach to a session
```
Or view in the Claude Code web UI at claude.ai/code.

## Re-attaching
```bash
claude agents          # find the session ID
claude --resume &lt;id&gt;   # re-attach
```

## Use Cases
- Large refactors that take 10–30 minutes
- Batch migrations across many files
- Long autoresearch loops
- &quot;Finish this while I'm in a meeting&quot;

## Session Persistence
Background sessions survive terminal closure. They run until the task is complete or you explicitly cancel them.
</purpose>
</skill>

Skill liên quan