Use when running commands that take >30 seconds (builds, tests, servers) - hosts in terminal session for monitoring and recovery
/plugin marketplace add shikihane/polydev/plugin install polydev@polydev-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Host background commands in terminal (tmux/wezterm) and monitor their status.
Prefix bg: = Background command (SSH, build, test, server, etc.)
Choose skill by prefix:
bg: → terminal-task-runner (this skill) - NO git requiredag: → agent-investigator - NO git required (research, analysis)wo: → polydev - REQUIRES git repo┌─────────────────────────────────────────────────────────────────┐
│ YOU MUST USE THIS SKILL FOR: │
│ - ANY SSH connection │
│ - ANY command that takes >10 seconds │
│ - ANY background/long-running task │
│ - ANY build, test, or dev server │
│ │
│ ABSOLUTELY PROHIBITED: │
│ - Using Bash tool's run_in_background parameter │
│ - Using & or nohup to background commands │
│ - Calling tmux/wezterm commands directly │
│ - Trying to "do it faster myself" without this skill │
│ │
│ NO GIT REPO REQUIRED - This skill works anywhere │
│ │
│ FOR SUB-AGENTS (ag:) → Use agent-investigator skill │
│ FOR PARALLEL DEV (wo:) → Use polydev skill (requires git) │
└─────────────────────────────────────────────────────────────────┘
If you violate these rules, the task WILL FAIL.
All scripts MUST be called via $POLYDEV_SCRIPTS variable. NEVER use relative path ./scripts/
# Set path variable before calling any script
POLYDEV_SCRIPTS="$(dirname "$(dirname "$(realpath "${BASH_SOURCE[0]:-$0}")")")/scripts"
# Or if in skill context, use skill base directory:
# POLYDEV_SCRIPTS="<skill-base-dir>/../scripts"
# Then call scripts using the variable
"$POLYDEV_SCRIPTS/run-background.sh" <name> "<command>"
When called from Claude Code: Use the plugin installation path
# Plugin path example (based on actual installation location)
POLYDEV_SCRIPTS="/path/to/polydev/plugins/polydev/scripts"
"$POLYDEV_SCRIPTS/run-background.sh" build "npm run build"
npm run build, cargo build, go build)npm test, pytest, cargo test)npm run dev, cargo watch)npm install, pip install)Script: run-background.sh
Parameters: <name> "<command>" [--cwd <dir>]
Returns: session_id (format: bg:<workspace>:<name>.0)
session_id=$("$POLYDEV_SCRIPTS/run-background.sh" build "npm run build")
# Returns: bg:bg-myproject:build.0
Script: send-to-session.sh
Parameters: <session_id> "<command>" [--no-enter]
session_id format: bg:xxx, wo:xxx, ag:xxx
# Send command to SSH session
"$POLYDEV_SCRIPTS/send-to-session.sh" bg:bg-polydev:ssh-remote.0 "docker ps"
# Send password (without pressing Enter)
"$POLYDEV_SCRIPTS/send-to-session.sh" bg:bg-polydev:ssh-remote.0 "mypassword" --no-enter
Script: analyze-output.sh
Parameters: <session_id> --lines <N> [--json]
Returns: status (running|idle|success|failed|done)
result=$("$POLYDEV_SCRIPTS/analyze-output.sh" bg:bg-myproj:build.0 --lines 20 --json)
Script: wait-for-pattern.sh
Parameters: <session_id> --success "<pattern>" [--fail "<pattern>"] [--timeout <seconds>]
Returns: exit code (0=success, 1=fail, 2=timeout)
"$POLYDEV_SCRIPTS/wait-for-pattern.sh" "$session_id" \
--success "passed|All tests passed" \
--fail "failed|Error" \
--timeout 300
Script: capture-screen.sh
Parameters: --session <wo:session_id> --lines <N>
Note: session parameter requires wo: prefix!
# Convert bg: to wo: prefix
"$POLYDEV_SCRIPTS/capture-screen.sh" --session wo:bg-myproj:build.0 --lines 50
Script: close-session.sh
Parameters: <session_id>
"$POLYDEV_SCRIPTS/close-session.sh" bg:bg-myproj:build.0
Script: list-sessions.sh
Parameters: [workspace] (optional filter)
"$POLYDEV_SCRIPTS/list-sessions.sh"
"$POLYDEV_SCRIPTS/list-sessions.sh" myproject
DO NOT use relative path ./scripts/ (breaks when leaving plugin directory)
DO NOT use Bash tool's run_in_background parameter
DO NOT use & to background
DO NOT use nohup
DO NOT call tmux/wezterm commands directly
DO NOT use wrong script (e.g., wo-send-command.sh for bg: session - it's for wo: only)
MUST call scripts via $POLYDEV_SCRIPTS variable
MUST monitor task status
MUST clean up session when done
POLYDEV_SCRIPTS="/path/to/polydev/plugins/polydev/scripts"
# Start
session_id=$("$POLYDEV_SCRIPTS/run-background.sh" build "npm run build")
# Poll and check
while true; do
result=$("$POLYDEV_SCRIPTS/analyze-output.sh" "$session_id" --lines 20 --json)
status=$(echo "$result" | jq -r '.status')
case "$status" in
success|done)
echo "Task completed"
break
;;
failed)
echo "Task failed"
"$POLYDEV_SCRIPTS/capture-screen.sh" --session "${session_id/bg:/wo:}" --lines 50
break
;;
esac
sleep 10
done
# Cleanup
"$POLYDEV_SCRIPTS/close-session.sh" "$session_id"
POLYDEV_SCRIPTS="/path/to/polydev/plugins/polydev/scripts"
# 1. Start SSH connection
session_id=$("$POLYDEV_SCRIPTS/run-background.sh" ssh-server "ssh user@host")
# 2. Wait for connection (may need password)
sleep 3
"$POLYDEV_SCRIPTS/capture-screen.sh" --session "${session_id/bg:/wo:}" --lines 20
# 3. If password needed
"$POLYDEV_SCRIPTS/send-to-session.sh" "$session_id" "mypassword"
# 4. Send commands
"$POLYDEV_SCRIPTS/send-to-session.sh" "$session_id" "docker ps"
# 5. View results
sleep 2
"$POLYDEV_SCRIPTS/capture-screen.sh" --session "${session_id/bg:/wo:}" --lines 30
# 6. Close when done
"$POLYDEV_SCRIPTS/close-session.sh" "$session_id"
POLYDEV_SCRIPTS="/path/to/polydev/plugins/polydev/scripts"
# Start and wait
session_id=$("$POLYDEV_SCRIPTS/run-background.sh" test "npm test")
# Wait for success or failure
"$POLYDEV_SCRIPTS/wait-for-pattern.sh" "$session_id" \
--success "passed|All tests passed" \
--fail "failed|Error" \
--timeout 300
exit_code=$?
case $exit_code in
0) echo "Tests passed" ;;
1) echo "Tests failed" ;;
2) echo "Timeout" ;;
esac
"$POLYDEV_SCRIPTS/close-session.sh" "$session_id"
bg:<workspace>:<name>.0
| | | |
| | | +-- pane index (always 0)
| | +-- task name
| +-- workspace (default: bg-<current-dir-name>)
+-- prefix (background task)
Prefix Conversion Rules:
capture-screen.sh --session parameter requires wo: prefixbg: prefix${session_id/bg:/wo:}"$POLYDEV_SCRIPTS/list-sessions.sh"
"$POLYDEV_SCRIPTS/capture-screen.sh" --session wo:bg-myproj:build.0 --lines 100
"$POLYDEV_SCRIPTS/close-session.sh" bg:myproj:build.0
"$POLYDEV_SCRIPTS/run-background.sh" build "npm run build"
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.