About 6 of the 60 scored questions come from this domain. It has 4 skills:
Lessons
Skill
Parallel Agent Orchestration for Engineering Work
Fanning out engineering work: isolation, decomposition, merge
Running many coding agents at once is cheap to start and expensive to get wrong. Three decisions decide whether a fan-out finishes cleanly: how the agents are isolated, how the work is cut, and how the results come back together. A fourth skill is reading fleet numbers to see which of the three went wrong.
1. Pick the isolation that matches the work
The Claude Code documentation frames the choice with three questions: who coordinates the work, do the workers need to talk to each other, and do the tasks touch the same files.
| Approach | Fits when | File isolation |
|---|
| Subagents | Side tasks that report a summary back to one session | Each can get its own worktree (isolation: worktree) |
| Agent teams | Workers must share findings and coordinate through a task list | None: teammates are not isolated in worktrees |
| Dynamic workflows | The job is too big to coordinate turn by turn, or results need cross-checking | The script can transform each item in an isolated copy |
A git worktree gives each agent its own checkout, so parallel edits do not collide on disk. It does not stop two agents from making changes that conflict when merged. Isolation moves the conflict from "overwritten file" to "merge conflict"; only decomposition removes it.
2. Know what a worktree does not carry
- Untracked files. A worktree is a fresh checkout. Gitignored files such as
.env are absent unless a .worktreeinclude file lists them. Only files that match a pattern and are also gitignored are copied. - Your unpushed work. New worktrees branch from the repository's default branch. If the agents must build on in-progress commits, set
worktree.baseRef to "head". - Installed dependencies. Each worktree needs its own setup.
- Cleanup in non-interactive runs. Runs with
-p have no exit prompt, so their worktrees stay, and stay locked. A pipeline that creates worktrees must remove them itself (git worktree unlock, then git worktree remove).
3. Decompose so each agent owns its files
Good fan-out units are independent, have a check the agent can run alone, and touch a set of files nobody else touches. The agent teams page is blunt: two teammates editing the same file leads to overwrites, and sequential tasks, same-file edits, or work with many dependencies are better done by one session or subagents.
Look for the shared seams before you fan out: a common types file, a lockfile, a route registry, generated code, a changelog. Then choose one of these:
- Serial first, then parallel. Land the shared change (the new interface, the dependency bump) in one commit, then fan out from that commit.
- Single owner. One agent owns the shared file; the others send it requests or leave it alone.
- Regenerate, do not merge. For lockfiles and generated code, exclude them from agent branches and regenerate once after integration.
Adding more agents to a job that is serial at heart. Each agent has its own context window and consumes tokens independently, so cost rises with the agent count while the conflict rate rises faster. If most tasks wait on one shared change, the right number of parallel agents for that change is one.
4. Decide the merge strategy before the first agent starts
- Small branches, merged often, each rebased on the integration branch and re-verified after rebase. A branch that passed its tests before the rebase has not been tested against its siblings.
- An ordered merge queue when tasks have dependencies; block dependent tasks until their parent lands.
- A rule for conflicts: mechanical ones go back to the owning agent with the new base; semantic ones (two agents changed the meaning of the same function) go to a human.
5. Read the fleet, not the agent
One transcript rarely shows a fleet problem. Aggregate by task, file, and time:
| Signal | Likely cause | First move |
|---|
| Conflicts cluster on a few files | Shared seam was not partitioned | Give the file one owner or regenerate it |
| Many agents fail the same way in the first minutes | Environment: missing env file, dependency, credential | Fix setup once, not per agent |
| Tokens per merged change climb as agents are added | Duplicate or blocked work | Reduce concurrency, recut the tasks |
| Branches pass alone, integration fails | No verification after merge | Verify on the integrated branch |
In a dynamic workflow, also remember how resume works: a failed agent runs again on relaunch, and so does every agent the script starts after it, even ones that had completed. Order the script so cheap, failure-prone steps come early.
Sources
Run agents in parallel
Run parallel sessions with worktrees
Orchestrate teams of Claude Code sessions
Orchestrate subagents at scale with dynamic workflows
Skill
Verification and AI Code Review Operations
When agents write faster than people review: shadow, calibrate, then gate
Coding agents raise the number of changes without raising the number of reviewers. The answer is not to remove review and not to review everything by hand. It is to build a verification pipeline in stages, and to earn each increase in automation with evidence.
1. Layer the checks
- Deterministic checks the agent runs itself: tests, typecheck, lint. The best-practices guide notes that Claude stops when the work looks done; without something to run, "looks done" is all it has. Ask for evidence: the command and its output.
- CI as a required check. It is the only layer that builds and runs the code.
- AI review by a reviewer that has not seen how the code was written. Managed Code Review reads the diff and surrounding code without building or running it, and includes a verification step that filters false positives before findings are posted.
- Human review, spent where it matters most.
2. Know what an AI review result means
- By itself, a Code Review does not approve or block a pull request. Its check run does not conclude as a failure. A branch rule that requires that check to pass gates nothing.
- A review with no findings does not mean the code is error-free or secure.
- Review instructions (
REVIEW.md) are read from the base or default branch, never from the pull request's own changes, so an agent's PR cannot rewrite the rules it is judged by.
3. Start in shadow mode
Shadow mode means the automated reviewer runs on real pull requests and records what it would decide, while humans still decide. Claude Approvals has this built in: a policy file with mode: observe makes the check show what the policy would decide without enforcing it. Reviews and classifier runs are still billed in observe mode, so shadowing has a cost; that cost buys the data you need.
Two things are easy to miss when you leave shadow mode. Deleting the mode: observe line enforces the policy, but the check blocks a merge only where you make it a required check in GitHub. And a policy condition cannot read CI results, so CI stays a separate required check.
4. Calibrate against human review before gating
From the shadow period, build a table of AI decision against human decision on the same pull requests. Measure, per change class and per path:
- Miss rate: changes the AI would have passed that humans rejected, or that later caused a defect. This is the number that decides whether humans can be removed.
- False-alarm rate: changes the AI flagged that humans judged fine. This decides whether developers will keep reading the findings.
- Coverage: enough samples in each class to trust the rate. An overall agreement of 95% can hide a class with 12 samples and 4 misses.
Seed the sample with known-bad changes. Agreement on easy pull requests says little about the hard ones.
Promoting on overall agreement. Gate by class: let the AI decide where its miss rate is measured and low (test fixtures, docs, generated config), keep people where it is unmeasured or high (auth, billing, migrations). The Approvals documentation uses the same shape: billing code can need two people, and test fixtures one person once Code Review passes.
5. Keep the signal clean
A reviewer asked to find problems will always find something. If nit volume is high, developers stop reading, and the important finding is lost with the rest. Tune with a REVIEW.md: redefine what counts as Important for this repository, cap nits, skip generated files and anything CI already enforces, and require evidence for a class of finding that is often wrong. Lowering the review level makes the review cheaper and less thorough; it does not change the mix of findings you asked for.
6. Design human oversight on purpose
| Design choice | Why |
|---|
| Route by risk: path, size, change class | Puts scarce review time on changes that can hurt |
| Sample the auto-approved stream | Detects drift in the reviewer after you stop looking |
| Track escaped defects by which gate passed them | Tells you which layer to tighten |
| Demote on evidence | If the miss rate rises, a class goes back to human review |
When two actions both sound right, the order usually decides it: observe before enforce, measure before gate, narrow scope before wide scope.
Sources
Code Review
Customize Code Review
Claude Approvals
Claude Approvals policy file reference
Best practices for Claude Code
Skill
Unattended and Event-Driven Agent Operations
Agents that run without you: goals, schedules, events, and when to stop
An unattended agent has nobody to ask and nobody watching. Every design question follows from that: what starts it, what it may do, how it knows it is finished, what it can undo, and who it tells.
1. Choose the trigger by what should start the next run
| Mechanism | Starts when | Survives |
|---|
/goal | The previous turn ends and the condition is not yet met | The session; restored on resume |
/loop (session-scoped) | An interval elapses | The session only; recurring tasks expire after a set period |
| Cloud scheduled task | A schedule, an API call, or a GitHub event | Runs without your machine |
claude -p in CI | Your pipeline's event | Whatever the pipeline gives it |
The documentation's rule of thumb: cloud tasks for work that should run reliably without your machine, Desktop tasks when you need local files and tools, /loop for quick polling during a session. Session-scoped tasks do not catch up on missed fires.
2. Write a goal the evaluator can judge
With /goal, a separate model checks the condition after every turn, so completion is decided by a fresh model and not the one doing the work. That evaluator judges only what appears in the conversation. It does not run commands or read files. So:
- State one measurable end state and how to prove it: "
npm test exits 0". - Add the constraints that must hold on the way: "no test file is modified".
- Bound the run with a turn or time clause in the condition.
A goal does not change the permission mode. A goal in a session that still prompts for every command is not unattended.
3. Decide permissions before the run, because nobody can answer during it
- In a non-interactive
-p run, a tool call that needs approval is denied unless something approves it. Pre-approve the narrow set of tools the job needs with --allowedTools or allow rules. dontAsk mode denies every call that would otherwise prompt, which suits locked-down CI.--permission-prompts none exists for runs where nobody is available to answer.--bare skips hooks, plugins, MCP servers and CLAUDE.md. Do not use it for a run that depends on a hook as a guardrail.- Cloud scheduled tasks start in auto mode. All of your connectors are included by default, and Claude can use an included connector during a run, including writes. Remove the ones the task does not need.
4. Event-driven responders
A first responder for a CI failure or an alert is a task with a GitHub event trigger or an API trigger called from the alerting system. Three properties matter:
- Each event is a new session. Sessions are not reused across events, so two events produce two independent sessions with no shared memory. Deduplicate in the caller or have the prompt check for an existing branch or ticket first.
- The prompt is the whole briefing. It must be self-contained and explicit about what to do and what success looks like.
- Loops. An agent whose output triggers its own trigger will run forever. The GitHub Action rejects bot actors unless you allow them for this reason.
Scope a first responder to diagnosis and reversible actions: collect logs, bisect, open a draft fix on a branch, post findings. Leave rollback of production and force-pushes to a human or to a deterministic runbook.
5. Checkpoints: know what can be undone
Claude Code's checkpoints are for quick, session-level recovery of files Claude edited. A file changed only by a Bash command is not tracked, and edits from other sessions are normally not captured. Nothing outside the working tree is rewound: a migration that ran, a message that was sent, a branch that was pushed.
Treating file rewind as a rollback plan. For an unattended run, the durable checkpoint is a commit on a branch after each verified step, plus a progress note the next run can read. For external side effects the only safeguards are to not grant them, or to gate them behind approval.
6. Notify and escalate
| Situation | Design |
|---|
| Finished and verified | One summary with evidence (command and output), linked to the branch or PR |
| Blocked on permission or a repeated denial | Stop and page the owner; a waiting prompt nobody sees is a silent outage |
| Budget or turn limit reached | Stop, commit progress, report what remains |
| Action is irreversible or outside scope | Hand off with the diagnosis; do not attempt |
Remember whose name is on the work: actions a cloud scheduled task takes through your GitHub identity or connectors appear as you.
Sources
Keep Claude working toward a goal
Run prompts on a schedule
Automate work with scheduled tasks
Run Claude Code programmatically
Claude Code GitHub Actions
Checkpointing
Skill
Organization-Wide Coding Agent Configuration
Configuring coding agents for a whole organization
Organization-wide configuration answers five questions: what is enforced, how it reaches every machine, which tools agents may connect to, what you can see, and what may be shared between teams. Each has a mechanism in Claude Code, and each mechanism has one detail that decides whether it actually holds.
1. Managed settings sit at the top
Settings precedence, highest first: managed settings, command line, project local, shared project, user. Nothing in a developer's own files overrides a managed key. Two details matter in practice:
- Lists merge. When the same list key, such as
permissions.allow, appears in more than one file, Claude Code combines the lists. A managed allow list is therefore a floor, not a ceiling, until you also set the matching lock: allowManagedPermissionRulesOnly, allowManagedHooksOnly, allowManagedMcpServersOnly. - Lock the escape hatches. Put the deny rules you rely on in the managed source, and disable bypass mode there with
disableBypassPermissionsMode.
2. Choose the delivery mechanism by what you control
| Mechanism | Use when | Watch for |
|---|
MDM policy or system managed-settings.json | You manage the devices | A local administrator can edit the file; redeploy on a schedule |
| Server-managed settings (admin console) | No MDM, or unmanaged devices | Fetched at startup and refreshed while running; a failed fetch falls back to cache or to no policy unless you force fail-closed startup |
forceRemoteSettingsRefresh makes the client exit when the startup fetch fails. That trades availability for assurance: decide which one the organization needs. Developers can run /status to see which sources apply.
3. MCP: pick the restriction level
| Pattern | Effect | Mechanism |
|---|
| Fixed deployment | Everyone gets exactly your servers; their own do not load | managed-mcp.json |
| Approved catalog | Users add what they want from your list; anything else is blocked | allowedMcpServers with allowManagedMcpServersOnly |
| Soft allowlist | Users can broaden the list in their own settings | allowedMcpServers alone |
| Denylist only | Block known-bad servers | deniedMcpServers |
Shipping an allowlist without its lock and calling it enforced. Without allowManagedMcpServersOnly, a developer's own entries merge in. Also note that managed-mcp.json is a standalone file and cannot be delivered through server-managed settings, so an organization without device management cannot use the fixed-deployment pattern that way.
4. Telemetry
Claude Code exports OpenTelemetry metrics and events when CLAUDE_CODE_ENABLE_TELEMETRY is set. For a fleet:
- Set the variables in the
env block of managed settings. Claude Code ignores the exporter variables in a repository's project settings, so a repository cannot turn telemetry on, choose where it goes, or capture content. - A managed OTLP endpoint pins the destination; conflicting developer-set endpoints are removed at startup.
- Prompt text and tool details are redacted by default and are enabled by separate variables. Turn them on only if your privacy rules allow it.
- Use
OTEL_RESOURCE_ATTRIBUTES to tag team, department or cost centre. More attributes mean higher cardinality and storage cost. - The cost metric is an estimate. Use the provider's billing data for chargeback.
5. Gateway routing
A gateway gives central credentials, budgets, routing and audit. The rollout guide's order is: confirm the gateway forwards what Claude Code sends (headers and body unchanged), test every model name it routes, issue developer credentials, run Claude Code through it yourself, then distribute ANTHROPIC_BASE_URL and the credential through managed settings, and verify from a developer machine. Issue one key per developer, not a shared key: that is what makes per-developer usage attribution and individual offboarding work.
6. A bar for sharing prompts, Skills, plugins and MCP servers
A plugin can execute arbitrary code on the machine with the user's privileges: hooks are shell commands, MCP servers are processes, and Skills enter Claude's context as instructions. Treat shared agent assets like shared code:
- Restrict the source. The managed
strictKnownMarketplaces allowlist decides which marketplace sources plugins may come from. It matches the marketplace's source, not individual plugins, so the review of each plugin has to happen in the marketplace repository. - Review before listing. A named owner, a read of every hook and server command, least-privilege tool access, and an evaluation that shows the asset does what it claims.
- Control change. With auto-update on, the files you reviewed can change on disk. Pin what you reviewed and review updates the same way.
- Measure and retire. Track use and remove what is unowned.
Sources
Settings files and precedence
Deploy managed settings
Configure server-managed settings
Control MCP server access for your organization
Monitoring
Roll out an LLM gateway for your organization
Manage Claude Code plugins for your organization
Plugin security and trust