Command Palette

Search for a command to run...

Назад к скиллам
скилл № 14586

background-task

Decide when to launch a long-running task in the background and how to refer to it later. Covers both the `task` tool (sub-agent background via…

БесплатноБез исполняемых скриптов
MiniMax-AIот MiniMax-AI★ 30 звёзд на GitHub

Установить background-task в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Background Task

When a task (a sub-agent invocation or a shell command) is expected to take more than ~30 seconds, the agent has two choices:

  1. Block: wait for the task to finish, holding the conversation hostage.
  2. Background: launch it, get a handle, continue working, and check on it later.

This Skill is about knowing when to choose (2) and how to record the handle so the agent (or the user) can check on it later.

mcode 0.2.4 surface

There are two background-capable tools on mcode 0.2.4, and the right one depends on whether the background work is a sub-agent or a shell command.

Sub-agent background: task(run_in_background: true) + task_query / task_output / task_stop

The canonical task schema:

task(
  description:    string,            // 3-5 word label, required
  prompt:         string,            // the brief, required
  agent_name:  "explore" | "worker" | "verifier",  // required
  run_in_background?: boolean        // optional; true = async, false = sync (default)
)

When run_in_background: true, mcode returns immediately with a task_id. The companion tools (also canonical in cli.js):

Tool Purpose Required fields
task_query(task_id?, status?) List session tasks (omit task_id) or get one. task_id for single fetch; status filter optional.
task_output(task_id, offset?) Read a task's output incrementally. task_id (required); offset (optional, byte offset for long output).
task_stop(task_id, reason?) Request a background task to stop. task_id (required); reason (optional, human-readable).

run_in_background: false (the default) blocks the calling turn until the sub-agent finishes and returns its final result.

Shell background: bash(run_in_background: true)

The bash tool's canonical schema (from cli.js:xza):

bash(
  command:         string,    // required
  timeout?:        number,    // optional, seconds
  run_in_background?: boolean // optional; true = async, false = sync (default)
)

When run_in_background: true, the bash call returns immediately with a job handle. Conceptual pseudocode below. The exact shape of the returned handle is NOT part of the public mcode 0.2.4 runtime contract; the host's job-control API is the source of truth for the underlying process id. The Skills below treat the handle as opaque and locate the process id by means outside the mcode contract (the launch context, the host's job-control API, or the calling agent's own bookkeeping). Windows: Stop-Process -Id <process-id>; POSIX: kill <process-id>, both invoked through a foreground bash call rather than any action="kill" field. The placeholder <process-id> is whatever process id the host's job-control API identifies; the launching agent must record it (or a way to resolve it) by its own means, separate from this Skill. There is no task_name= and no action="kill" field. The Codex-harness shape bash(task_name=..., run_in_background=true, action="kill") is not the mcode surface — mcode's bash validator rejects any key outside command / timeout / run_in_background.

Killing a shell background job: invoke the host's job-control API in a foreground bash call. Windows: Stop-Process -Id <process-id>. POSIX: kill <process-id>. The Skills do not pretend bash(action="kill") exists on mcode 0.2.4. The <process-id> value is host-internal (e.g. a Windows PID resolved via Get-Process, or a POSIX pid resolved via ps -p); the launching agent records it out-of-band from this Skill.

When to use

Activate when any of these is true:

  • A sub-agent is expected to take > 1 minute (deep research, multi-file refactor, anything you cannot predict the duration of).
  • A shell command is expected to take > 30 seconds (cargo test, npm install, docker build, a long-running dev server, a large data download).
  • The user explicitly says "background" / "后台" / "non-blocking" / "in the background".
  • You need a long-running process to coexist with ongoing work (a dev server, a watch script, a streaming pipeline).
  • You would otherwise block the conversation on a result the user can come back to later.

When NOT to use

  • The task / command finishes in <5 seconds.
  • The user explicitly wants the output now (interactive REPL, vim, ssh, a build whose output the next step depends on).
  • The command is interactive (it expects a TTY or human input).

Process

  1. Estimate the duration. If unsure, assume the worst case. The mcode task tool description (run_in_background) says "Set to true when the sub-task is open-ended or expected to take more than ~1 minute (deep research, multi-step investigation, large refactors, anything you cannot predict the duration of), so you can keep working and the result is reported back automatically when it completes. Leave false (the default) for short, well-scoped sub-task
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл background-task?

Decide when to launch a long-running task in the background and how to refer to it later. Covers both the `task` tool (sub-agent background via `run_in_background: true`) and the `bash` tool (shell background via `run_in_background: true`). USE WHEN: a sub-agent is expected to take > 1 minute, a shell command is expected to take > 30 seconds, the user wants a long-running process to coexist with ongoing work, you are about to block the conversation for an unbounded time, user said "background it" / "后台" / "don't block" / "non-blocking" / "run in background". TRIGGER PHRASES: "background", "background it", "后台", "don't block", "non-blocking", "in the background", "run async", "long-running", "put it in the background". SKIP WHEN: the sub-agent / command finishes in <5 seconds, the user explicitly wants to wait for output, the command is interactive (REPL, vim, ssh).

Как установить скилл background-task?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл background-task запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить background-task с