claude-code-delegate
Delegate programming tasks to Claude Code CLI
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/chenhab03/claude-code-delegateClaude Code Delegate
Delegate programming tasks to local Claude Code CLI.
RULE: You NEVER write code directly. ALL programming goes through claude -p.
Prerequisites Check (Run Before First Use)
Before delegating any task, verify the environment is ready:
- Claude Code CLI installed: Run
which claude— if not found, tell user:npm install -g @anthropic-ai/claude-code - API key configured: Run
claude --version— if it errors about auth, tell user to runclaudeand complete login - Write-guard active (STRONGLY RECOMMENDED): Check if a write-guard plugin exists at
.openclaw/extensions/write-guard/. If not, warn the user:⚠️ No write-guard detected. The delegate uses
--permission-mode bypassPermissionswhich grants full filesystem read/write access. It is strongly recommended to set up a write-guard plugin before running tasks. See README.md for setup instructions.
Only proceed with delegation after items 1 and 2 pass. Item 3 is a warning — the user may choose to proceed without it, but should be informed of the risk.
When to Trigger
Auto-trigger on ANY of these:
- Write, modify, refactor, debug code
- Create project files or directories
- Run tests, lint, build
- Code review, architecture planning
- Edit any file (except memory/ and .relationship/)
Manual trigger: user sends /code <task>
Do NOT trigger: chat, emotional interaction, information lookup.
Command Template
cd "<project_dir>" && claude -p "<task_description>" --output-format text --max-turns 10 --permission-mode bypassPermissions
Parameters
| Param | Purpose | Required |
|---|---|---|
-p | Non-interactive mode | Yes |
cd "<dir>" && | Set working dir (no --cwd flag exists) | Yes |
--output-format text | Plain text output | Recommended |
--max-turns 10 | Limit execution rounds | Recommended |
--permission-mode bypassPermissions | Auto-accept file edits (requires write-guard, see Prerequisites) | Recommended |
--continue | Resume previous session (for debugging/iteration) | When fixing bugs in same project |
FORBIDDEN: --dangerously-skip-permissions
Timeout
Set exec timeout to 300 (5 minutes). The delegate needs time to write code.
Async Flow (CRITICAL)
The delegate MUST NOT block you. You must remain responsive to the user at all times.
Correct Flow
Step 1: exec claude -p "..." → get session ID (e.g. "marine-sage")
Step 2: IMMEDIATELY reply to user → "On it! Working on that now."
Step 3: END your turn → do NOT use any more tools
Step 4: When user sends next message → check with: exec "process poll marine-sage --timeout 1000"
Step 5: If done → relay results. If not done → tell user "still working", continue chat
WRONG (causes blocking)
exec claude -p "..." → process poll → (BLOCKED! user waits with no response)
Rules
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-chenhab03-claude-code-delegate": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
claude-oauth-renewal
Automatically detect and renew expired Claude Code OAuth tokens via heartbeat. 3-tier renewal: refresh token → Chrome browser automation → user alert.
relationship-os
Relationship OS — Enables AI agents to build human-like relationships with users through event memory, open threads, exclusive memories, agent stances, and relationship growth stages. Automatically activates when conversations involve emotional exchanges, significant events, follow-up commitments, or personal preferences.