Claude Code/
Lesson

Now that Claude Code is installed and running, let's walk through the workflows you'll use every day. These patterns cover 90% of what developers do with Claude Code.

Exploring your codebase

The simplest and most powerful use case: asking Claude questions about your code.

Claude Code
> How does authentication work in this project?

> What happens when a user submits the checkout form?

> Where are the database migrations defined?

> Explain the error handling strategy in the API layer

Claude doesn't just search for keywords. It reads files, follows imports, traces function calls, and synthesizes an answer from multiple sources. If your authenticationWhat is authentication?Verifying who a user is, typically through credentials like a password or token. spans a middlewareWhat is middleware?A function that runs between receiving a request and sending a response. It can check authentication, log data, or modify the request before your main code sees it. file, a user model, a sessionWhat is session?A server-side record that tracks a logged-in user. The browser holds only a session ID in a cookie, and the server looks up the full data on each request. store, and a route handlerWhat is route handler?A Next.js file named route.js inside the app/ directory that handles HTTP requests directly - the App Router equivalent of API routes., Claude will find and connect all of them.

This is particularly powerful for onboarding onto unfamiliar codebases. Instead of spending hours reading code, you can ask Claude to give you the big picture first, then drill into specifics.

Good to know
Claude's code exploration is especially useful for understanding code you didn't write. Instead of manually tracing imports across 15 files, ask Claude "how does the payment flow work?" and it connects the dots for you. This is one of the tasks where AI-generated answers are genuinely faster and more reliable than doing it yourself.
02

Making edits

When you want Claude to change code, describe what you want in plain language:

Claude Code
> Add input validation to the registration form - email must be valid
  and password must be at least 8 characters

> Refactor the fetchUser function to use async/await instead of .then() chains

> Add a loading spinner to the dashboard while data is being fetched

Claude will:

  1. Read the relevant files to understand the current code
  2. Plan the changes needed
  3. Show you a diffWhat is diff?A comparison showing exactly which lines were added, removed, or changed between two versions of code. of the proposed modifications
  4. Wait for your approval before applying anything

The diff view shows exactly what lines will be added, removed, or modified. You can approve the change, reject it, or ask Claude to modify its approach.

If the change spans multiple files, Claude handles all of them in sequence. For example, adding a new APIWhat is api?A set of rules that lets one program talk to another, usually over the internet, by sending requests and getting responses. endpointWhat is endpoint?A specific URL path on a server that handles a particular type of request, like GET /api/users. might involve creating a route handlerWhat is route handler?A Next.js file named route.js inside the app/ directory that handles HTTP requests directly - the App Router equivalent of API routes., updating the router, adding a type definition, and writing a test, Claude can propose all of these changes in one flow.

03

Git workflows

Claude Code has deep git integration. Here are the most common patterns:

Writing commitWhat is commit?A permanent snapshot of your staged changes saved in Git's history, identified by a unique hash and accompanied by a message describing what changed. messages

After making changes (either manually or with Claude's help), ask Claude to commit:

Claude Code
> commit these changes

Claude will look at the staged diffWhat is diff?A comparison showing exactly which lines were added, removed, or changed between two versions of code., understand the semantic meaning of the changes, and write a descriptive commit message. It follows conventional commit patterns and captures the "why" behind the change, not just the "what".

Creating pull requests

Claude Code
> create a PR for this branch

Claude generates a PR title and description based on all the commits in your branch. It summarizes the changes, explains the motivation, and can include a test plan. The PR is created using the GitHub CLIWhat is cli?Short for Command Line Interface. A tool you use by typing commands in the terminal instead of clicking buttons. (gh), so it works with your existing GitHub workflow.

Resolving merge conflicts

Claude Code
> resolve these merge conflicts

Claude reads the conflicted files, understands both sides of the conflict, and proposes a resolution. This is especially useful for complex conflicts where the right resolution requires understanding the intent of both changes.

AI pitfall
AI-generated commit messages are usually good, but they sometimes miss the "why." Claude describes what changed ("add retry logic to PaymentService") but may not capture why ("because Stripe API has intermittent 503 errors in EU region"). Always review and add context if the commit message is missing the motivation.
Edge case
When resolving merge conflicts, Claude occasionally picks the wrong side, especially when both sides modified the same logic in different ways. Always review conflict resolutions carefully before committing.
04

Running commands

Claude can execute shell commands and react to their output:

Claude Code
> run the tests

> build the project and fix any errors

> run the linter and fix all warnings

This creates a powerful feedback loop. Claude runs your test suite, reads the failures, identifies the root causes, proposes fixes, and runs the tests again to verify. A task that might take you 30 minutes of back-and-forth between your editor and terminalWhat is terminal?A text-based interface where you type commands to interact with your computer. Also called the command line or shell. happens in one continuous flow.

05

Slash commands reference

Slash commands are built-in shortcuts for common actions. Type them directly in the Claude Code prompt:

CommandDescription
/helpShow available commands and usage tips
/clearClear the conversation history and start fresh
/compactSummarize the conversation to free up context window space
/costShow token usage and estimated cost for the current session
/exitEnd the session
/initCreate a CLAUDE.md file for your project
/memoryEdit your CLAUDE.md memory files
/modelSwitch between available Claude models
/permissionsView and manage permission settings

The most important one to remember is /compact. Long sessions accumulate context, file contents, diffs, command outputs. When you notice Claude slowing down or responses becoming less focused, /compact summarizes everything and frees up space.

WorkflowWhat you sayWhat Claude does
Explore"How does auth work?"Reads files, traces imports, synthesizes an answer
Edit"Add validation to the form"Reads code, proposes a diff, waits for approval
Git"Commit these changes"Reads the diff, writes a meaningful commit message
Test + fix"Run the tests and fix failures"Runs tests, reads errors, proposes fixes, re-runs
Review"Review this file for bugs"Analyzes code, lists issues with line numbers
06

Putting it all together

A typical development sessionWhat is session?A server-side record that tracks a logged-in user. The browser holds only a session ID in a cookie, and the server looks up the full data on each request. might look like this:

Claude Code
> What does the PaymentService class do?
(Claude explains the class and its dependencies)

> Add retry logic for failed payment API calls - max 3 retries with
  exponential backoff
(Claude proposes changes, you approve)

> run the tests
(Claude runs tests, two fail)

> fix the failing tests
(Claude reads failures, fixes them, re-runs - all pass)

> commit these changes
(Claude writes a descriptive commit message)

Five prompts. What might have been 45 minutes of work, reading code, writing the retry logic, debugging test failures, writing a commitWhat is commit?A permanent snapshot of your staged changes saved in Git's history, identified by a unique hash and accompanied by a message describing what changed. message, flows naturally in a single conversation.