How to Use Claude Code: 5 Beginner Steps for 2026, From Install to First Edit
Claude Code is a coding assistant that runs in your terminal. You start it in a project directory, describe a task in plain language, and it reads your code, proposes changes, and writes files once you approve. Usage boils down to five steps: install, pick one authentication method, launch it inside your project directory, give it a small, specific task, and review its changes. This article follows that order. For exact commands and options, Anthropic's official documentation is the authority; this article covers the approach and how to self-check.
How do you use Claude Code, and what is the overall flow?
- Install the command-line tool.
- Pick an authentication method: sign in with an official account, or use an API key (plus an optional endpoint URL).
cdinto your project directory and runclaude.- Start with something small, such as explaining one module or fixing a clearly defined bug.
- Read the changes it proposes and approve them only after you've checked; keep git around so you can roll back.
Beginners most often get stuck on steps 1 and 2: the install environment is wrong, or it's unclear which authentication method applies.
How do you install it?
The official install methods change between versions. A common one is a global npm install, and there is also an official install script. Using npm as the example:
node -v # first confirm Node.js is installed; check the official docs for the required version
npm install -g @anthropic-ai/claude-code
claude --version
If claude --version prints a version number, the install worked. If the shell says the command isn't found, the global npm directory is most likely not on your PATH. That is an npm issue, not a Claude Code issue.
How do you choose an authentication method?
On startup it needs to know whose quota to use. There are two common options:
| Method | How | Best for | Watch out for |
|---|---|---|---|
| Official account sign-in | Run claude and follow the prompts to sign in in your browser | People who already have a usable Claude subscription or Console account and live in a region the official service supports | The account and region must comply with the official terms of service; if you're restricted, the only route is the official appeals process |
| API key + endpoint URL | Supply the key through an environment variable and, if needed, also set an endpoint URL | People who want pay-as-you-go billing, or who use a gateway compatible with the Anthropic API | Keep the key secret and never commit it to a repository |
For billing and trade-offs between the two, continue with Claude Code: API key login or subscription login, and how to switch. If you don't have a key yet, read How to use the Claude API: from getting a key to your first request first.
The minimal API-key setup is two environment variables (check the official docs for the exact names; these are the common ones):
export ANTHROPIC_API_KEY="your key"
# only needed when you use a gateway or proxy
export ANTHROPIC_BASE_URL="https://your-endpoint-url"
claude
To make this permanent so you don't have to export it in every new terminal, put it in settings.json. For the hierarchy and precedence, see Claude Code settings.json: hierarchy, precedence, and env configuration.
What if you have no Claude account and no convenient overseas credit card?
Plenty of readers are in this position, especially in China. The official route requires an account, payment usually needs a payment method supported outside China, and the service is only offered in certain regions. Treat the official statements as authoritative, and follow the terms of service and local regulations.
Another legitimate route is a third-party gateway that is compatible with the Anthropic API format, which you connect to with an "endpoint URL + key". AGI Plan is one such service. AGI Plan is a commercial partner of cdnping, so the relationship is stated up front. According to its website:
- One monthly subscription lets you switch between several capability groups, and you pay in RMB, with no overseas credit card needed.
- Using Claude Code with it does not require a Claude account; you change one endpoint URL, and there is a step-by-step tutorial.
- It is compatible with both the OpenAI and Anthropic API formats, so tools such as Codex and OpenCode work too.
- It states explicitly that it is not an officially authorized channel, and some models are marked "overseas only"; see https://agiplan.dev/models for specifics.
To see how setup works, read the AGI Plan getting-started page. For the general approach, see Can you use Claude Code without a Claude account? How the endpoint URL method works. Before choosing any gateway, read Is a Claude API relay safe? Four main risks and checks you can run yourself and then decide.
What should you ask it to do after the first launch?
Don't open with "refactor the whole project." Your first task should be small and verifiable. Try this sequence:
- Go to your project directory and run
claude. - Start with a read-only question: "Which file is this project's entry point? Explain the directory structure." Confirm it read the code correctly.
- Run
/initto have it generate a project notes file (usually CLAUDE.md), which it consults in every later session. You should review and correct what it generates. - Then give it one clear, small change, for example: "Add a unit test for
formatDateinutils/date.jsand run the tests." - When it asks to write a file or run a command, read each request before agreeing. Don't approve everything in a row.
- After it finishes, check with
git diffand commit once you're satisfied.
When you write the request, state three things: where to change, what result you expect, and how to verify it. "Fix the login failure" is weaker than "When the username is empty, login() should return error code 400; it currently returns 500. Fix it and add a test."
What are the common slash commands?
Typing / in a session lists the commands currently available; trust what your local version shows. The ones beginners use most:
| Command | Purpose |
|---|---|
/help | Show help and the available commands |
/init | Generate a notes file for the current project |
/clear | Clear the current conversation context; use it when switching tasks |
/compact | Compress a long conversation while keeping the key points |
/model | View or switch the model |
/login, /logout | Change your sign-in state |
The longer a conversation runs, the more it consumes and the easier it drifts off topic. Running /clear when a task is done is the easiest habit to build. To estimate monthly cost, read How to estimate Claude Code token usage.
What do you check first when it won't start or is slow?
Work from the outside in:
- First check whether the service itself is healthy. cdnping's Claude Code status page combines the official status page, API probes, and user reports, and Anthropic API status shows the probe history.
- Then check your own network. To find out whether the proxy, DNS, or TLS layer is failing, go through Claude Code connection timeouts and errors: a four-layer network checklist item by item.
- A 401 or an authentication prompt is usually a conflict caused by having both a sign-in session and an API key present. Make sure only one authentication method remains; details in Claude Code auth conflict warning and 401 errors.
- When latency is high, distinguish slow first connection from slow round trips. For the approach, see AI API latency.
What should you do next?
You can do just three things today: install it and see the version number; settle on one authentication method rather than mixing the two; and run the full loop of ask, change, review, and commit on a small, unimportant project. Once that works, read the settings.json and cost-estimation articles.
If you're stuck on the account or payment and want to try it first, see the steps on the AGI Plan getting-started page. To repeat: it is a commercial partner of cdnping and not an officially authorized channel, and plans and prices are as listed at https://agiplan.dev/pricing. If you already have an official account, just use the official route; there's no need to switch.