HomeClaude Code › Tutorial
OverviewInstallCLI referencePricing & limitsAgent SDKSkills & pluginsGitHubWeb, desktop & IDEModelsErrorsOpen source?TutorialFor studentsQA automation中文指南
Last updated: September 22, 2026

Claude Code tutorial: your first real session

This is the session to run once, deliberately, so that every session after it is fast. Thirty minutes, a real repository, and you will have the habits that separate people who love Claude Code from people who find it expensive and erratic.

TLDR

  • Start with /init — a good CLAUDE.md is the highest-leverage file in the repo.
  • Plan before edit: ask for a plan, approve it, then let it execute.
  • Keep permissions tight, compact often, and use the cheapest model that does the job.

1. Open the project and write the memory file

cd your-project
claude
/init

/init inspects the repository and drafts CLAUDE.md: how to build, how to test, conventions, what not to touch. Edit it. Every future session reads it first, which is why it pays for itself in one day — the agent stops rediscovering your project each time.

2. Ask for a plan, not a change

> Plan how to add rate limiting to the /api/upload route. Don't edit anything yet.

Read the plan. Correct it in plain language. Then: go ahead. Plan-then-execute produces better changes and cheaper sessions than letting the agent explore by editing.

3. Let it run the tests

Tell it how tests run (or let CLAUDE.md say so) and ask it to run them after the change. The loop — edit, test, read the failure, fix — is where the agent is strongest. Watch the permission prompts: each one is a chance to fence what it may do.

4. Permissions

/permissions

Allow read and edit freely, allow specific safe commands (Bash(npm test), Bash(git diff *)), and keep anything destructive on ask. In scripts, encode the same set with --allowedTools.

5. Compact when the topic changes

/compact focus on the rate limiter; drop the earlier exploration

Context is cost. Every turn resends everything so far. Compact at each change of direction and /clear between unrelated tasks — this single habit halves most people's bills.

6. Pick the model per step

Stay on the Sonnet tier by default. For the one genuinely hard decision, /model to Opus, make the decision, switch back. The models guide covers the tiers and how to pin them.

7. Commit and review

> Commit this as a single change with a message that explains the rate limit values.

Have it commit, then read the diff yourself. The agent is a fast, tireless junior engineer with an excellent memory of your CLAUDE.md — treat its output with the same review you would give one.

Where to go next

Frequently asked questions

What is CLAUDE.md?

The project memory file Claude Code reads at the start of every session: build and test commands, conventions, boundaries. /init drafts it; you keep it current.

What is plan mode in Claude Code?

Asking for a plan without edits, approving it, then executing. It produces better changes and shorter, cheaper sessions than exploratory editing.

How do I stop Claude Code from asking permission every time?

Use /permissions to pre-approve safe tools and commands, or --allowedTools in scripts. Keep destructive commands on ask.

Run Claude Code on the gateway

Same models, two environment variables, credits at 7.69× face value — or a flat-rate unlimited plan.

Get an API key See unlimited plans

AI Prime Tech is an independent API gateway and is not affiliated with, endorsed by, or sponsored by Anthropic. “Claude” and “Claude Code” are trademarks of Anthropic. Claude Code features described here follow Anthropic’s public documentation at the time of writing and change frequently; prices and model lists on this page are read from this gateway’s live settings.

More Claude Code guides

Claude Code: the complete guideHow to install Claude CodeClaude Code CLI documentation: commands and flagsClaude Code pricing and limits, explainedThe Claude Code SDK, now the Claude Agent SDKClaude Code skills and pluginsClaude Code in GitHub: the App, the Action and @claudeDoes Claude Code have a web interface? Web, desktop and IDE explainedWhich model Claude Code uses, and how to change itClaude Code errors and how to fix themIs Claude Code open source?Claude Code for studentsHow to use Claude Code for QA automationClaude Code 怎么用:从安装到日常使用