# 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. It is not a chat window where you paste snippets. 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 you that loop running on actual code, where 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.
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 are not curating the context window by hand anymore.
It works in your terminal directly, and it also plugs into IDEs like VS Code and JetBrains. The official starting point is the Claude Code documentation.
Claude Code installs as a single command. You need Node.js available first.
npm install -g @anthropic-ai/claude-codeThen 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 or Max plans include Claude Code usage) or use an Anthropic APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.Voir la définition complète → key billed through the Console. Once authenticated, you are dropped into an interactive session inside your project.
Let us make this real. Imagine a small Python project with a failing test. Your suite reports:
FAILED tests/test_cart.py::test_apply_discount - AssertionError: assert 90.0 == 95.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.
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, and it is doing it against your real files, not a description you typed. Reading files and listing directories are low-risk actions, so depending on your settings these may happen without interrupting you.
Claude Code reasons about what it found. Maybe apply_discount multiplies by the discount rate instead of subtracting it, so a 10 percent discount on a 100 dollar cart returns 10.0 instead of 90.0, and the test expectation of 90.0 is correct. The bug is in the source, not the test.
For multi-step work it often writes out a short plan, sometimes as a checklist it tracks as it goes. You can read the plan before any code changes, which is your first chance to redirect it if it misunderstood the goal.
Now it wants to change cart.py. This is where the first real permission prompt appears. Claude Code shows you a diff: 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 see precisely what will change. You can accept, reject, or steer. This diff-then-approve pattern is the heart of why the tool is safe to use on real code: no silent edits.
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.
Because you asked it to explain, it summarizes: the discount function was multiplying the price by the rate rather than applying the rate as a reduction, the fix subtracts the discount from full price, and the previously failing assertion now passes. The "check the result" phase of the agentic loop happened by actually running your tests, not by Claude guessing whether its change worked.
That is the whole loop: explore, plan, edit (with approval), run (with approval), verify, explain.
The reason an agent with shell access is not terrifying is 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. Anything that touches the network or runs something destructive gets a prompt every time.
You can tune this. The "Yes, and don't ask again" options let you grant standing permission for a specific tool or command pattern within a session, so you are not approving the same harmless pytest invocation twenty times. You can also configure an allowlist and denylist of commands in your project settings so the rules persist across sessions.
For higher autonomy you can grant broader permissions deliberately, and for untrusted work you can run Claude Code in a sandboxed or restricted mode. The principle is that *you* choose the leash length. The default is conservative on purpose.
Vérification des acquis
1. According to the lesson, what is the key mental shift when moving from the Claude apps to Claude Code?
2. What prerequisite must be present before installing Claude Code via npm?
3. The lesson references the abstract agentic loop. Which sequence best describes that loop as applied in Claude Code?
4. Select ALL correct answers about what Claude Code can do according to the lesson.
Sélectionnez toutes les réponses correctes.
5. Select ALL correct answers about authentication and access for Claude Code as described.
Sélectionnez toutes les réponses correctes.
Claude Code is not a separate intelligence. It is Claude (the same model family you use in the apps and the Messages APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.Voir la définition complète →) 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.Voir la définition complète → for the right tool.
Drop a file named CLAUDE.md in your project root and Claude Code reads it automatically at the start of every session. This is where you put project conventions, the command to run tests, architectural notes, and "don't touch this directory" warnings. It is durable instructions that survive across sessions, so you are not re-explaining your project every time.
# 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.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. You can connect MCP servers to give it abilities beyond files and shell: query your database, read your issue tracker, hit an internal APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.Voir la définition complète →. The Model Context Protocol site is the reference, and the same connectors you use in the Claude apps largely apply here too.
Claude Code works with your Git workflow naturally. It can create branches, write commits with sensible messages, and open pull requests. Anthropic also offers a GitHub integration so you can tag Claude on an issue or pull request and have it propose changes directly in the repo, asynchronously, without your terminal open. Explore the official tools at github.com/anthropics.
Claude Code is a finished product. The same 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 find yourself wanting a custom internal agent for, say, triaging logs or maintaining docs, that is the SDK's job. Claude Code is the off-the-shelf coding agent; the Agent SDK is the kit for building your own.
A few patterns separate frustrating sessions from productive ones.
Give it a way to check itself. The single highest-leverage thing is a working test command. 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 a great instruction because it is verifiable and bounded. "Refactor the whole payment system" invites a sprawling, hard-to-review diff. Break large work into steps you can approve one at a time.
Read the plan, then the diffs. Your review is part of the loop. The permission prompts are not bureaucracy; they are the moments where your judgment enters. Skimming a diff before approving catches the occasional wrong turn early.
Use CLAUDE.md instead of repeating yourself. Every constraint you state out loud more than once belongs in that file.
npm install -g @anthropic-ai/claude-code, run claude inside a project, and authenticate with a Claude plan or an APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.Voir la définition complète → key.CLAUDE.md with your test command, conventions, and off-limits directories so the agent carries durable context across sessions.