CC
0 XP
0

Chapter 1: Ground Zero

Multi-File Changes

build5 min

Multi-File Changes

Real development rarely involves touching just one file. A new feature usually means a new component, updated imports, shared types, and maybe a style change. Claude Code handles all of this in a single conversation turn.

Build a Todo component

Let's ask Claude Code to create the core of our todo app:

"Create a TodoItem component that displays a todo with a checkbox, title, and delete button. Use Tailwind for styling and lucide-react for the icons. Also create a Todo type in src/types/todo.ts."

Watch what happens:

  1. Claude Code creates src/types/todo.ts with the Todo interface
  2. Claude Code creates src/components/TodoItem.tsx importing the type
  3. Both files are internally consistent -- the component uses the exact type definition it just created
šŸ’”Info

This is what makes Claude Code different from a regular AI chat. It doesn't just generate isolated code snippets -- it creates files that work together, with correct imports and shared types.

See the files it created

File StructureYour structure may look different — that's OK

src/ ā”œā”€ā”€ types/ │ └── todo.ts — Todo interface definition ā”œā”€ā”€ components/ │ └── TodoItem.tsx — TodoItem component ā”œā”€ā”€ lib/ │ └── utils.ts — cn() utility (from last section) └── app/ ā”œā”€ā”€ layout.tsx — Root layout └── page.tsx — Home page

Wire it all together

Now ask Claude Code to connect everything:

"Update the home page to show a list of 3 sample todos using the TodoItem component. Create the sample data using our Todo type."

Claude Code will:

  1. Open src/app/page.tsx
  2. Add imports for TodoItem and the Todo type
  3. Create sample todo data that matches the type definition
  4. Render the list of TodoItems
  5. Show you each diff for approval
āœ…Tip

When you ask for something that spans multiple files, Claude Code plans all the changes first, then applies them in the right order. It won't import a component before creating it.

Updating types across files

One of the trickiest parts of development is keeping types in sync. Try this:

"Add a 'priority' field to the Todo type with values 'low', 'medium', or 'high'. Update TodoItem to display the priority with a colored badge."

Claude Code will:

  1. Update src/types/todo.ts to add the new field
  2. Update src/components/TodoItem.tsx to render the priority badge
  3. Update the sample data in src/app/page.tsx to include priority values

All three files stay in sync. No missing properties, no type errors.

Terminal
$> "Run the TypeScript compiler to check for errors"

Why this matters

In traditional development, multi-file changes are where bugs hide. You update a type but forget to update a consumer. You rename a prop but miss one import. Claude Code eliminates this entire class of errors by seeing your whole project as a connected system.

⭐Important

As your project grows, multi-file changes become Claude Code's biggest advantage. A single prompt can update types, components, tests, and documentation -- all in sync.

Your todo app now has real components with proper types. Let's learn some shortcuts that will make you even faster.