Claude Code Tutorial 3: Why Only the Terminal?
1.3 Why Write Code in the Terminal?
Here's an analogy: you're working on a new feature and suddenly need to modify a low-level utility function scattered across three files, with some calls crossing module boundaries. You open your editor, do a global search, flip through files one by one, make changes carefully, then run tests—they fail. You check the error, trace the stack, fix it, and repeat.
In this process, the time spent actually "thinking about how to fix it" is probably less than half. The rest is mechanical labor: finding files, changing references, waiting for compilation, clicking around.
Putting AI in the terminal is primarily about compressing this mechanical labor.
The Terminal Is Closest to the Code
You might use VS Code, JetBrains, or Vim. Whatever you use, you can't avoid the terminal while coding. Running npm test, git log, grep, make build—these operations are naturally done in the command line.
So if your AI partner also sits in the same terminal, things get simpler. You don't need to copy and paste file contents into a chat window, nor describe yourself: "My project has a class called UserService at line 42 of src/services/user.ts..." Claude Code stands in the project root; it can read it itself.
This is a dimensional reduction in context. When you tell Claude Code, "Help me refactor the error handling in the login module," it actually reads your auth/login.ts, reads errors.ts, finds all the places that call it, and directly modifies them. No need for you to act as a messenger.
Freeing You from the Role of "Operator"
When using browser-based AI chat, we often unconsciously play the role of an "intermediary": AI outputs code, we read, verify, copy, and paste back into the editor. If the code works, great; if not, we copy the error, ask again, copy again. This process is very disruptive to flow.
Claude Code's design philosophy is to put you back in the position of a "thinker." You say the idea, it executes. After changes, you see the diff directly in the terminal and decide whether to accept. It can also run tests and lint for you. You sit there, mostly reading code and making decisions, rather than constantly switching windows.
Why Not an Editor Plugin?
You might ask: why not just create an AI plugin inside the editor?
Editor plugins are certainly useful, and many teams already use them. But Claude Code in the terminal has several advantages that are hard to replace with plugins:
- No editor lock-in. Whether you use VS Code today, switch to Neovim tomorrow, or even work on a remote server without a GUI, Claude Code works. It's independent of your choice of tools.
- Can do more "unconventional" things. In the terminal, it can execute any shell command. This means its scope of action is much broader—it can start a Docker container to verify database migrations, pull a remote branch and check for conflicts, or automatically run e2e tests after modifying code. Editor plugins generally hesitate or simply cannot do these things.
- Batch processing and automation. You can put Claude Code into a script to handle dozens of repositories, batch-generate documentation, or automatically process Issues. At that point, it's no longer just an "assistant" but a link in the pipeline.
A Personal Example
Previously, I needed to migrate a JavaScript project to TypeScript, about 20,000 lines of code. My approach wasn't to manually add types file by file, nor to rely on an editor plugin to do everything.
I simply launched Claude Code in the project directory and told it: "Migrate this project to TypeScript strict mode step by step, modify a few files at a time, run tsc --noEmit after each batch, fix any errors yourself, and continue until all pass."
Over the next half hour, I basically did just one thing: review the diffs it made, nod or shake my head. Occasionally I told it, "Don't use any here, define an interface," and it continued working. In the end, the project compiled successfully, several times faster than I had estimated.
This isn't to say Claude Code is smarter than a plugin. But it can complete the "modify-verify-fix" loop on its own—that's the fundamental difference between it and chat-based AI.
Ultimately, the Terminal Gives AI Hands and Feet
Putting AI in the terminal essentially gives it the ability to execute, not just to suggest.
It turns your code repository from a set of read-only texts into a real environment that AI can "touch," modify, and verify. This is a huge leap.
You still control the direction of the project and all critical decisions, but those tedious, low-creativity, repetitive tasks now have a more suitable handler.
评论
暂无已展示的评论。
发表评论(匿名)