Skip to content

Course · Claude Code · Getting started

Sign in and check the agent's first answer

Before the agent can work on the health check, it needs access to a model. Before you let it change the health check, you need a reason to believe its account of the code. Those are two different checks. Signing in handles the first.

On first launch, follow the browser login flow. Use the account your organization has provisioned, a supported Claude subscription, or a Console account. The free Claude plan does not include Claude Code access. Organizations using a cloud provider may supply a different setup; the authentication guide lists those paths.

If the browser does not open, copy the login URL offered by the terminal and open it yourself. If the browser returns a code instead of completing the callback, paste it at the terminal’s login-code prompt. That can happen over SSH or in a container. Slash commands are typed at the prompt of a running Claude Code session (the install lesson covers launching one in your project): use /login to start sign-in again when needed, and /logout to leave the current account.

With the CLI signed in and open in the project (the install lesson covers that setup), send this prompt before asking for any edits. The prompt and the reasoning that follows use the chapter’s payments service as the worked example: an Express and TypeScript service whose routes begin in src/index.ts, with Vitest tests in tests/. If you are working in your own repository, use its paths and test command. If it has no health route, ask about another small existing handler or function and check the answer against that source in the same way; you do not need to create a health route to complete this lesson.

Find the existing health-check route and the test command in this project.
Show the relevant file paths and the route's current response.
Explain what the health check establishes about the service.
Do not edit files or install anything.

This is an instruction to inspect, not a security control. The control is the permission mode: launched with --permission-mode default as the install lesson recommends, Claude asks before file edits and shell commands that no saved permission rule already allows, and it can still read files without asking. Read each request; this task needs only reads, so decline an edit or command request that goes beyond inspection. What you are testing here is more specific than whether the answer sounds knowledgeable: can the agent connect a claim to the file that supports it?

In the payments project, the relevant code is in src/index.ts; the excerpt and the reasoning below can be followed without a checkout:

app.get("/health", (_req, res) => {
res.json({ status: "ok" });
});

That excerpt is source code, not a captured Claude response. The test command comes from package.json, where npm test runs vitest run. Open those files yourself, or the files your own repository’s answer names, and compare them with the answer. If the agent describes a src/routes/health.ts file that does not exist, ask it to locate the handler again. A familiar-looking project layout is not evidence of this project’s layout.

Look at the handler once more. It returns a literal object. It does not call the payment processor, inspect the ledger, or contact an external system.

Suppose payment processing were broken while this handler still answered requests. Would its response change? Nothing in these lines would make it change. A successful request establishes that this route can answer; it does not establish that a customer can complete a payment. That limit belongs beside the result, even though the endpoint is called “health.”

You now have enough information to sharpen the ticket - the change you are preparing to hand the agent. The monitor expects /healthz, but /health already exists. Replacing the old address could break a caller you have not investigated. Adding the new address while keeping the old one gives you a smaller, clearer change to review.

The first answer has earned its value if it helped you make that decision and showed you where to verify it. You do not need a tour of every file. You need the few facts that constrain this change.

Give Claude the ticket, including the behavior that must survive.