toolkit/packages/skills/coding-agent/SKILL.md
Delegate coding tasks to subagents or run Claude Code/Codex in tmux sessions. Use the Task tool for focused multi-step coding work. Use tmux for long-running interactive sessions, parallel worktree-based fixes, and PR reviews. NOT for simple single-file edits — do those directly.
npx skillsauth add stevengonsalvez/agents-in-a-box coding-agentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Delegate coding tasks to subagents or run Claude Code/Codex in separate tmux sessions on the host. Choose the right pattern for the job.
| Situation | Pattern |
|-----------|---------|
| Bounded task with clear spec (fix bug, implement feature, write tests) | Task tool (subagent) |
| Long-running interactive session, needs persistence | tmux + claude --dangerously-skip-permissions |
| PR review — checkout and inspect | tmux + clone to /tmp |
| Multiple independent fixes in parallel | tmux + git worktrees |
| Claude Code capped or erroring | tmux + Codex fallback |
Use the Task tool to delegate focused coding work to a subagent. The subagent runs inside the same SDK session with full tool access (Bash, Read, Write, Edit, Glob, Grep). This is the default choice for most coding tasks.
Task({
description: "Fix the rate-limiting bug in the API gateway",
prompt: "..."
})
Write the Task prompt as a complete standalone brief. The subagent has no memory of the conversation that spawned it. Include:
Task({
description: "Implement retry logic for the Slack webhook sender",
prompt: """
You are a backend engineer implementing retry logic for a webhook sender.
Repository: /workspace/project
Target file: src/channels/slack.ts — the `sendWebhook` function
Task:
- Add exponential backoff retry (max 3 attempts, base delay 500ms)
- Only retry on 429 and 5xx HTTP responses
- Preserve the existing function signature
- Do NOT modify other files
Constraints:
- TypeScript strict mode is on
- No new dependencies — use built-in fetch and setTimeout
- Keep the existing error-logging pattern (console.error with context object)
When done:
- Run `npm run build` to verify compilation
- Summarise: files changed, retry logic approach, any edge cases handled
"""
})
Run independent tasks simultaneously. Do NOT chain tasks that depend on each other's output — wait for the first to complete.
// Run two independent fixes in parallel
Task({ description: "Fix auth timeout", prompt: "..." })
Task({ description: "Fix typos in CLAUDE.md", prompt: "..." })
// Then, once both complete, run the dependent task
Task({ description: "Integration test for auth + config", prompt: "..." })
For interactive, open-ended, or very long coding sessions that would exhaust context in a subagent. Claude Code runs on the host with full filesystem access and persistent terminal state.
# 1. Generate a session name
TIMESTAMP=$(date +%s)
SESSION="agent-${TIMESTAMP}"
WORK_DIR="/path/to/repo" # absolute path always
# 2. Create tmux session and start Claude Code
tmux new-session -d -s "$SESSION" -c "$WORK_DIR"
tmux send-keys -t "$SESSION" "claude --dangerously-skip-permissions" C-m
# 3. Wait for Claude to initialise (check for prompt, not just sleep)
sleep 3
tmux capture-pane -p -t "$SESSION" -S -30 # verify it's ready
# 4. Send the task (use -l flag for safe literal sending)
tmux send-keys -t "$SESSION" -l "Your full task description here"
tmux send-keys -t "$SESSION" C-m
# 5. Report session info back to user
echo "Session: $SESSION"
echo "Monitor: tmux attach -t $SESSION"
echo "Capture: tmux capture-pane -p -t $SESSION -S -100"
echo "Kill: tmux kill-session -t $SESSION"
# Tail the last 50 lines of output
tmux capture-pane -p -t "$SESSION" -S -50
# Check if Claude is still working (look for spinner or output activity)
tmux capture-pane -p -t "$SESSION" -S -5
# Only send follow-up when the previous task is clearly done
tmux send-keys -t "$SESSION" -l "Now run the test suite and fix any failures"
tmux send-keys -t "$SESSION" C-m
For scripted work where you want output captured to a log file rather than interactive:
TIMESTAMP=$(date +%s)
SESSION="agent-${TIMESTAMP}"
WORK_DIR="/path/to/repo"
LOG="/tmp/agent-${TIMESTAMP}.log"
tmux new-session -d -s "$SESSION" -c "$WORK_DIR"
tmux send-keys -t "$SESSION" \
"claude -p 'Your full task prompt here' --dangerously-skip-permissions 2>&1 | tee $LOG" C-m
echo "Output logged to: $LOG"
echo "Monitor: tmux attach -t $SESSION"
Review a pull request without touching the live project. Always clone or checkout to /tmp.
TIMESTAMP=$(date +%s)
SESSION="pr-review-${TIMESTAMP}"
PR_NUMBER="42"
REPO="owner/repo"
WORK_DIR="/tmp/pr-review-${TIMESTAMP}"
# Clone and checkout the PR branch
git clone "https://github.com/${REPO}.git" "$WORK_DIR"
cd "$WORK_DIR"
gh pr checkout "$PR_NUMBER"
# Start Claude Code in that directory
tmux new-session -d -s "$SESSION" -c "$WORK_DIR"
tmux send-keys -t "$SESSION" "claude --dangerously-skip-permissions" C-m
sleep 3
# Send the review brief
tmux send-keys -t "$SESSION" -l \
"Review PR #${PR_NUMBER}. Check correctness, security, test coverage, and style. Summarise findings."
tmux send-keys -t "$SESSION" C-m
echo "Review session: $SESSION"
echo "Attach: tmux attach -t $SESSION"
Rules for PR reviews:
/workspace/project or the live NanoClaw dir/tmp/pr-review-{timestamp} — isolated, disposablerm -rf /tmp/pr-review-${TIMESTAMP}Work on multiple issues simultaneously without branch-switching conflicts. Each worktree is an independent checkout of the repo on its own branch.
REPO_DIR="/workspace/project" # or wherever the main repo lives
BASE_BRANCH="main"
# Create two worktrees for two independent issues
git -C "$REPO_DIR" worktree add /tmp/fix-issue-101 -b fix/issue-101 "$BASE_BRANCH"
git -C "$REPO_DIR" worktree add /tmp/fix-issue-102 -b fix/issue-102 "$BASE_BRANCH"
# Spawn a Claude Code session per worktree
STAMP=$(date +%s)
tmux new-session -d -s "agent-101-${STAMP}" -c "/tmp/fix-issue-101"
tmux send-keys -t "agent-101-${STAMP}" "claude --dangerously-skip-permissions" C-m
sleep 3
tmux send-keys -t "agent-101-${STAMP}" -l "Fix issue #101: [description]"
tmux send-keys -t "agent-101-${STAMP}" C-m
tmux new-session -d -s "agent-102-${STAMP}" -c "/tmp/fix-issue-102"
tmux send-keys -t "agent-102-${STAMP}" "claude --dangerously-skip-permissions" C-m
sleep 3
tmux send-keys -t "agent-102-${STAMP}" -l "Fix issue #102: [description]"
tmux send-keys -t "agent-102-${STAMP}" C-m
echo "Sessions running:"
echo " tmux attach -t agent-101-${STAMP}"
echo " tmux attach -t agent-102-${STAMP}"
Cleaning up worktrees when done:
git -C "$REPO_DIR" worktree remove /tmp/fix-issue-101
git -C "$REPO_DIR" worktree remove /tmp/fix-issue-102
If Claude Code is rate-capped or unavailable, fall back to Codex CLI. Same tmux pattern — swap the command.
# Check Claude Code
claude --version 2>/dev/null && echo "CC: available" || echo "CC: not found"
# Check Codex
which codex 2>/dev/null && echo "Codex: available" || echo "Codex: not installed"
TIMESTAMP=$(date +%s)
SESSION="codex-${TIMESTAMP}"
WORK_DIR="/path/to/repo"
tmux new-session -d -s "$SESSION" -c "$WORK_DIR"
tmux send-keys -t "$SESSION" \
"codex exec --full-auto 'Your task description'" C-m
echo "Codex session: $SESSION"
echo "Capture: tmux capture-pane -p -t $SESSION -S -50"
tmux new-session -d -s "$SESSION" -c "$WORK_DIR"
tmux send-keys -t "$SESSION" "codex --yolo" C-m
sleep 3
tmux send-keys -t "$SESSION" -l "Your task description"
tmux send-keys -t "$SESSION" C-m
Task tool → preferred for all bounded work
↓ Claude Code session needed (long/interactive)
tmux + claude --dangerously-skip-permissions
↓ CC capped or erroring after 2 retries
tmux + codex exec --full-auto
↓ Codex not installed
Report to user: install codex or retry later
tmux list-sessions 2>/dev/null | grep -E "^(agent|codex|pr-review)-"
tmux kill-session -t "agent-${TIMESTAMP}"
Never use tmux kill-server — it destroys all sessions across all users and projects.
| Prefix | Use |
|--------|-----|
| agent-{timestamp} | Claude Code general coding session |
| codex-{timestamp} | Codex fallback session |
| pr-review-{timestamp} | PR review checkout |
Task tool is the default. Only reach for tmux if the task is genuinely long-running or interactive.
PR reviews always use /tmp. Never run an agent inside /workspace/project for review work — contamination risk.
Never block on tmux. After starting a session, report the session name and move on. Use tmux capture-pane to check progress, never tmux attach from within tool calls.
One task per session. Don't reuse a tmux session for unrelated work. Each session has a clear purpose.
Absolute paths only. tmux sessions do not inherit your working directory reliably. Always use -c "$WORK_DIR" with an absolute path when creating sessions.
Literal key sending. Use tmux send-keys -t SESSION -l "text" (the -l flag) for any prompt text containing special characters. Without -l, characters like $, {, }, * will be interpreted by the shell.
No bash pty:true. That is an OpenClaw-specific API that does not exist here. All interactive terminal work goes through tmux.
No process action:log. Also OpenClaw-only. Use tmux capture-pane -p -t SESSION -S -N to read session output.
Codex check before use. Always run which codex before attempting a Codex session. Don't assume it's installed.
Clean up worktrees. After merging or discarding worktree work, remove it: git worktree remove /tmp/fix-{issue}.
documentation
Report reflect drain spend over a time window — tokens split by cached (cache_read), uncached writes (cache_creation), and io (input+output), with a $ estimate, grouped by day / outcome / model / transcript. Reads the drainer's cost log and surfaces outlier runs and cache-reuse health (the 41.5M-token failure mode = low cache reuse + high cache writes). Use to answer "what is reflection costing me" for the last day / week.
development
Show fleet status — every claude session running on the host, merged across ainb + claude-peers broker + background jobs. Use when you need to enumerate sessions before composing an action, see which sessions have a peer registered (broker-routable) vs tmux-only, check the `summary` of each session, or pipe the list into jq for filtering. Default output: text table. Pass --format json for LLM consumption.
testing
Ordered multi-step prompts to fleet targets, ack-gated between steps via JSONL assistant-turn-end detection. Use for cycles like disconnect→reconnect→verify, or any flow where step N+1 requires step N to have completed first. The skill BLOCKS until each target's transcript shows the next assistant turn finishing OR per-step timeout fires (default 300s).
development
Center control panel — enumerate every claude session that is blocked waiting on something: a user answer (AskUserQuestion fired), an API error retry, an idle assistant turn-end with no follow-up, or an explicit WAITING: marker. Returns rich JSON with signal kind + context per session. Use this when you've stepped away from the fleet and want one place to see everything that wants your attention and answer it.