Claude code: an agentic coder in your terminal
Claude Code reads your project, plans a change, edits across multiple files, and runs commands on your behalf, all from your terminal or IDE. You do not paste snippets into a chat window. It is an agent that lives inside your repository, sees your real file tree, and acts on it with your permission.
You already understand the agentic loop in the abstract: observe, plan, act, check the result, repeat. This lesson shows that loop running on actual code. The "tools" are reading files, writing files and executing shell commands. We will walk through a concrete task (fix a failing test and explain the change) and look closely at the permission prompts that keep you in control.
What Claude code actually is
Claude Code is a command-line tool from Anthropic that wraps Claude in an agent harness with file and shell access. You run it inside a project directory. It builds an understanding of your codebase, proposes a plan and executes steps, pausing to ask before anything consequential happens.
The key mental shift: in the Claude apps you bring context to the model. With Claude Code, the model goes and gets its own context. It greps your files, opens the ones that matter, reads your package.json or pyproject.toml, and runs your test suite to see what is actually broken. You stop curating the context windowcontext windowThe context window is the maximum amount of text (measured in tokens) a language model can process at once, including both the input prompt and the generated output.View full definition → by hand.
It works in your terminal directly. It also plugs into IDEs like VS Code and JetBrains, and it runs in the browser through Claude Code on the web. The official starting point is the Claude Code documentation.
Installing it
The recommended install is the native installer, which does not need Node.js. On macOS, Linux or WSL:
curl -fsSL https://claude.ai/install.sh | bashOn Windows PowerShell:
irm https://claude.ai/install.ps1 | iexYou may still see npm install -g @anthropic-ai/claude-code in older guides. That method is deprecated, so use the native installer for new setups.
Then move into any project and start it:
cd my-project
claudeOn first run it walks you through authentication. You can sign in with a Claude account (Pro, Max, Team and Enterprise plans include Claude Code usage). You can also use an Anthropic APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.View full definition → key billed through the Claude Console. Once authenticated, you land in an interactive session inside your project.
The agentic loop, made concrete
Imagine a small Python project with a failing test. Your suite reports:
FAILED tests/test_cart.py::test_apply_discount - AssertionError: assert 10.0 == 90.0You do not know yet whether the bug is in the test or the code. You type one instruction:
Fix the failing test in tests/test_cart.py and explain the change you made.
Here is what happens, step by step, and why each step matters.
Step 1: It explores before it acts
Claude Code does not start editing. It first runs read-only commands to orient itself. It might run your test command to reproduce the failure, then open tests/test_cart.py and the source file it imports, likely cart.py.
This is the "observe" phase of the loop, done against your real files, not a description you typed. Reading files and listing directories are low-risk, so depending on your settings these may happen without interrupting you.
Step 2: It forms a plan
Claude Code reasons about what it found. apply_discount multiplies the price by the discount rate instead of reducing the price by it. A 10 percent discount on a 100 dollar cart returns 10.0 instead of 90.0. The test expectation of 90.0 is correct, so the bug is in the source.
For multi-step work it often writes a short plan, sometimes as a checklist it ticks off as it goes. You can read the plan before any code changes, which is your first chance to redirect it. For bigger tasks, press Shift+Tab to switch into plan mode, where it researches and proposes a plan without touching any files.
Step 3: It proposes an edit, and asks permission
Now it wants to change cart.py, and the first real permission prompt appears. Claude Code shows you a diff with the exact lines it wants to remove and add. Nothing is written to disk until you approve.
cart.py
- return price * discount_rate
+ return price * (1 - discount_rate)
Do you want to make this edit?
> Yes
Yes, and don't ask again for this session
No, tell Claude what to do differentlyYou can accept, reject or steer. This diff-then-approve pattern is why the tool is safe to use on real code: no silent edits.
Step 4: It runs the command, and asks again
After applying the edit, Claude Code wants to verify its work by re-running the tests. Executing a shell command is a separate, more sensitive action than editing a file, so it prompts again:
Claude wants to run:
pytest tests/test_cart.py
> Yes
Yes, and don't ask again for pytest commands
NoYou approve. The tests run. Claude Code reads the output, sees green and reports back.
Step 5: It closes the loop and explains
Because you asked, it summarizes the fix. The function multiplied the price by the rate instead of applying the rate as a reduction. The fix charges price * (1 - discount_rate), and the failing assertion now passes. The "check the result" phase happened by running your tests, not by Claude guessing.
That is the whole loop: explore, plan, edit (with approval), run (with approval), verify, explain.
Permissions are the safety model
An agent with shell access is manageable because of the permission system. Understand it and you will use Claude Code with confidence.
By default, Claude Code treats actions by risk level. Reading and searching files is permissive. Writing files prompts you with a diff. Running shell commands prompts you with the exact command, and anything network-facing or destructive gets a prompt every time.
You can tune this. The "Yes, and don't ask again" options grant standing permission for a specific tool or command pattern, so you are not approving the same harmless pytest call twenty times. You can also set allow and deny rules in .claude/settings.json so they persist across sessions, and the /permissions command shows what is currently allowed.
For higher autonomy you can switch to an auto-accept edits mode deliberately. For untrusted work, run Claude Code in a sandbox or container. You choose the leash length, and the default is conservative on purpose.
Claude Code in 20 minutes
Knowledge check
1. What is the fundamental distinction between using Claude Code and using the Claude chat apps?
2. How does the lesson describe the agentic loop as it applies to coding with Claude Code?
3. Why does Claude Code pause to ask for permission before certain actions?
4. Select ALL correct statements about what Claude Code is and how it operates.
Select all the correct answers.
5. Select ALL correct statements about installing and running Claude Code.
Select all the correct answers.
Where it fits with the rest of the Claude ecosystem
Claude Code is not a separate intelligence. It is Claude, the same model family you use in the apps and the Messages API, wired into a coding agent harness. Knowing how it relates to the other pieces helps you reachreachThe number of unique people exposed to your message in a given period. Unlike impressions, reach counts each person once, no matter how often they see it.View full definition → for the right tool.
CLAUDE.md: persistent project memory
Drop a file named CLAUDE.md in your project root and Claude Code reads it at the start of every session. Put project conventions here, along with the test command, architectural notes and "don't touch this directory" warnings. Run /init and Claude Code will draft one for you from your codebase.
# Project: checkout-service
## Commands
- Test: `pytest -q`
- Lint: `ruff check .`
## Conventions
- All prices are in integer cents, never floats.
- Do not edit files in `legacy/` without asking.MCPMCPAn open standard that lets AI assistants connect to your company's tools and data in a consistent, governed way, instead of one custom integration at a time.View full definition →: giving Claude Code new tools
You met the Model Context Protocol earlier as the open standard that lets Claude talk to external tools and data sources. Claude Code is an MCP client. Connect MCP servers to give it abilities beyond files and shell, such as querying your database, reading your issue tracker or calling an internal API. The Model Context Protocol site is the reference. Beyond MCP, Claude Code also supports subagents, hooks and plugins for packaging custom workflows.
GitHub integration
Claude Code works with your Git workflow. It can create branches, write commits with sensible messages and open pull requests. Anthropic also offers a GitHub integration (run /install-github-app to set it up), so you can tag @claude on an issue or pull request and have it propose changes asynchronously, without your terminal open. Explore the official tools at github.com/anthropics.
The Claude Agent SDK: when you want to build, not just use
Claude Code is a finished product. The agent harness underneath it is available as the Claude Agent SDK, so you can build your own agents with file access, tool use and the permission patterns you just saw. If you want a custom internal agent for triaging logs or maintaining docs, use the SDK. Claude Code is the off-the-shelf coding agent; the Agent SDK is the kit for building your own.
Practical habits that make it work well
A few patterns separate frustrating sessions from productive ones.
Give it a way to check itself. A working test command matters more than anything else here. When Claude Code can run tests, it self-corrects. The discount example worked cleanly because pytest gave it a ground-truth signal. Without tests, it is editing partly blind.
Scope your requests. "Fix this failing test" is verifiable and bounded. "Refactor the whole payment system" invites a sprawling diff nobody can review. Break large work into steps you can approve one at a time, or start in plan mode.
Read the plan, then the diffs. The permission prompts are where your judgment enters the loop, and skimming a diff before approving catches wrong turns early.
Every constraint you state out loud more than once belongs in CLAUDE.md.
Key Takeaways
- Install with the native installer (
curl -fsSL https://claude.ai/install.sh | bash), runclaudeinside a project, and sign in with a Claude plan or an API key. The npm install is deprecated. - Claude Code runs a real agentic loop on your codebase: it explores files, plans, edits with a diff you approve, runs commands you approve, and verifies by running your tests.
- The permission system is the safety model. You set the leash length with allow and deny rules, "don't ask again" grants and modes like plan mode.
- A
CLAUDE.mdwith your test command, conventions and off-limits directories gives the agent durable context across sessions. - Extend it with MCP servers and the GitHub integration, and use the Claude Agent SDK when you want to build your own agent on the same harness.
What to do, from this lesson
These actions are compiled in the role's Playbook.
- Add a CLAUDE.md with test command, conventions, and off-limits directories
Related articles
Recent articles from the blog that build on this lesson.
- AI$600M in annualized revenue on code nobody's engineering team wroteLovable just crossed $600M in annualized revenue, and the apps built on its platform are pulling nearly a billion monthly views. That number is worth pausing on, because it traces back to an idea about programming that most engineers spent years dismissing.
- AIVibe coding for non-engineers: the hype is real, but the risk is being misreadCoding assistants like GitHub Copilot, Cursor, and Claude have made it genuinely possible for non-engineers to build working software. But the dominant narrative around "vibe coding" is flattening a more complicated reality that professionals need to understand before betting on it.