Agent de codage

VérifiéPrudence

Délègue des tâches de codage complexes à des agents en arrière-plan comme Codex, Claude Code ou OpenCode.

Spar Skills Guide Bot
DeveloppementAvancé
29/08/2026
Claude CodeCodex
#background-agents#codex#claude-code#git-worktree#orchestration

Recommandé pour

Synthèse automatique

Ce skill délègue des tâches de développement à des agents CLI (Codex, Claude Code ou OpenCode) lancés en arrière-plan dans des worktrees Git isolés, avec notification et supervision.

Points forts

  • Encadre chaque lancement par des règles explicites : exécution en arrière-plan, PTY pour Codex/OpenCode, mode permissions dédié pour Claude Code.
  • Impose une préparation Git vérifiée avant tout travail mutant : remote canonique, branche de base, SHA de départ, worktree et branche isolés.
  • Prévoit un vrai canal de notification et une surveillance via `process` au lieu de compter sur des heartbeats ou des événements système.
  • Distingue les refs trusted des refs contributeur pour éviter de matérialiser du code non fiable hors d'un sandbox de revue.

Limites

  • Suppose au moins un CLI installé et authentifié (claude, codex ou opencode) et l'activation de la configuration skills.entries.coding-agent.enabled.
  • La fin du document est tronquée au milieu de la procédure pour les PR existantes, laissant la partie « shared branch » incomplète.
  • Vise explicitement les gros travaux et exclut les petites éditions ou la simple lecture de code.
Quand l'utiliser

Pour lancer en arrière-plan une construction de fonctionnalité, une grosse refonte ou une boucle issue-to-PR avec supervision et notification à la fin.

Quand l'éviter

À ne pas utiliser pour une modification triviale, une recherche de code en lecture seule, ou toute exécution dans les répertoires d'état OpenClaw.

Analyse de sécurité

Prudence
Score qualité88/100

The skill is a detailed orchestration guide for delegating coding work to Codex/Claude Code/OpenCode. It contains no curl|sh, no rm -rf, no obfuscated payloads, and no instructions to send secrets or tokens anywhere; in fact it deliberately scrubs API-key env vars and forbids copying credential files. The main risk is inherent to its purpose: it runs third-party coding agents in background with permission bypass and PTY, so it warrants a 'caution' rating rather than 'safe', with the mitigations (isolated worktrees, untrusted-ref sandboxing, forbidden OpenClaw checkouts, no force-push) being good practice that depends on operator compliance.

Points d'attention
  • •Launches Claude Code with `--permission-mode bypassPermissions`, disabling interactive permission prompts so the background worker can execute arbitrary shell/git commands unattended; safety depends entirely on the operator following the isolated-worktree and trusted-ref rules.
  • •Spawns long-running background processes over `bash` with PTY (pty:true), plus network-capable CLI agents that can install npm packages, fetch remotes, and open GitHub PRs — powerful execution surface, though clearly scoped.
  • •Requires an interactive `codex login --device-auth` with a dedicated CODEX_HOME; the skill does state credentials must not be copied from ambient ~/.codex and scrubs CODEX_API_KEY/OPENAI_API_KEY/CODEX_ACCESS_TOKEN from the environment, which mitigates credential-exposure risk.
  • •Git preparation instructs `git fetch --prune`, worktree creation, and non-force pushes; shared-history rewrites are explicitly forbidden, but a misconfigured canonical remote/base branch could still cause writes to unintended refs.
  • •Launches Claude Code with `--permission-mode bypassPermissions`, disabling interactive approval prompts; dangerous if worktree isolation or trust classification is skipped.
  • •Runs coding agents in the background through bash/pty and uses network notifications via `openclaw message send`, creating a powerful execution surface for legitimate automation.
  • •Delegates trust classification of source refs to the orchestrating agent/user; a mistake could allow a permission-bypassed worker to operate on an untrusted contributor ref.
  • •Installs third-party CLI packages via npm (`@anthropic-ai/claude-code`, `@openai/codex`), carrying normal supply-chain risk.
Comment cette analyse est faite

Exemples

Background feature build
Use the coding-agent skill with Codex to implement issue #412 in an isolated worktree, run it in the background, and message me when the PR is ready for review.
Delegated PR review
Have Claude Code review PR #87 in its own isolated checkout and send me the summary plus any blocking concerns when it finishes.
Issue-to-PR loop
Run an issue-to-PR loop with OpenCode for the payment refactor, using an isolated worktree off the upstream default branch, and notify me on completion or failure.

name: coding-agent description: "Delegate coding work to Codex, Claude Code, or OpenCode as background workers; not simple edits or read-only code lookup." metadata: { "openclaw": { "emoji": "🧩", "requires": { "anyBins": ["claude", "codex", "opencode"], "config": ["skills.entries.coding-agent.enabled"], }, "install": [ { "id": "node-claude", "kind": "node", "package": "@anthropic-ai/claude-code", "bins": ["claude"], "label": "Install Claude Code CLI (npm)", }, { "id": "node-codex", "kind": "node", "package": "@openai/codex", "bins": ["codex"], "label": "Install Codex CLI (npm)", }, ], }, }

Coding Agent

Use for background feature builds, PR reviews, large refactors, and issue-to-PR loops. Do not use for simple edits, read-only lookup, ACP thread-bound work, or any run inside ~/.openclaw, $OPENCLAW_STATE_DIR, or active OpenClaw state dirs.

Hard rules

  • Always launch with background:true.
  • Codex and OpenCode: use pty:true.
  • Codex: never inherit ambient CODEX_HOME or the default ~/.codex. Use a separately authenticated coding-agent home and scope it to each Codex command.
  • Claude Code: no PTY; use claude --permission-mode bypassPermissions --print.
  • Capture a real notification route before spawning.
  • Worker must send completion/failure via openclaw message send.
  • Do not rely on heartbeat, system events, or notify-on-exit.
  • Monitor with process; do not kill slow workers without cause.
  • If user asked for a specific agent, use that agent.
  • If worker fails/hangs, respawn or ask; do not silently hand-code instead.
  • Never checkout branches or run background coding agents in ~/Projects/openclaw; use an isolated checkout.
  • Classify the source ref as trusted or untrusted before any checkout or worktree creation. Never materialize a contributor-controlled ref outside the repository's approved untrusted-PR sandbox/review workflow, and never launch a permission-bypassed worker in it.
  • For tasks that modify a Git-backed project, prepare and verify the Git worktree before launch, then include the exact Git preparation block below in the worker prompt.

Mandatory Git preparation

Before launching Codex, Claude Code, or OpenCode for work that modifies a Git-backed project:

  1. Establish the intended target repository, then select its canonical remote. Prefer upstream when it exists and matches that target; otherwise verify origin. Resolve the selected remote's default branch dynamically. Determine the target base from an explicit task branch or authoritative existing-PR metadata; for other shared branches, prove the configured/tracked base or ask. Use the canonical default only for new work with no other specified base. Stop if the repository, remote, or target base cannot be proven.
  2. Classify the source ref as trusted or untrusted before any checkout or worktree creation. For contributor-controlled refs, use the repository's approved untrusted-PR sandbox/review workflow, which must own ref materialization inside the sandbox, or stop. The remaining steps and launch forms are for trusted refs only.
  3. For trusted new work, run git fetch --prune <canonical> immediately before creating a new isolated worktree and branch from <canonical>/<targetBaseBranch>.
  4. For trusted new work, verify the worktree's initial HEAD equals the fetched target-base SHA. Record the canonical remote, canonical default branch, target base branch, base SHA, worktree path, and branch.
  5. For a trusted existing PR or shared branch, fetch the canonical target base and source branch immediately before creating an isolated worktree from the fetched source branch. Record that source ref and starting SHA, report its divergence from the refreshed target base, and do not automatically rebase, merge, reset, force-push, or otherwise rewrite shared history.
  6. Launch the worker in the isolated worktree, never the primary checkout. For OpenClaw, the primary checkout under ~/Projects/openclaw remains forbidden.

For tasks that modify a Git-backed project, append this block to the worker prompt with real values:

Git preparation (mandatory before edits):
- canonical remote: <canonicalRemote>
- canonical default branch: <canonicalDefaultBranch>
- target base branch: <targetBaseBranch>
- fetched target base SHA: <targetBaseSha>
- preparation mode: <new work | existing PR/shared branch>
- checkout trust: trusted
- prepared source ref: <canonicalRemote/targetBaseBranch | fetched trusted source ref>
- prepared start SHA: <preparedStartSha>
- isolated worktree: <worktreePath>
- working branch: <branch>
- preparation receipt: <new work: `git fetch --prune <canonicalRemote>` ran immediately before creation from `<canonicalRemote>/<targetBaseBranch>` | existing branch: the canonical target base and trusted source ref were fetched immediately before the worktree was created from `<preparedSourceRef>` at `<preparedStartSha>`>

Before editing, verify the current directory is the isolated worktree and its initial HEAD equals <preparedStartSha>. For new work, that SHA must equal <targetBaseSha>. Never edit the primary checkout. For existing PR/shared-branch work, report divergence and do not rebase, merge, reset, force-push, or otherwise rewrite shared history unless explicitly asked.
Immediately before the final push or PR for newly authored work, run `git fetch --prune <canonicalRemote>` and `git merge-base --is-ancestor <canonicalRemote>/<targetBaseBranch> HEAD`. If the ancestry check fails, update the new branch onto the latest target base, rerun the relevant proof, and only then push without force. For existing PR/shared-branch work, report a failed ancestry check and follow the repository workflow without rewriting the branch.

For trusted refs, the launcher must create and verify the worktree before starting the editing worker; do not delegate worktree creation to that worker. The approved untrusted-PR workflow must instead own checkout and worktree materialization inside its sandbox. Never start a worker in ~/Projects/openclaw. Read-only tasks and non-project scratch work do not require the Git preparation block.

Notification block

Append this shape to every worker prompt with real values:

Notification route:
- channel: <notifyChannel>
- target: <notifyTarget>
- account: <notifyAccount or omit>
- reply_to: <notifyReplyTo or omit>
- thread_id: <notifyThreadId or omit>

When finished, send exactly one completion or failure message using:
openclaw message send --channel <channel> --target '<target>' --message '<brief result>'
Add --account, --reply-to, or --thread-id only when present above.
Do not use openclaw system event or heartbeat.

If no trustworthy route exists, say completion auto-notify is unavailable.

Launch forms

Write the worker prompt to a temp file first. This avoids shell quoting bugs when the required notification block contains quotes or newlines.

PROMPT=$(mktemp -t openclaw-worker-prompt.XXXXXX)
cat >"$PROMPT" <<'EOF'
Task.
<mandatory Git preparation block>
<notification block>
EOF
printf 'prompt file: %s\n' "$PROMPT"

Use $PROMPT when launching from the same shell/session. If using a separate tool call, substitute the printed path. The launch forms below are for trusted checkouts only; untrusted contributor refs require the repository's approved sandbox/review workflow.

Before the first Codex worker on a host, prepare a dedicated auth home in the foreground. Do not copy auth.json or other credentials from ambient ~/.codex; authorize this home separately. Codex scopes both file and keyring credentials by CODEX_HOME.

CODEX_WORKER_HOME="$HOME/.codex-coding-agent"
mkdir -p "$CODEX_WORKER_HOME"
if ! env -u CODEX_API_KEY -u CODEX_ACCESS_TOKEN -u OPENAI_API_KEY \
  CODEX_HOME="$CODEX_WORKER_HOME" codex login status >/dev/null 2>&1; then
  printf 'Codex coding-agent login required for %s\n' "$CODEX_WORKER_HOME"
  env -u CODEX_API_KEY -u CODEX_ACCESS_TOKEN -u OPENAI_API_KEY \
    CODEX_HOME="$CODEX_WORKER_HOME" codex login --device-auth
fi
printf 'Codex worker home: %s\n' "$CODEX_WORKER_HOME"

The login is an interactive foreground setup step, not a background worker. The launch command repeats the fixed, quoted home and removes ambient Codex and OpenAI auth overrides. Never export the worker home into the OpenClaw Gateway environment.

Codex:

bash pty:true background:true workdir:/path/isolated-worktree command:"env -u CODEX_API_KEY -u CODEX_ACCESS_TOKEN -u OPENAI_API_KEY CODEX_HOME=\"$HOME/.codex-coding-agent\" codex exec - < \"$PROMPT\""

Claude Code:

bash background:true workdir:/path/isolated-worktree command:"claude --permission-mode bypassPermissions --print < \"$PROMPT\""

OpenCode:

bash pty:true background:true workdir:/path/isolated-worktree command:"opencode run < \"$PROMPT\""

Long issue-to-PR work

  1. Create/reuse a GitHub issue as durable spec.
  2. Include issue URL, repo, canonical remote/default branch, target base branch/SHA, isolated worktree, working branch, expected PR, proof, and notification route.
  3. Include the mandatory Git preparation block, then tell the worker to implement, test, run review until no accepted actionable findings, and open the PR.
  4. Return issue URL and sessionId immediately.
  5. Monitor with process; cancel through Task Registry if mirrored there.

Scratch Codex

Codex needs a trusted git repo. This throwaway scaffold is not project work and has no canonical remote, so the Git preparation block does not apply:

SCRATCH=$(mktemp -d)
git -C "$SCRATCH" init
PROMPT=$(mktemp -t openclaw-worker-prompt.XXXXXX)
cat >"$PROMPT" <<'EOF'
Build X.
<notification block>
EOF
printf 'prompt file: %s\n' "$PROMPT"
bash pty:true background:true workdir:$SCRATCH command:"env -u CODEX_API_KEY -u CODEX_ACCESS_TOKEN -u OPENAI_API_KEY CODEX_HOME=\"$HOME/.codex-coding-agent\" codex exec - < \"$PROMPT\""

Process actions

  • list: running/recent sessions.
  • poll: status.
  • log: output.
  • submit: send input + Enter.
  • write: raw stdin.
  • paste: paste text.
  • kill: terminate.

Status to user

  • Say what started, where, and sessionId.
  • Update only on milestone, worker question, error, user action needed, or finish.
  • If killed, say why.

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/coding-agent-mte1ll7l/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/coding-agent-mte1ll7l' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/coding-agent-mte1ll7l/download' --output '.skill-downloads/coding-agent-mte1ll7l/SKILL.md.part' && mv '.skill-downloads/coding-agent-mte1ll7l/SKILL.md.part' '.skill-downloads/coding-agent-mte1ll7l/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/coding-agent-mte1ll7l/SKILL.md' && test -s '.skill-downloads/coding-agent-mte1ll7l/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/coding-agent' && cp -R '.skill-downloads/coding-agent-mte1ll7l' '.claude/skills/coding-agent'

Codex
test -f '.skill-downloads/coding-agent-mte1ll7l/SKILL.md' && test -s '.skill-downloads/coding-agent-mte1ll7l/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/coding-agent' && cp -R '.skill-downloads/coding-agent-mte1ll7l' '.agents/skills/coding-agent'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/coding-agent-mte1ll7l'

openskills read 'coding-agent-mte1ll7l'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/coding-agent-mte1ll7l/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires