Claude Code guide in three levels, Beginner to Advanced: hands-on lessons with checked exercises, every volatile fact cited to its source. Independent community guide.
Your first change, from request to commit
Beginner · Lesson 3 of 5 · about 20 minutes · Needs: Permission modes and plan mode · Verified against Claude Code v2.1.308 (stable) on 2026-10-25
Goal
By the end of this lesson you can take a change from request to commit, and review a change well enough to catch what it gets wrong before it is committed.
You need
- Your copy of the practice template, and Node.js LTS (a Codespace on your copy has it).
- No uncommitted changes:
git statusreadsnothing to commit, working tree clean. - A second terminal open in the same folder, for git.
- Usage: light.
The idea
Asking for a change and accepting whatever comes back is how sessions go wrong. Anthropic's best practices recommend four phases: explore, plan, implement and commit. Auto mode doesn't send ordinary source edits to its classifier (lesson 2, How the classifier evaluates actions), so whether the change is right is yours to judge, in two places: the plan, before Claude starts, and the diff, before anything is committed.
A precise request needs fewer corrections: it names the file, the case to handle, what must keep working, and the check to run, and asks Claude to show you the output (Provide specific context, Give Claude a way to verify its work).
- Explore in plan mode: Claude reads, and doesn't edit your files.
- Plan, and approve it only when it changes the files you expect.
- Implement in auto mode, and keep working while Claude does.
- Test: read the real output, not Claude's summary.
- Review the diff, the tests included, and correct what you find.
- Commit, so the change is saved and easy to undo.
Worked example
The practice app checks Markdown links, but it skips any link with a title, such as [setup](setup.md "Setup guide"). You'll fix that.
Start
claudein your practice copy and enter plan mode, as in lesson 2: the status bar reads⏸ plan mode on. Explore:How does this app find links in a Markdown file? Which kinds of links would it miss?Your wording will differ, but Claude should point to
src/links.jsand mention links with a title.Plan:
Plan a change so links with a title, in double or single quotes, are checked too, like [setup](setup.md "Setup guide") and [faq](faq.md 'FAQ'). Add a test for each to test/links.test.js, run the tests and show me the output.Read the plan before you choose. It should change only
src/links.jsandtest/links.test.js; a file it reads or names as needing no change is fine. If it also changes another file, such assrc/cli.js, or adds one, send it back as in lesson 2: use the plan menu to ask Claude to keep the change to those two files.When the plan is right, choose Yes, and use auto mode, as in lesson 2. Claude edits and runs the tests without asking. If Claude starts on a file the plan didn't name, press
Escand tell it to keep to the plan: correct it as soon as it goes off track, rather than after it finishes (Best practices).While Claude works, or once it's done, ask a side question:
/btw in one sentence, why does the current pattern skip a link with a title?Claude answers in an overlay, from what the session has already read, without tools and without interrupting the work. The question and answer never enter the conversation, so they don't steer Claude. Press
Space,EnterorEscto close it (Interactive mode). To change what Claude does, send a normal message instead.Read the test output yourself. When Claude is done, ask, even if it already ran the tests:
run the testsClaude Code collapses long command output to a short summary. Press
Ctrl+Oto open the transcript viewer, find the test summary near the end, and pressCtrl+Oagain to go back (Interactive mode). It should reportfail 0.On a real project, press
Ctrl+Bto move a long test run or dev server to the background (twice in tmux), and/taskslists and stops it (Background Bash commands).Review the diff. Type
/diffto see the changes in your working tree, Claude's edits included (Interactive mode). One of two views opens:- A panel beside the conversation. Its list leaves test files and generated files out and counts them on a line of their own: click that line to see the test. The panel may already be open: read it there, because typing
/diffcloses it (Diff panel). - A dialog above the prompt. Select a file with the arrow keys, press
Enterto read its diff, and pressEscto go back.
Read each line, the test included, and ask: does the test cover both kinds of quotes, and does the code leave the title out of the target? To read the diff in the second terminal instead, run
git diff(git diff). It leaves out a file git doesn't track yet until you rungit add -N <file>(git add).- A panel beside the conversation. Its list leaves test files and generated files out and counts them on a line of their own: click that line to see the test. The panel may already be open: read it there, because typing
Correct what the review found, in plain words. For example, if the test covers only double quotes:
The test covers only double-quoted titles. Add a case for a single-quoted title, like [faq](faq.md 'FAQ'), and run the tests again.Then read the diff again. If the review found nothing to correct, go on: Your turn has something to find.
Commit:
commit this with a message that says what changedIf Claude puts the commit on a new branch, that's fine: the check works on any branch. To keep it on your current branch, say so in your prompt. In the second terminal,
git status(git status) ends withnothing to commit, working tree clean.
Your turn
Decide whether a teammate's patch does only what it says, and fix it before it's committed. The patch is practice/b-3/protocol-relative.patch: its description says what it changes, and its test passes.
- Read the patch, its description first. In the second terminal, run
cat practice/b-3/protocol-relative.patch(Windows:Get-Content practice/b-3/protocol-relative.patch), or open it in your editor. For each kind of link the checker handles, ask: does the new line skip it, and does the description say it should? The description's last sentence is a claim you can test. - Apply it, so its change is in your working tree:
git apply practice/b-3/protocol-relative.patch. This changes the files and makes no commit (git apply).git statuslistssrc/links.jsas modified andtest/external.test.jsunderUntracked files. Rungit add -N test/external.test.js, sogit diffshows the new file too.npm testpasses: passing tests don't make the patch right. - Write the request yourself, in your own words: name the file and the case the patch gets wrong, say what must keep working, ask for a test that would fail on the patch's version, and ask Claude to run the tests and show you the output.
- Review the result as in the Worked example's steps 4 and 5: read the test output yourself, then the whole diff, the tests included. In
/diff, read theCurrentview: a turn view shows only Claude's own edits, so it leaves out the patch's lines (Interactive mode). If you started this session after applying the patch, the panel folds the patch's lines into one line at the bottom of its list: click it (Diff panel). - Ask Claude to commit the fix, its test and the patch's test together.
git statusends withnothing to commit, working tree clean.
Check
You are done when all of these are true:
- Links with a title, in double or single quotes, are checked.
- Protocol-relative links, such as
//cdn.example.com/app.js, are skipped, and every other link is checked as before. - Your tests catch the planted flaw: with the patch's
isExternalput back, they fail. - Your last commit changes a test file and at least one other file:
git show --stat HEAD(git show). - The tests pass:
npm testreportsfail 0. - Nothing is left uncommitted:
git status --porcelainprints nothing. - Self-check (not tested): you found the patch's flaw by reading it, and you read each diff, the tests included, before it was committed.
In the second terminal, run npm run check -- b-3 in your practice copy.
If titled links are still skipped, or reported with the title in the target, finish the Worked example: ask Claude to leave the title out of the target, with a test for each kind of quotes. If the check says a link is still skipped, or reports //cdn.example.com/app.js as broken, compare the patch's description with what its new line skips, and make sure you ran the git apply in Your turn step 2. If your tests still pass with the patch's version, none of them covers what the patch broke: ask Claude for one that fails on it. If your last commit has no test file, or only tests, ask Claude to amend it (git commit --amend (git commit)), or to combine it with the commit before, as long as you haven't pushed them. If the tests fail, read the first failure and ask Claude to fix the code, not the test. If git status --porcelain lists files, commit them.
Go further
- Common workflows: step-by-step guides for fixing bugs, refactoring and testing.
- Give Claude a way to verify its work: why a test beats a summary.
/code-review: reviews your current diff for correctness bugs, a second check before you commit.
Sources: Best practices · Choose a permission mode · Interactive mode · Commands · git add · git apply · git diff · git status · git show · git commit
← Permission modes and plan mode · Beginner index · Keep a session on track → · Topic: Permissions and safety · Stuck on this lesson?