Claude Code Tutorial: From Zero to Your First Autonomous Agent Session
Claude Code is the terminal agent everyone keeps talking about, and the fastest way to understand it is to run it. This Claude Code tutorial takes you from a blank terminal to your first autonomous agent session: installing it, authenticating, running your first task, writing a CLAUDE.md, using plan mode, and connecting MCP servers. No prior agent experience needed.
By the end you will have an agent that reads your repo, edits files, runs commands, and iterates on its own. And at the very end, the level 2 upgrade most tutorials skip: making it remember you between sessions.
What Claude Code actually is
Claude Code is Anthropic's agentic coding tool that lives in your terminal. You describe what you want in plain language, and it plans the work, reads files, makes edits, runs shell commands, and keeps going until the task is done or it needs you. Think of it less like autocomplete and more like a junior engineer you can delegate to.
Step 1: Install Claude Code
You need Node.js 18 or newer. Then it is one command:
npm install -g @anthropic-ai/claude-code
Verify it worked:
claude --version
That is the whole install. Nothing else to configure yet.
Step 2: Authenticate
Run claude for the first time and it walks you through authentication. You can sign in with a Claude subscription (Pro or Max) or use API billing via the Anthropic Console. The subscription route is the simplest if you already pay for Claude.
Once auth completes, you land in an interactive session. You are in.
Step 3: Your first session
Open a terminal inside any real project of yours, a repo you actually work in beats a toy example, and type:
claude
Now give it something small and concrete:
"Look at this repo and tell me how the authentication flow works. Do not change anything."
Watch what it does. It will explore the file tree, read the relevant files, and explain. That read-only first task teaches you more than any docs page, because you see the agent reason about real code.
Now give it a real task:
"Add input validation to the signup form so empty emails are rejected with a clear error message. Run the existing tests after your change."
It will find the form, make the edit, and run the tests. You review the diff. That loop, delegate then review, is the entire Claude Code workflow.
Step 4: Prompt it well
The difference between a frustrating session and a great one is usually the prompt. A few rules that hold up:
Be specific about the outcome, not the implementation. "Users should not be able to submit empty emails" beats "add a check in the handler." Let the agent find where the check belongs.
Give constraints upfront. "Do not touch the database layer" or "keep the existing code style" saves you from reviewing changes you never wanted.
One task per session. Finish the feature, commit, and start fresh for the next thing. Long sessions accumulate stale context and the agent quietly gets worse. Starting clean is a feature, not a failure.
Ask it to explain before it acts on anything risky. "Explain your plan before editing" on unfamiliar codebases prevents confident wrong moves.
Step 5: Write a CLAUDE.md
Every time you find yourself repeating an instruction, it belongs in a CLAUDE.md file at your project root. Claude Code reads it automatically at session start. A good one is specific:
# Project conventions
- This is a Next.js app with the App Router. Server components by default.
- Run `npm test` after every change. Do not commit failing tests.
- Error handling: throw typed errors, never swallow them silently.
- Before any database migration, explain the plan and wait for approval.
- We use pnpm, not npm.
This is the cheapest context you will ever give the agent. Update it whenever you catch yourself typing the same correction twice. You can also keep a global one in your home directory for rules that apply to every project.
Step 6: Use plan mode for bigger tasks
For anything touching multiple files, do not let the agent dive straight into edits. Ask for a plan first:
"Use plan mode: research how we should add rate limiting to the API routes, then propose a plan before writing any code."
In plan mode the agent explores read-only and writes up its approach. You approve or redirect, then it implements. The two-phase rhythm (explore, then execute) produces dramatically better results on multi-file work than diving in blind.
Step 7: Meet subagents
When a task has independent parts, Claude Code can split work across subagents that run in parallel, each with its own context. You do not need to configure anything to benefit: just describe a task with clearly separable parts ("audit the auth module for security issues and separately check the API routes for missing validation") and the main agent will fan out. Subagents keep the main context clean, which is why big refactors survive longer before degrading.
Step 8: Connect MCP servers
MCP (Model Context Protocol) is how Claude Code reaches beyond the terminal: databases, issue trackers, browsers, custom tools. Adding a server is usually one command:
claude mcp add --transport stdio my-db -- npx -y my-mcp-server
Once connected, the agent can query your actual database or pull real tickets instead of guessing. An agent with your real tools beats a cleverer agent stuck in the terminal. Start with one server for something you look up constantly, and add more as you feel the gaps.
Level 2: Make it remember you
Here is what no beginner tutorial tells you, and what you will feel within a week: every session starts cold. Monday morning, fresh terminal, and the agent is a stranger again. You re-explain the project, the decisions, the thing you figured out last Tuesday. Your CLAUDE.md helps, but it is a static instruction file, not a memory. It does not remember what you decided, what failed, or where you left off.
The fix is a memory layer underneath the sessions. That is what Vilix AI is: a shared memory and work-state layer that connects to Claude Code over MCP, tied to one account, so your context survives the weekend.
Setup is straightforward. Connect Claude Code to your Vilix AI account over MCP and enable the memory tools. From there:
- At the start of a session, the agent calls
get_contextand loads the relevant saved context: project state, your decisions, your rules, where you left off. No twenty-minute briefing. - As you work, it calls
save_turnto save the exchange. Retrieval is semantic, so it finds what you meant, not just what you typed, and it pulls only what is relevant instead of dumping the archive. - The same memory follows you everywhere else too: Codex, Cursor, OpenClaw, Hermes, ChatGPT, any MCP-compatible AI, on your phone and your laptop. Plan in one tool, build in another, your context comes with you. Correct something once and it is corrected everywhere, because every tool reads the same memory. When two tools save conflicting info, the most recent save wins, so the newest version is always what the AI sees.
One honest caveat, because nobody selling memory tooling tells you this: the model decides when to call the memory tools, and models can be lazy about it. Sometimes you nudge it: "check Vilix AI for context first." Then it works. That is how MCP works, not a bug in any one product.
Vilix AI is cloud-hosted, so there is nothing to install and no infrastructure to manage. It stores your full conversation history, not just extracted facts, so you can revisit the actual conversation any time. Your data is portable: export everything or delete individual memories (or the whole account) whenever you want. There is a free plan, and a 7-day Pro trial with no credit card required.
You now know enough to run Claude Code well. The tutorial above gets you productive today; memory is what keeps you productive every day after.
Start here: https://vilix.ai?utm_source=devto&utm_medium=article&utm_campaign=claude-code-tutorial
Working through this tutorial right now? Drop a comment with where you got stuck, or how you handle the cold-start problem today. And if you want the memory layer set up, the free plan plus the 7-day Pro trial (no credit card) is the way to try it: https://vilix.ai?utm_source=devto&utm_medium=article&utm_campaign=claude-code-tutorial
Top comments (0)