一键导入
background-task
Use when running a command that may take longer than 60 seconds, may hang, or needs progress monitoring and cancellation without blocking the agent.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when running a command that may take longer than 60 seconds, may hang, or needs progress monitoring and cancellation without blocking the agent.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create concise, text-first slide decks written in Markdown and optionally create or edit Google Slides. Use when the user asks for slides/slide decks/ppt/presentations, especially when they want: (1) Flow/narrative design first, (2) Bullet-heavy slides with deep nesting, (3) Iterative drafting where Codex shows exactly ONE slide per turn, (4) ASCII-only final Markdown, or (5) Google Slides creation or scoped edits via scripts/google_slides.py.
Iteratively refine drawio code by repeatedly exporting to PNG and visually comparing against a reference image. Use when the user provides a reference image (screenshot, mockup, diagram) and asks to recreate it as a drawio/diagrams.net diagram. Triggers on phrases like "recreate this diagram in drawio", "match this image with drawio", "drawio iterative", user provides an image path + drawio request.
Modify the user's flake-based NixOS and Home Manager configuration in ~/dotfiles while preserving the existing structure and conventions. Use when asked to enable/disable NixOS services/options, add/remove packages, adjust overlays, update flake inputs/lockfiles, create/tweak host profiles (desktop/laptop/server/rpi/WSL), or debug Nix evaluation/build errors. Always verify option/module/API correctness against the pinned nixpkgs source (via $NIX_PATH and the repo's flake.lock) because Nix/NixOS APIs change quickly and docs may lag.
Direct Zotero Web API operations on a personal or group library: CRUD on items / collections / notes / tags, PDF attachments via either hybrid local-file mode or standard 3-step S3 upload, identifier-based item lookup, and bulk tagging. Use when the user asks to add items / import / create / update / delete / move / tag / search / attach files in Zotero programmatically (e.g. 'add to zotero', 'create zotero collection', 'attach PDF to zotero', 'tag items in zotero', 'manage zotero library', '操作 zotero', 'zotero 库'). Does NOT resolve bibliographic metadata from arXiv / CrossRef / Semantic Scholar / OpenReview - hand the script already-formed Zotero JSON via --meta. For bibliography-aware paper import workflows use the literature-review skill instead.
Academic literature review workflow for Related Work sections, project feasibility reports, and surveys. Multi-source paper discovery (brave + exa + cited + arXiv + Semantic Scholar), lightweight triage, arXiv HTML deep reading, and generation of a comparison matrix and a Related Work draft. Use when the user asks for literature review / survey / related work / paper survey. Stage A supports end-to-end arXiv-centric workflow; Zotero import and MinerU PDF extraction come in Stage B; paywall fallback and citation chasing come in Stage C.
PDF to Markdown conversion using the MinerU GPU container. Extracts text, tables (HTML), formulas (LaTeX), and figures from PDFs. Use when asked to convert a PDF to structured Markdown, extract content from a paper PDF, or set up the MinerU extraction pipeline.
| name | background-task |
| description | Use when running a command that may take longer than 60 seconds, may hang, or needs progress monitoring and cancellation without blocking the agent. |
Run long commands in a uniquely named tmux session. Keep each foreground wait under 60 seconds, preserve output and exit status, and remain able to inspect or cancel the exact task.
Do not add a reusable management script. Use the standard tmux workflow below.
nohup, disown, an ad hoc watchdog, or one long blocking tool call instead of tmux.Choose a collision-resistant session name, retain its state directory for later checks, and replace COMMAND with the exact command to run.
SESSION="bg-$(date +%s)-$$"
STATE_DIR="$(mktemp -d "${TMPDIR:-/tmp}/${SESSION}.XXXXXX")"
WORKDIR="${PWD}"
COMMAND='./long-build-command --target release'
WRAPPER='
write_state() {
value="$1"
path="$2"
printf "%s\n" "$value" >"${path}.tmp"
mv -f "${path}.tmp" "$path"
}
finish() {
code="$1"
state="$2"
trap - HUP INT TERM
write_state "$code" "$BG_STATE_DIR/exit-code"
write_state "$state" "$BG_STATE_DIR/status"
exit "$code"
}
trap "finish 129 cancelled" HUP
trap "finish 130 cancelled" INT
trap "finish 143 cancelled" TERM
write_state running "$BG_STATE_DIR/status"
set +e
bash -lc "$BG_COMMAND" 2>&1 | tee -a "$BG_STATE_DIR/output.log"
code=${PIPESTATUS[0]}
if [ "$code" -eq 0 ]; then
finish "$code" completed
elif [ "$code" -eq 129 ] || [ "$code" -eq 130 ] || [ "$code" -eq 143 ]; then
finish "$code" cancelled
else
finish "$code" failed
fi
'
printf -v LAUNCH '%q ' env BG_STATE_DIR="$STATE_DIR" BG_COMMAND="$COMMAND" bash -lc "$WRAPPER"
if tmux has-session -t "$SESSION" 2>/dev/null; then
printf 'Refusing to reuse tmux session: %s\n' "$SESSION" >&2
exit 1
fi
PANE_ID="$(tmux new-session -d -P -F '#{pane_id}' -s "$SESSION" -c "$WORKDIR")"
tmux set-option -t "$SESSION" remain-on-exit on
tmux respawn-pane -k -t "$PANE_ID" "$LAUNCH"
printf 'session=%s\npane=%s\nstate_dir=%s\n' "$SESSION" "$PANE_ID" "$STATE_DIR"
Keep SESSION, PANE_ID, and STATE_DIR in the working context. The pane ID avoids assumptions about tmux window and pane indexes. A successful tmux new-session means only that launch succeeded, not that the command succeeded.
Each monitoring cycle must be short:
tmux capture-pane -p -t "$PANE_ID" -S -80
tmux display-message -p -t "$PANE_ID" \
'pane_dead=#{pane_dead} pane_exit=#{pane_dead_status}'
test -f "$STATE_DIR/status" && printf 'status_file=present\n'
test -f "$STATE_DIR/exit-code" && printf 'exit_code_file=present\n'
Use the Read tool to inspect status, exit-code, and output.log. Treat the state files as authoritative. If the pane disappears without a terminal status, report the outcome as unknown rather than guessing.
Choose the next wait from observed progress:
sleep below 60 seconds. Do not tight-poll, and do not use one large sleep.Terminal states are completed, failed, and cancelled. Read exit-code and the relevant final section of output.log before reporting the result. Do not infer success from log text or a dead pane alone.
Verify the target session first, then request graceful interruption:
tmux list-sessions -F '#{session_name}'
tmux capture-pane -p -t "$PANE_ID" -S -30
tmux send-keys -t "$PANE_ID" C-c
sleep 2
Check status and the pane again. If the task remains alive, escalate only against that session:
tmux kill-session -t "$SESSION"
printf '%s\n' cancelled >"$STATE_DIR/status"
After forced cancellation, do not invent an exit code. Never use killall, broad pkill, or an ambiguous tmux target. Cancellation does not imply automatic retry; diagnose first, then rerun only if the user's task still requires it.
After reading the final result:
tmux has-session -t "$SESSION" 2>/dev/null && tmux kill-session -t "$SESSION"
Remove STATE_DIR only after its logs are no longer needed. Preserve it and report its path when the output is evidence for debugging.
| Goal | Command |
|---|---|
| List sessions | tmux list-sessions |
| Recent output | tmux capture-pane -p -t "$PANE_ID" -S -80 |
| Pane state | tmux display-message -p -t "$PANE_ID" '#{pane_dead} #{pane_dead_status}' |
| Graceful cancel | tmux send-keys -t "$PANE_ID" C-c |
| Forced cancel | tmux kill-session -t "$SESSION" |
tee instead of using PIPESTATUS[0].