Stop Hand-Coding Big Tasks, Spawn a Coding Agent Instead

If a task is big enough to need exploration, iteration, or parallel work, you should stop hand-coding it in the main session. This skill gives your agent a clean rule set for when to delegate coding work, how to launch the right coding agent, and how to keep the human informed while it runs. The real value is not just writing code faster, it is avoiding the usual failures: wrong directory, wrong execution mode, and zero visibility once background work starts.

Save this as `SKILL.md` in your skills folder, then swap `/path/to/project` and the agent command for your actual setup before using it.

---
name: coding-agent
description: Delegate substantial coding work to a dedicated coding agent, and monitor it through exec/process instead of hand-coding everything in the main session.
---

# Coding Agent

Use this skill when the task is large enough to benefit from a dedicated coding agent instead of direct inline edits.

## Use this for
- building new features or apps
- reviewing pull requests in an isolated checkout
- refactoring large codebases
- multi-step coding work that needs file exploration and iteration

## Do not use this for
- tiny one-line fixes
- simple file reads
- thread-bound ACP harness requests in chat
- any coding agent run inside `~/.openclaw`

## Execution rules
- Prefer a dedicated coding agent over manual patching for large coding tasks.
- For Codex, OpenCode, and Pi, use PTY mode when launching through `exec`.
- For Claude Code, use `claude --permission-mode bypassPermissions --print` without PTY.
- Always set a focused `workdir` so the agent stays inside the right project.
- For long-running work, launch once with `background:true`, then monitor with `process`.
- Keep the user updated when work starts, when something important changes, and when it finishes.

## Safe patterns

### Codex
```text
exec command:"codex exec --full-auto 'Implement the requested feature'" workdir:/path/to/project pty:true
```

### Claude Code
```text
exec command:"claude --permission-mode bypassPermissions --print 'Implement the requested feature'" workdir:/path/to/project
```

### Background run + monitoring
```text
exec command:"codex exec --full-auto 'Refactor the auth flow'" workdir:/path/to/project pty:true background:true
process action:log sessionId:<session-id>
process action:poll sessionId:<session-id>
process action:submit sessionId:<session-id> data:"yes"
```

### Safe PR review in temp checkout
```text
exec command:"codex review --base origin/main" workdir:/tmp/repo-review pty:true
```

## Guardrails
- Never run a coding agent in the OpenClaw state directory.
- Never review or mutate a live repo when an isolated temp dir or git worktree is safer.
- Do not silently take work back over by hand if the user explicitly asked for a coding agent.
- If the agent stalls or fails, either respawn it or ask the user what they want next.

## Completion pattern
When the coding agent finishes, summarize:
- what changed
- where it changed
- whether tests passed
- what the user should review next