spawn-agent

Spawn an independent agent in a separate terminal pane for parallel work. Detects your terminal environment and guides you to the right spawn command.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "spawn-agent" with this command: npx skills add youngchingjui/spawn-agent/youngchingjui-spawn-agent-spawn-agent

Spawn Agent

Spawn an independent, full-fledged agent in a separate terminal pane.

Why spawn externally?

Some agents (Claude Code, Codex, etc.) have built-in sub-agent capabilities that run within the same thread. Those sub-agents are useful for quick, autonomous tasks — but they have limitations:

  • You can't see what the sub-agent is doing in real time
  • You can't interact with it — it runs autonomously and returns results
  • It's designed for simpler, contained tasks that don't need human guidance

This skill enables a different workflow: spawn a fully independent agent in its own terminal pane. The spawned agent:

  • Runs in its own visible pane/window — you can watch it work
  • Is fully interactive — the user can guide it, answer questions, course-correct
  • Handles complex, independent tasks that benefit from human oversight
  • Works in parallel — the originating agent continues its own work

As an agent, you write better prompts for other agents than humans typically do. When you identify a task that should be delegated, craft a detailed prompt and spawn it off.

How to spawn

1. Determine the spawn method

Before spawning, you need to know two things: which terminal environment you're in, and the user's preferences (split direction, agent command). Resolve these in order:

  1. Check saved config. Read ~/.claude/spawn-agent.json — it may already have the terminal type and user preferences from a previous run.

  2. Look for context clues. Environment variables can tell you directly:

    • $TMUX is set → you're in tmux
    • $TERM_PROGRAM = vscode → you're in VS Code's integrated terminal
    • $TERM_PROGRAM = iTerm.app → you're in iTerm2
    • On macOS with none of the above → likely Terminal.app
    • On Linux → check for gnome-terminal, xterm, etc.
  3. Run the helper script. If you're still unsure, run the detection script — it checks these same environment variables and saves the result:

    bash "${CLAUDE_SKILL_DIR}/scripts/detect-terminal.sh"
    

    This writes to ~/.claude/spawn-agent.json (preserving any existing user preferences).

  4. Ask the user. If the environment is ambiguous or you want to confirm their preference, just ask. This is especially useful the first time — the user may want a specific split direction or agent command.

Config file

The config file ~/.claude/spawn-agent.json stores both detected environment and user preferences:

{
  "terminal": "tmux",
  "split": "vertical",
  "agent_command": "claude"
}
KeyDescriptionDefault
terminalTerminal environment (tmux, iterm2, terminal-app, vscode, linux)auto-detected
splitPreferred split direction: vertical or horizontalvertical
agent_commandCommand to launch the agent (e.g. claude, codex)claude

If preferences aren't set, use sensible defaults (vertical split, claude as the agent command).

2. Spawn the agent

Based on the terminal environment, run the matching command directly. Replace AGENT_CMD with the configured agent command, and PROMPT with your crafted prompt.

tmux

tmux split-window -h -c "$(pwd)" "AGENT_CMD 'PROMPT'"
  • -h = vertical split (side-by-side). Use -v for horizontal (top-bottom).
  • -c "$(pwd)" = start in the current directory. Use -c "/other/path" for a different directory.

iTerm2

osascript -e '
tell application "iTerm2"
  tell current session of current window
    set newSession to (split vertically with default profile)
  end tell
  tell newSession
    write text "cd /path/to/project && AGENT_CMD '\''PROMPT'\''"
  end tell
end tell'

Change split vertically to split horizontally for a top-bottom split.

Terminal.app (macOS fallback)

osascript -e '
tell application "Terminal"
  activate
  do script "cd /path/to/project && AGENT_CMD '\''PROMPT'\''"
end tell'

Opens a new window. Terminal.app doesn't support split panes, and opening a new tab requires Accessibility permissions that agents typically don't have.

VS Code integrated terminal

# Open a new terminal in the VS Code terminal panel
code -r --command workbench.action.terminal.new
# Then type the command into it — VS Code terminals don't support direct command injection,
# so print instructions for the user to paste, or use the VS Code CLI if available.

Linux terminals

# gnome-terminal
gnome-terminal --working-directory="$(pwd)" -- bash -lc "AGENT_CMD 'PROMPT'; exec \$SHELL"

# xterm
xterm -e bash -lc "cd '$(pwd)' && AGENT_CMD 'PROMPT'; exec \$SHELL" &

Best practices

  • Interactive mode only. The spawned agent must run interactively so the user can guide it. Never pass flags that suppress interactivity (e.g. --print, -p).
  • Write a detailed prompt. Include all context the spawned agent needs: what to do, which files matter, expected outcome, and constraints.
  • Use $ARGUMENTS as the prompt text when the user invokes this skill directly.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

clinic-visit-prep

帮助患者整理就诊前问题、既往记录、检查清单与时间线,不提供诊断。;use for healthcare, intake, prep workflows;do not use for 给诊断结论, 替代医生意见.

Archived SourceRecently Updated
Automation

changelog-curator

从变更记录、提交摘要或发布说明中整理对外 changelog,并区分用户价值与内部改动。;use for changelog, release-notes, docs workflows;do not use for 捏造未发布功能, 替代正式合规审批.

Archived SourceRecently Updated
Automation

klaviyo

Klaviyo API integration with managed OAuth. Access profiles, lists, segments, campaigns, flows, events, metrics, templates, catalogs, and webhooks. Use this skill when users want to manage email marketing, customer data, or integrate with Klaviyo workflows. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).

Archived SourceRecently Updated
Automation

lifelog

生活记录自动化系统。自动识别消息中的日期(今天/昨天/前天/具体日期),使用 SubAgent 智能判断,记录到 Notion 对应日期,支持补录标记。 适用于:(1) 用户分享日常生活点滴时自动记录;(2) 定时自动汇总分析并填充情绪、事件、位置、人员字段

Archived SourceRecently Updated