PRACTICAL DEVELOPER GUIDE
How to Use Claude for Developers: Claude Code, the API, and Agent Workflows
The terminal is the new IDE, and the diff is still the unit of trust.
Developers use Anthropic's Claude in three distinct ways: as a chat partner for planning and review, as Claude Code running directly in the terminal, and as the model behind their own API-powered products. This page walks through how to use Claude for developers in each mode, with real prompts for code review, test writing, and tool use, plus the habits that keep AI-written code safe before it reaches production.
How to use Claude for developers comes down to three surfaces: the Claude AI chat interface for planning and code review, Claude Code for terminal-native agentic development that reads your repo and edits files directly, and the Anthropic API for building tool use and agent workflows into your own products. Most developers start in chat, move repetitive editing and testing into Claude Code, and reach for the API once they're shipping a Claude-powered feature. The habits that keep AI-written code safe are the same ones that keep any code safe: small diffs, tests, and review before merge.
Published · Last reviewed
Free lesson · no account neededThe Three Ways to Use ClaudeThe Three Modes5 minStart the free lessonKey Takeaways
- Claude for developers spans three surfaces: chat for planning and code review, Claude Code for terminal work, and the Anthropic API for building your own tool use and agent features.
- Claude Code reads your repository, edits files across a codebase, runs your test suite, and can commit changes, all from a normal terminal session.
- Tool use lets Claude call functions you define, so it can query a database, hit an internal API, or run a script as part of answering a request.
- Code review works best when you point Claude at a specific diff and a specific standard to check against, not a vague 'look at my code.'
- Claude can write and run tests, but the habit that keeps generated code safe is the same one that keeps any contributor's code safe: small diffs, a passing test suite, and human review before merge.
- Start with a CLAUDE.md file: a short project spine that tells Claude your stack, commands, and conventions so it stops guessing.
Claude AI vs. Claude Code vs. the Anthropic API
| Surface | Best for | Where it runs |
|---|---|---|
| Claude AI (chat) | Planning, architecture discussion, reviewing a pasted diff or stack trace | Browser or desktop app |
| Claude Code | Multi-file edits, running your test suite, autonomous work on your actual repo | Your terminal, inside the project directory |
| Anthropic API | Building a Claude-powered feature or agent into your own product, with tool use | Your application code, called over HTTPS |
Copy and Paste
Prompts You Can Use Today
Review a pull request diff against a specific standard
You are reviewing a pull request diff for a Python FastAPI service. Check specifically for SQL injection risk, missing input validation on request bodies, and any database queries that aren't parameterized. List each issue with the file and line, explain why it's a problem, and suggest the fix. Do not comment on formatting or style.
Swap the language, framework, and the specific risks you want flagged for your own stack.
Write tests that match your existing style
Look at the existing tests in tests/test_orders.py and match their structure, fixtures, and naming conventions exactly. Write unit tests for the new refund_order function in orders/service.py, covering a successful refund, a refund attempt on an already-refunded order, and a refund that exceeds the original charge amount. Use pytest and the existing mock patterns.
Point it at your real test file and framework, whether that's pytest, Jest, or Vitest.
Debug a flaky test with full context
This test is failing intermittently in CI but passes locally: [paste the test name and error]. Here is the test file, the function it exercises, and the last three CI failure logs. Walk through the possible causes of the flakiness before proposing a fix, and tell me explicitly what you're still uncertain about.
Paste actual logs and file contents rather than describing the bug from memory.
Design a tool use function for the Anthropic API
I'm building an agent with the Anthropic API that needs to look up a customer's order status from our internal REST API. Draft the tool definition, including the JSON schema for its input parameters, and show me the Python code that handles the resulting tool_use block and sends a tool_result back to Claude.
Replace the internal API and parameters with your own service's shape.
Draft a CLAUDE.md for a new project
Read through this repository's package.json, README, and folder structure, then draft a CLAUDE.md file documenting our tech stack, the commands to run tests and the dev server, our naming conventions for API routes, and anything a new contributor would need to know before making their first change.
Run this once at the start of a project, then update it whenever conventions change.
Plan a multi-file refactor before touching code
I want to extract the payment logic that's currently scattered across three controllers into a single PaymentService class. Before writing any code, list every file that currently contains payment logic, propose the new class's public methods, and flag any behavior differences between the three current implementations that the refactor needs to preserve.
Ask for the plan first on any change that touches more than two or three files.
Start Here
The free lessons every developer should start with
Three short lessons take you from knowing Claude exists to running a real Claude Code session with a project spine in place, which is enough to start using it on real work the same day.
The Three Surfaces
How Developers Actually Use Claude
Claude for developers isn't one tool. It's three, and knowing which one fits the task in front of you is most of the skill.
Claude AI chat
Good for architecture discussions, reviewing a pasted diff or error message, and thinking through a design before you commit to writing code.
Claude Code
A terminal-native agent that reads your repository, edits files across a codebase, runs your test suite, and can commit changes on your instruction.
Anthropic API
The model plus tool use, for building Claude into your own product: a support bot that queries your database, an in-IDE assistant, or a pipeline that runs unattended.
Agent workflows
Combine tool use with a loop: Claude decides which tool to call, reads the result, and decides the next step, repeating until the task is finished.
Claude Code
What is Claude Code, and how do you start using it?
Claude Code is Anthropic's command-line tool for working with Claude directly inside your codebase. Instead of copying code into a chat window and pasting the answer back, you run it from your project directory and it reads your files, your git history, and your test setup as context for whatever you ask it to do.
A typical session looks like this: you open a terminal in your repository, start Claude Code, and describe a task in plain language, such as adding rate limiting to your POST endpoints. It reads the relevant files, proposes and applies the edits across however many files the change touches, runs your test suite, and reports back what it changed and whether the tests passed.
The part that makes Claude Code different from an editor plugin is that it operates on the whole task, not just the next line. It can plan a multi-step change, execute each step, notice when a test fails, and try a fix, all inside one instruction from you. You stay in the loop by reading the plan before it runs and reviewing the diff before you commit it.
The first thing worth setting up is a CLAUDE.md file at the root of your project. It's a short, plain-language file that tells Claude your stack, your build and test commands, your naming conventions, and anything else a new contributor would need on day one. Once it exists, Claude Code reads it automatically at the start of every session instead of guessing.
Real Work
Workflows Developers Run This Week
Security-focused code review
Point Claude at a diff and a specific class of risk (auth bypass, injection, unvalidated input) rather than asking for a general review.
Writing and running tests
Claude reads your existing test patterns and framework, writes tests that match your style, runs them, and iterates on failures.
Refactoring across files
For anything touching more than a couple of files, ask for a plan first: which files change, what the new structure looks like, what behavior must not change.
Debugging a hard-to-reproduce bug
Feed it the failing test, the function under test, and real logs from the failure, then ask it to reason through causes before proposing a fix.
Getting oriented in an unfamiliar codebase
Ask Claude to trace a request through the codebase and explain the flow, which is often faster than reading the code cold.
The Anthropic API
Tool use, agents, and building with the Anthropic API
The Anthropic API is how you put Claude inside your own product instead of using it through a chat window. You send a request with your prompt and get a response back, the same shape as any HTTP API, which means it fits into whatever backend stack you already run, whether that's a Python service, a Node app, or something else entirely.
Tool use is the feature that turns a single request-response call into something closer to an agent. You describe the tools Claude has access to, each one a function with a name, a description, and a JSON schema for its inputs, such as a lookup_order function that takes an order ID. When Claude decides it needs that tool to answer a question, it returns a tool_use block instead of a plain answer. Your code executes the actual function call, whatever that means for your system, a database query, an API call, a script, and sends the result back to Claude as a tool_result. Claude reads that result and continues.
An agent, in the practical sense, is just this loop run more than once: Claude picks a tool, you execute it, Claude reads the result and picks the next one, until the task is done or it has enough information to answer. The Model Context Protocol is a standard for describing those tools and connections in a consistent way, so the same tool definitions can work across different clients rather than being wired up from scratch for each project.
Streaming is the other piece worth knowing: instead of waiting for the full response, the API can send tokens back as they're generated, which is what makes chat interfaces and live code suggestions feel responsive instead of laggy.
Keeping It Safe
How to Keep Claude's Code Changes Safe
Nothing here is specific to AI. It's the same discipline that keeps any contributor's code safe, applied consistently.
Keep diffs small
Ask for one change at a time. A five-file diff is reviewable in ten minutes; a fifty-file diff gets rubber-stamped, which is exactly when bugs slip through.
Tests before merge, not after
Have Claude write or update tests as part of the same task, and require them to pass before you look at the diff as done.
Read the diff yourself
Claude can explain what it changed and why, but the person who commits the code is still responsible for having actually read it.
Never paste secrets into a prompt
API keys, credentials, and customer data don't belong in chat history or Claude Code sessions any more than they belong in a Slack message.
Teach it your conventions once
A CLAUDE.md file with your stack, commands, and style guide cuts down on the back-and-forth corrections that eat a session.
Where to Start
The starter path for developers
If you're new to using Claude as a developer, the fastest way in is three short lessons, in order. Start with The Three Ways to Use Claude in The Three Modes course, which lays out the same chat, Claude Code, and API distinction covered above, so you know which surface to reach for before you open a terminal.
From there, move to Claude Code: Build With Words, also in The Three Modes course. It walks through what a real Claude Code session looks like: describing a task in plain language, watching it read your repo and apply edits, and reviewing the result before it ships.
The third stop is CLAUDE.md: your project spine, from The Practitioner Setup course. This is where you learn to write the file that stops Claude from re-guessing your stack, your commands, and your conventions on every session, which is the single habit that makes every later session faster.
Once those three are done, the rest of The Practitioner Setup course covers hooks and automation, connecting Claude to your stack through MCP servers, and building a weekly operator workflow, which is where the daily-habit side of using Claude as a developer really compounds.
Limits
What Claude gets wrong, and where the responsibility stays yours
Claude can be confidently wrong. It can propose a fix that passes the tests you gave it while missing an edge case you didn't think to test for, or use a library function that doesn't exist. Treat its output as a strong first draft from a fast, well-read collaborator, not as a decision already made.
Generated code needs the same security review as human-written code, and arguably more attention the first few times you work together, until you've calibrated where it tends to make mistakes on your specific codebase. Don't skip a security-focused pass on anything that touches authentication, payments, or user data just because it came out of a tool that writes fluent code.
Confidential source code, customer data, and credentials shouldn't go into any AI tool without checking your organization's policy first. If you work somewhere with a data handling policy or a client confidentiality obligation, that obligation doesn't change because the reviewer is a model instead of a person.
Finally, autonomy is a dial, not a switch. Claude Code can run tests and even commit on its own if you let it, but the professional habit is to keep a human review step before anything reaches a shared branch or production, the same gate you'd want on a new hire's first month of pull requests.
Start the free lesson that explains the three ways to use Claude
Reading about how to use Claude for developers and actually running Claude Code in your own terminal are different things. The Nightschool AI curriculum is hands-on from the first lesson, starting with the same chat-versus-Claude-Code-versus-API distinction covered on this page.
Frequently Asked Questions
How do developers use Claude?
Developers typically use Claude across three surfaces: the Claude AI chat interface for planning, design discussions, and reviewing pasted code; Claude Code for terminal-native work where Claude reads and edits an actual repository; and the Anthropic API for building Claude, including tool use and agent loops, into their own products.
What is Claude Code and how do I start using it?
Claude Code is a command-line tool that runs Claude directly inside your project. You start it from your repository's root directory and describe a task in plain language; it reads your files and CLAUDE.md, makes the edits, runs your tests, and reports back. Setting up a CLAUDE.md file first, describing your stack and commands, makes the earliest sessions far more accurate.
Is Claude good for code review?
Yes, especially when you give it a specific diff and a specific standard to check, such as security issues, missing input validation, or adherence to your team's conventions. It's much stronger when asked to check for something concrete than when given a vague 'review my code,' the same way a human reviewer does better work with clear review criteria.
How do I use the Anthropic API?
You send an HTTP request with your prompt and get a text response back, the same shape as any API call, which you can call from Python, Node, or whatever backend you run. To build something more than a single question-and-answer, you add tool use, giving Claude functions it can call, and handle the resulting tool_use and tool_result exchange in your own code.
What is tool use in Claude?
Tool use lets you describe functions Claude can call, such as looking up an order or querying a database, each with a name and a JSON schema for its inputs. When Claude decides a tool is needed, it returns a tool_use request instead of a plain answer; your code runs the actual function and sends the result back so Claude can continue, which is the basis for most agent workflows.
Can Claude write tests for my code?
Yes. Claude can read your existing test patterns and framework, whether that's pytest, Jest, or Vitest, and write unit, integration, or end-to-end tests that match your style. In Claude Code, it can also run the tests it writes and fix failures iteratively, rather than handing you tests you then have to debug yourself.
How do I keep Claude's code changes safe?
Keep the same discipline you'd want from any contributor: ask for small diffs instead of sweeping changes, require passing tests before anything merges, read the diff yourself before committing, and never paste secrets or customer data into a prompt. A CLAUDE.md file reduces the mistakes that come from Claude guessing at your conventions.
What programming languages does Claude work with?
Claude works across mainstream languages including Python, TypeScript, JavaScript, Go, Rust, Java, C/C++, Ruby, and PHP, and understands common framework patterns for tools like React, Next.js, Django, and FastAPI. Claude Code works with any language that runs in a terminal, since it operates on your files and shell commands directly rather than through a language-specific plugin.
Is Claude Code free to install?
Claude Code itself is free to install. Using it requires either an Anthropic API key, billed per token, or a Claude subscription plan that includes Claude Code access. There's no separate license fee on top of that for the command-line tool.
Related reading
Go from reading about Claude to running it in your terminal
The first lesson takes minutes; the habit is what pays off.