Coding Lead
by @beyound87
Coding execution skill for any implementation-focused agent. Current production path is claude-only with simple tasks direct, medium tasks preferring ACP run...
clawhub install coding-leadπ About This Skill
name: coding-lead description: Coding execution skill for any implementation-focused agent. Current production path is claude-only with simple tasks direct, medium tasks preferring ACP run or direct acpx, and complex tasks handled via existing agent continuity plus context files instead of ACP session persistence. Integrates with qmd and smart-agent-memory when available.
Coding Lead
> This is a coding execution skill for any agent that owns implementation work. > It defines how coding work runs, not who should own the task. > In multi-agent teams, routing may be handled elsewhere; in single-agent use, this skill still works directly.
Route by complexity. Current production path is claude-only. Do not depend on ACP session persistence in IM threads; use direct execution, direct acpx, and existing implementation session continuity instead.
Task Classification
| Level | Criteria | Action |
|-------|----------|--------|
| Simple | Single file, <60 lines, clear local scope | Direct: read/write/edit/exec |
| Medium | 2-5 files, clear scope, likely follow-up questions | Prefer Claude ACP mode:"run" or direct acpx β fallback direct |
| Complex | Multi-module, architecture, needs continuity | Use existing implementation session continuity + context files + direct acpx/direct execution |
When in doubt, go one level up.
Practical default rule
run) when available; otherwise direct acpxsession the default pathMulti-agent dispatch rule (when dispatching to other agents)
runtime.type: "acp" in openclaw.json): use sessions_spawn(runtime="acp"), may include streamTo="parent"sessions_spawn(runtime="subagent"), never include streamToruntime.type: "acp", use ACP; otherwise use subagentTech Stack (New Projects)
| Layer | Preferred | Fallback | |-------|-----------|----------| | Backend | PHP (Laravel/ThinkPHP) | Python | | Frontend | Vue.js | React | | Mobile | Flutter | UniApp-X | | CSS | Tailwind | - | | DB | MySQL | PostgreSQL |
Existing projects: follow current stack. New: propose first, wait for confirmation.
Tool Detection & Fallback
All tools are optional. Detect once per session:
| Tool | Check | Fallback |
|------|-------|----------|
| smart-agent-memory | node ~/.openclaw/skills/smart-agent-memory/scripts/memory-cli.js stats ok? | memory_search + manual .md writes |
| qmd | qmd --version ok? | grep (Linux/macOS) / Select-String (Windows) / find |
| ACP | See ACP detection below | Direct read/write/edit/exec |
Notation: [memory] [qmd] [acp] = use if available, fallback if not.
ACP Detection & Routing
Run once per session, stop at first success:
Step 1: Try sessions_spawn (timeout: 30s)
sessions_spawn(runtime: "acp", agentId: "claude", task: "say hello", mode: "run", runTimeoutSeconds: 30)
Preferred in OpenClaw because it cleanly supports both:
mode: "run" for one-shot coding tasksmode: "session" for persistent long-context coding threadsACP_MODE = "spawn". Done.Step 2: Try acpx CLI (timeout: 30s)
# Detect acpx path (OS-dependent)
Windows: %APPDATA%\npm\node_modules\openclaw\extensions\acpx\node_modules\.bin\acpx.cmd
macOS/Linux: $(npm root -g)/openclaw/extensions/acpx/node_modules/.bin/acpx
Use exec with timeout
acpx claude exec "say hello" # timeout 30s
ACP_MODE = "acpx". Done.Step 3: No ACP available
ACP_MODE = "direct". Agent executes all coding tasks directly with read/write/edit/exec. Load team standards (see Coding Standards below).Cache the result
Set a session variable (mental note):ACP_MODE = "spawn" | "acpx" | "direct"
ACP Agent Policy
Current supported ACP coding agent: claude only.
Rule Priority
Apply rules in this order: 1. Matched skill instructions (this skill wins for coding execution when loaded) 2. Agent role fallback only when the coding skill is not loaded or does not cover the case 3. Team templates / README / generated docs provide boundaries and ownership, not competing execution logic
If the same topic appears in multiple places, follow the highest-priority source above and simplify the lower-priority wording instead of combining conflicting chains.
Context File Lifecycle
Context files exist to preserve continuity across the current code chain, but they must stay tidy.
/.openclaw/ context-.md .openclaw/archive/ if it has durable follow-up valueContext Naming
Recommended pattern:
/.openclaw/context-.md Coding Standards β Two Layers, No Overlap
Layer 1: Project-level (Claude Code owns)
Projects may have their ownCLAUDE.md, .cursorrules, docs/ β these are Claude Code's responsibility. It reads them automatically. Do NOT paste project-level rules into ACP prompts.Layer 2: Team-level (OpenClaw owns)
shared/knowledge/tech-standards.md β cross-project standards (security, change control, tech stack preferences). Only relevant for direct execution (simple tasks without ACP).When spawning ACP
When executing directly (no ACP)
Load standards once per session, first match wins: 1.shared/knowledge/tech-standards.md (team-level, if exists)
2. Built-in defaults (below, if nothing exists)Built-in Defaults (fallback for direct execution)
Simple Tasks
1. Read target file(s) (standards already loaded per above) 2. [memory] Recall related decisions 3. Execute with read/write/edit/exec 4. [memory] Record what changed and why
Medium/Complex Tasks
Step 1: Build Context File
Write to (ACP reads from disk, not from prompt):
# [qmd] or grep: find relevant code
[memory] recall + lessons: find past decisions
Standards already loaded (see "Coding Standards Loading" above)
Write context file with 3-5 key rules from loaded standards β do NOT paste full file
Minimal context file structure:
# Task Context:
Project β path, stack, architecture style
Relevant Code β file paths + brief descriptions from qmd/grep
History β past decisions/lessons from memory (if any)
Long-term Knowledge Boundary β durable facts or decisions worth preserving outside this file; if none, say "none"
Constraints β task-specific rules only (NOT general coding standards β Claude Code has CLAUDE.md)
Full template with examples β see references/prompt-templates.md
Step 2: Lean Prompt
Use the smallest prompt that still preserves correctness. Start with the task and acceptance criteria. Add only the minimum extra header needed for the run to be unambiguous.
Project: | Stack:
Context file: .openclaw/context-.md (read it first if it exists)Task
Acceptance Criteria
[ ]
[ ] Tests pass, no unrelated changes, clean code Before finishing: run linter + tests, include results.
When done: openclaw system event --text "Done: " --mode now
Step 3: Spawn (use detected ACP_MODE)
# ACP_MODE = "spawn", medium task:
sessions_spawn(runtime: "acp", agentId: "claude", task: , cwd: , mode: "run")Complex task primary path:
Use the existing implementation session + context file + serial follow-ups.
If ACP is helpful, prefer bounded Claude run invocations or direct acpx commands inside the project directory.ACP_MODE = "acpx":
exec: cd && acpx claude exec ""ACP_MODE = "direct":
Skip spawn, execute directly with read/write/edit/exec
run vs sustained execution
Step 4: Fallback Detection
| Condition | Action | |-----------|--------| | Spawn failed / timeout | β Direct execution | | Empty output / no file changes | β Direct execution | | Partial completion | β Agent fixes remaining |
Fallback: [memory] log failure β agent executes directly β report to user.
Never silently fail. Always complete or report why not.
Step 5: Verify & Record
1. Check acceptance criteria + run tests 2. Verify the final result against the task, acceptance criteria, and any explicit no-go constraints before declaring done 3. [memory] Record: what changed, decisions, lessons; only promote durable facts to long-term memory 4. Clean up context file
Complex Tasks
Read references/complex-tasks.md only for Complex-level tasks β roles, QA isolation, parallel strategies, RESEARCHβPLANβEXECUTEβREVIEW flow.
Context Reuse (Token Savings)
run: cheaper than opening a persistent sessionMemory Integration
[memory] Before: recall related work + lessons for context file. [memory] After: record what changed, decisions made, lessons learned. Cross-session: agent remembers across sessions; Claude Code doesn't. This is the core advantage.
Parallel Execution Boundaries
Parallelism is allowed in the current production path, but only with explicit boundaries.
Recommended shape:
run, direct acpx, or direct execution)Good parallel cases:
run while direct tasks proceed elsewhereBad parallel cases:
See references/prompt-templates.md for multi-project examples.
Smart Retry (max 3)
1. Analyze failure β 2. Adjust prompt β 3. Retry improved β 4. Max 3 then fallback/report. Each retry must be meaningfully different.
Progress Updates
Start β 1 short message. Error β immediate report. Completion β summary. Fallback β explain.
Safety
cwd explicitly to the project directory