Planning, Iteration, and CI Automation
Understand when to use direct execution or plan-first mode in Claude Code to prevent errors in AI system workflows. Learn to run automated, non-interactive commands using --print and design CI pipelines that integrate Claude Code for efficient and safe project reviews.
Claude Code can either execute tasks directly or produce a plan first and wait for approval before making any changes. The choice between these modes is an architectural decision with real consequences: direct execution is fast, but irreversible changes happen immediately. Plan-first gives the developer a checkpoint to catch wrong assumptions before they become wrong files. This lesson covers both modes, when each is appropriate, and how to run Claude Code in automated pipelines without interactive sessions. By the end of this lesson, we will be able to:
Explain the difference between direct execution and plan-first mode in Claude Code
Identify the task types where plan-first mode prevents expensive mistakes
Use
claude --printto run Claude Code non-interactively and capture structured outputSketch a CI automation pipeline that uses a project command to produce reviewable output
Direct execution vs. plan-first
In the default interactive mode, Claude Code reads a task, decides what to do, and starts executing: reading files, writing code, and running shell commands. The developer sees each tool call as it happens and can deny individual steps. Plan-first mode changes this sequence. Claude Code produces a written plan describing what it intends to do and then stops. No files are changed. No commands are run. The developer reads the plan, requests changes if needed, and then approves execution. Only after approval does Claude Code begin making changes.
Mode | When Changes Happen | Developer Checkpoint |
Direct execution | Immediately, as Claude decides each step | Per tool call (approve/deny) |
Plan-first | Only after the developer approves the plan | Before any changes begin |