Hubert Grzesiak logoHubert Grzesiak
AboutServicesWorkBlogVersions
Resume
HomeAboutCase StudiesBlogDevelopersResumeContactPrivacy

© 2026 Hubert Grzesiak. All rights reserved.

Moving AI into the Terminal: A Practical Claude Code Workflow

ai developer-tools cli workflow

How running an agent in the command line changes software development, why git diffs matter, and the exact boundaries to set for CLI coding agents.

Estimated reading time: 5 minute(s)


Browser chat windows force you to copy, paste, format, and re-check code by hand. Moving the AI model into your shell changes that dynamic completely.

For a long time, using AI for programming meant switching away from your editor, opening a browser tab, pasting a function, asking for a change, and manually pasting the snippet back.

That loop had high friction. More importantly, it had no context. The model in the browser could not see your TypeScript configurations, could not run your test suite, and had no awareness of whether the code it wrote actually compiled.

Moving to an agent in the terminal, such as Claude Code, fixes that disconnect. Instead of treating the model like an external consultant you chat with in an office down the hall, it works directly inside your project repository.

Why the terminal works better than a browser window

A terminal agent has access to your local developer environment. When you ask it to work on a task, it can:

  • Read your directory tree and package dependencies.
  • Inspect git status, branches, and recent commit history.
  • Run linters, TypeScript compiler checks, and unit tests.
  • Show you exact git diffs before you commit the changes.

When I run a refactor in Next.js, the most time-consuming part is often updating imports, props, and type definitions across several files. In a web chat, that takes four distinct prompts and several manual file edits. In the terminal, a single instruction handles the entire pass.

claude "Refactor the BookingCard component to accept a numeric rating prop instead of a string. Update all call sites in components/rentals/ and ensure tsc passes."

The agent finds the component, inspects the imports, modifies the files, runs bun run tsc, and reports whether the project compiles cleanly.

The importance of git diff discipline

Running an agent that can edit local files requires discipline. If you give an agent free rein without checking its output, you will eventually end up with subtle bugs or unwanted dependency additions.

I follow three safety rules for every terminal session:

1. Work on a clean git working tree

Never launch a terminal agent on a dirty git working tree. If you have uncommitted changes, commit them or stash them first.

git stash save "WIP: manual adjustments to header"

Starting from a clean state ensures that every edit the agent makes shows up clearly in git diff. If the agent takes a wrong approach, a simple git checkout . resets your workspace immediately.

2. Keep the scope to three or four files

CLI agents perform best when the target scope is clearly defined. Giving an agent a vague instruction like "make this whole dashboard faster" leads to unpredictable changes across dozens of files.

Instead, define the scope explicitly:

# Focused prompt with clear boundaries
claude "Optimize the image loading inside components/home/sections/Hero.tsx. Add priority flags for the mobile hero asset and avoid touching styles in layout.tsx."

Small tasks produce small diffs. Small diffs are easy to review and safe to merge.

3. Review diffs before running test scripts

Before telling the agent to run migrations or deploy commands, always inspect what it changed. You can review the changes in your editor or run:

git diff --stat
git diff components/home/sections/Hero.tsx

Look for deleted comments, unexpected utility imports, or changed fallback values. You remain the code reviewer.

Practical tasks where CLI agents excel

Through regular use, I found that terminal agents are particularly strong in three areas:

Multi-file type migrations

When upgrading libraries (such as moving from Next.js 14 to Next.js 15), APIs often shift. For example, route parameters became asynchronous.

A terminal agent can inspect every dynamic route file, identify where params is accessed synchronously, and rewrite the handlers to await params cleanly.

Writing test cases for existing utilities

Writing unit tests for utility functions is necessary, but often repetitive. A terminal agent can read your utility functions, inspect existing test configurations in vitest or jest, and write matching test suites.

claude "Read lib/utils.ts. Write unit tests for calculateReadingTime and slugify in tests/utils.test.ts. Cover edge cases like empty strings and unicode characters."

Because the agent runs the test command itself, it fixes syntax mismatches before asking you to review.

Synchronizing documentation and public schemas

In my portfolio, I maintain a public/llms.txt file that lists case studies, technical competencies, and blog posts for discovery by web scrapers and language models.

When I add new articles, I can ask Claude Code to read the new frontmatter in content/blog/ and update the markdown index in public/llms.txt. It extracts the titles, links, and summaries accurately in seconds.

When to step back to manual coding

Terminal agents are productivity multipliers, but they are not autonomous developers.

If a bug requires understanding business domain rules, user psychology, or delicate visual alignment in CSS, do not waste time prompting the agent back and forth. Open the file, open Chrome DevTools, and fix it directly.

The best workflow combines fast terminal execution for structured, verifiable tasks with hands-on manual control for design and architecture.