Claude Code Templates explained: configuration catalog, not a model runtime
Reading the dry-run branch: why no-write must be verified per path
Inspect the placement of agent installation before the generic template-copy preview.
What you will learn
- Locate the ordering
- Account for early returns
- Design a safe regression test
Before you start
- Basic npm and Git knowledge
- Disposable project and preserved configuration
Track provenance and file changes without executing the installed instructions.
Key takeaways
- Preview protects a specific copy step.
- Earlier actions may still matter.
- No installer side effect was reproduced here.
Locate the ordering
In the generic setup path, createClaudeConfig builds template configuration and attaches selected hooks and MCPs. If config.agents contains entries, it awaits installAgents before checking options.dryRun.
The dry-run branch then prints template source and destination pairs and returns before copyTemplateFiles. Its position supports a narrow claim about that copy step, not a universal guarantee that nothing earlier can write.
Account for early returns
Specific --agent, --command or related flags route to installMultipleComponents earlier in the function. They do not reach this generic dry-run branch through the normal dispatch path.
The full behavior of those installers was not executed or exhaustively audited here. Do not label this a reproduced destructive incident; it is a source-level reason to distrust a blanket no-side-effect assumption.
Design a safe regression test
Use a disposable directory, stub external downloads and snapshot files before and after each flag combination. Test generic templates, selected agents and direct component flags separately.
A robust future contract would state exactly which paths may write and make dry-run checks precede mutations. That is a proposed improvement, not a patch claimed to exist in the inspected revision.
Decision guide
| Criterion | Option A | Option B |
|---|---|---|
| Best when | You need predictable behavior and easy auditing | You need adaptive optimization and have reliable telemetry |
| Main risk | May leave performance on the table | Can become difficult to explain or debug |
Implementation steps
- 1
Read the agent-install and dry-run order.
- 2
Identify earlier component dispatch branches.
- 3
Test each combination in a disposable target.
Copy-ready example
generic setup -> selected-agent installation
-> dry-run check -> preview and return
-> otherwise copyTemplateFilesFrequently asked questions
Does this prove every dry run writes files?
No. It shows that the generic branch cannot establish a universal no-write guarantee.
Was an upstream fix implemented?
No. The chapter proposes a testable contract without modifying upstream code.
Sources
- Claude Code Templates / cli-tool/src/index.jsSource checked 2026-09-23
- Claude Code Templates / cli-tool/bin/create-claude-config.jsSource checked 2026-09-23