Overview
Run the same coding tasks through one Claude Code agent with skills and through a subagent setup, then compare test results and reported cost over repeated runs.
Problem or Objective
More in Coding and Code Review
AI Agents and Models
Tools and Integrations
- Tools
- Claude Code
- Prerequisites
- Claude Code with a subscription or API account, a disposable repository with automated checks, and a budget for repeated runs.
How It Works
Pick a handful of small tasks in a test repository, each with an automated check that was written before any run. Define two setups: a single agent given the instructions it needs as skills, and a main agent that delegates to custom subagents. Keep the model, starting commit and time limit the same, and give every run a fresh copy of the repository. Script the runs with claude -p and JSON output, set the allowed tools explicitly, and record pass or fail, diff size, duration and total_cost_usd for each. Approve the run plan, the number of repeats and the spending limit before starting the batch. Read a sample of diffs without looking at which setup made them, then have Claude draft a short comparison that states spread as well as averages.
Implementation Workflow
Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.
- Choose the agentSet up Claude Code.
- Connect the toolsConnect the tools this workflow relies on: Claude Code.
- Check the prerequisitesClaude Code with a subscription or API account, a disposable repository with automated checks, and a budget for repeated runs.
- Gather your detailsCollect what the prompt asks for: Test repository to use, Tasks with their checks, Folder holding the skills, Commit every run starts from, Runs per task and setup.
- Run the starter promptPaste the starter prompt below into Claude Code and adapt it to your case.
- Check against the documentationCompare what you get with the documentation at code.claude.com before you rely on it.
Practical Starter Prompt: Build a harness comparing two agent setups
Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].
In [Test repository to use], write a benchmark script for these tasks: [Tasks with their checks]. Compare setup A, one agent using the skills in [Folder holding the skills], with setup B, a main agent that delegates to subagents. Each run starts from commit [Commit every run starts from] in a fresh copy, uses claude -p with JSON output and an explicit tool allowlist, and logs checks passed, duration, diff size and total_cost_usd. Show me the script, the run count of [Runs per task and setup] per task and setup, and the spending limit, then wait for my approval before running it. Never push or merge.Approve the script, run count and spending limit before the batch starts, since the runs themselves are unattended. Review results and a sample of diffs before drawing any conclusion.
Expected Results and Benefits
This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.
This is a suggested workflow, not a reported outcome. Claude Code documentation describes non-interactive runs with a cost field in JSON output, subagents with their own context, and skills. It makes no claim that either setup is better, and a small task set will not settle that for other work.
Limitations and Considerations
The documentation calls the cost figures client-side estimates, so compare them with your billing. Subagents send their own requests, which count toward the same usage limits as the main conversation. A print-mode run shows no trust dialog, so run only in repositories you trust, with narrow permissions and no production credentials. Keep every failed or timed-out run in the table. Results depend on your setup and were not independently reproduced by Top 200 Repos.
GitHub Repositories
AI Agent Repository
Source code of the agent that does the work.
Official Website
The official site of the main tool or project in this use case.
Visit Website (opens in a new tab)code.claude.com
Related Videos
About anthropics/claude-code
The SECRET Claude Code Upgrade That Has Everyone Going Nuts (Full Guide) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)About anthropics/claude-code
The only Claude Code guide you'll ever need (Opus 4.5) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)Independent creators. Listing a video implies no endorsement, sponsorship or partnership.
Sources
- Run Claude Code programmatically - Claude Code Docs (opens in a new tab)
Project documentation · code.claude.com · Undated · Source checked 2 Dec 2026, 13:21 UTC
What this source supports
- With --output-format json , the response payload includes total_cost_usd and a per-model cost breakdown, so scripted callers can track spend without consulting the usage dashboard .
- Create custom subagents - Claude Code Docs (opens in a new tab)
Project documentation · code.claude.com · Undated · Source checked 2 Dec 2026, 16:07 UTC
What this source supports
- Each subagent runs in its own context window with a custom system prompt, specific tool access, and your permission rules .
- Extend Claude with skills - Claude Code Docs (opens in a new tab)
Project documentation · code.claude.com · Undated · Source checked 2 Dec 2026, 16:14 UTC
What this source supports
- Create a SKILL.md file with instructions, and Claude adds it to its toolkit.
- Claude | The AI assistant for work (opens in a new tab)
Project documentation · claude.com · Undated · Source checked 2 Dec 2026, 14:22 UTC
What this source supports
- Ask Claude for more than an answer: mine data, pull information together, or make a first draft.

