Claude Code Tutorial: Install, Surfaces, Sessions and Commands

📚 Exam guide v1.1 (exams from 7 Dec 2026)🔄 Checked against official sources: 24 Nov 2026⏱️ 7 min read🎯 D3 Claude Code Operation

👋 In plain words: Claude Code is Anthropic’s coding agent. It reads your project, runs commands, edits files and explains what it did, in your terminal, your IDE, a desktop app, the web or your phone. This lesson gets you from installation to a productive first session, one step at a time.

Advertisement

For QA engineers, Claude Code is the fastest way to put Claude to work on a real test suite: fixing locators, writing tests, explaining failures, reviewing pull requests. In this lesson you will install it, check the version, learn where it runs, start, continue and resume sessions, use the built-in commands that matter most, and run it non-interactively, using the real Claude Code CLI against a local stand-in for the API.

📖 What You’ll Learn: You will be able to install and start Claude Code, choose the right surface, manage sessions, use key built-in commands, and run a one-shot headless prompt.

🔑 Key terms

  • Claude Code: Anthropic’s agentic coding tool, which works in your project with file, search and shell tools.
  • Surface: where you use it: terminal (CLI), IDE extensions, desktop app, web and mobile.
  • Session: one conversation with Claude Code in a project, with its history.
  • Slash command: a command typed in a session, starting with /, such as /clear or /model.
  • Headless mode: running Claude Code without the interactive interface, with claude -p "…".

🪜 Step 1: Install Claude Code

Anthropic’s documentation offers a native installer (recommended) and an npm package:

⌨️ Terminal · macOS / Linux / WSL

curl -fsSL https://claude.ai/install.sh | bash

⌨️ Terminal · Windows PowerShell

irm https://claude.ai/install.ps1 | iex

⌨️ Terminal · npm (alternative)

npm install -g @anthropic-ai/claude-code

Then check it works. This course uses the Claude Code engine bundled with the Agent SDK it was built with:

⌨️ Terminal

claude --version

🖥️ Output

2.1.330 (Claude Code)

The first time you run claude interactively, it asks you to sign in with a Claude subscription or a Claude Console account (API billing), or you can point it at a cloud provider such as Amazon Bedrock or Google Vertex AI through environment variables.

Advertisement

🪜 Step 2: Pick a surface

Surface Best for
Terminal (CLI) Full control, scripting, any editor, SSH sessions
IDE extensions (VS Code, JetBrains) Seeing diffs inline, sharing the open file and selection with Claude
Desktop app A visual workspace with sessions, files, a browser pane and parallel sessions
Web (claude.ai/code) Running tasks in Anthropic’s cloud environments on your GitHub repositories, no local setup
Mobile Starting or checking on cloud tasks away from your desk
CI (headless, GitHub Actions) Automated reviews, fixes and reports (Lesson 41)

They share the same engine and project configuration (CLAUDE.md, .claude/settings.json, skills, MCP servers), so a team can mix surfaces freely.

💡 Tip: Web and mobile sessions run in a cloud environment, not on your machine. They can only see what is in the repository and the environment’s setup, so local files, local services and your laptop’s credentials are not available there.

🪜 Step 3: Start, continue and resume sessions

⌨️ Terminal

cd my-test-project
claude                 # start a new interactive session in this folder
claude -c              # continue the most recent session in this folder
claude -r              # pick an earlier session to resume
claude "explain the failing test in tests/test_cart.py"   # start with a first prompt

Inside a session:

  1. Describe the outcome, not the keystrokes: “make the checkout tests stop timing out on CI; keep the assertions unchanged”.
  2. Review before accepting. By default Claude Code asks before editing files or running commands that are not pre-approved.
  3. Press Shift+Tab to cycle permission modes (for example to plan mode, where Claude plans without changing anything, or to accept edits). Lesson 38 covers modes.
  4. Press Esc to interrupt Claude and redirect it; Esc twice lets you jump back to an earlier message.
Advertisement

🪜 Step 4: Use the built-in commands that matter

Command What it does
/init Analyses the project and writes a starter CLAUDE.md
/clear Starts a fresh conversation (use it when the task changes)
/compact Summarises the conversation to free context
/context Shows what is using the context window
/model Switches the model for this session
/permissions Views and edits allow, ask and deny rules
/memory Opens the CLAUDE.md files in use
/mcp Shows MCP servers and their connection status
/agents Manages subagents
/hooks Views configured hooks
/resume Picks an earlier session to continue
/help Lists all commands, including your custom ones
🎯 Exam focus: “Claude Code Operation” covers sessions, the CLAUDE.md hierarchy, settings.json, permission modes, headless and streaming modes, and built-in commands. Typical items: “the conversation drifted to a new task” → /clear (or a new session); “context is nearly full but the task continues” → /compact; “Claude should plan but not change anything yet” → plan mode.

🪜 Step 5: Run a one-shot headless prompt

claude -p (print mode) runs one prompt without the interactive interface and prints the answer, which is how you use Claude Code in scripts and CI:

📄 CLAUDE.md

# Project notes
- Tests: pytest -q tests/
- UI tests use Playwright with the page-object pattern in tests/pages/

⌨️ Terminal

claude -p "How do I run this project's tests?" --model claude-opus-5-5

🖥️ Output (sample run)

Run the tests with `pytest -q tests/`, as documented in CLAUDE.md. UI tests use Playwright page objects in tests/pages/.

The answer came from CLAUDE.md, which Claude Code loaded automatically from the working folder. Lesson 38 explains which CLAUDE.md files are loaded and in what order, and Lesson 41 covers JSON output, allowed tools and CI.

🌍 Real-world example: Ravi’s first week with Claude Code

Ravi ran /init in his Playwright repository, trimmed the generated CLAUDE.md to the commands and conventions that mattered, and started every task in plan mode. For quick questions he used the terminal; for reviewing larger diffs he switched to the VS Code extension, which used the same project configuration.

Advertisement

🧪 Practice Questions

Question 1. A developer finished fixing login tests and now wants Claude Code to work on unrelated report generation. The session is long. What should they do?

  • A. Keep going in the same session
  • B. Run /clear (or start a new session) so the old context does not distract the new task
  • C. Run /compact twice
  • D. Switch to a larger model
Show answer

Answer: B. A new, unrelated task should start with fresh context. /compact keeps a summary of the old task, which is useful only when continuing it.

Question 2. A team wants Claude Code to propose a migration plan without changing any files yet. Which feature fits?

  • A. bypassPermissions mode
  • B. Plan mode
  • C. Headless mode with –output-format json
  • D. /clear
Show answer

Answer: B. Plan mode lets Claude analyse and plan without making changes.

Question 3. Which two statements about Claude Code surfaces are true? (Choose 2.)

  • A. The terminal, IDE extensions and desktop app share the same project configuration such as CLAUDE.md and settings
  • B. The web surface can read files that exist only on your laptop
  • C. Web and mobile sessions run in cloud environments on repositories
  • D. Headless mode needs the desktop app to be open
Show answer

Answer: A and C. Surfaces share the engine and project files. Cloud sessions see the repository, not your local machine.

Question 4. What does claude -p “…” do?

  • A. Runs one prompt non-interactively and prints the result, for scripts and CI
  • B. Opens plan mode
  • C. Pins the model version
  • D. Prints the system prompt
Show answer

Answer: A. Print (headless) mode runs a single prompt without the interactive interface.

📝 Assignment

  1. Task 1: Install Claude Code, run /init in one of your test projects, and edit the generated CLAUDE.md down to the 10 most useful lines.
    ✅ Done when: the file lists how to run tests and your main conventions.
  2. Task 2: Use plan mode to ask for a plan to fix one flaky test, then let Claude implement it in normal mode.
    ✅ Done when: you reviewed the plan before any file changed.
  3. Stretch: Write a script that runs claude -p "list the test files that have no assertions" on your repository and saves the answer to a file.
    ✅ Done when: the script runs without any interactive prompt.
Advertisement

❓ Frequently Asked Questions

🤔 How do I install Claude Code?

Use Anthropic’s native installer (a one-line command for macOS/Linux or PowerShell on Windows) or npm install -g @anthropic-ai/claude-code, then run claude in a project folder.

🤔 What is the difference between claude -c and claude -r?

-c continues the most recent session in the folder; -r lets you choose an earlier session to resume.

🤔 When should I use /compact instead of /clear?

Use /compact to keep working on the same task with a summarised history. Use /clear when you start something unrelated.

🤔 Can I use Claude Code in VS Code?

Yes. The VS Code and JetBrains extensions run Claude Code inside the IDE, with inline diffs and the current file and selection as context.

🏁 Summary

  • Install with the native installer or npm; check with claude --version.
  • Surfaces: terminal, IDE, desktop, web, mobile and CI, all sharing project configuration.
  • claude, -c and -r start, continue and resume sessions; Shift+Tab cycles permission modes.
  • Key commands: /init, /clear, /compact, /context, /model, /permissions, /memory, /mcp.
  • claude -p runs Claude Code headless for scripts and CI.
📝 Test yourself: D3 Claude Code practice test (20 random questions, 20 minutes), or browse all CCDV-F mock tests (3 full 70-question exams and 8 domain practice tests, with explanations).

Next, continue with Claude Code CLAUDE.md, settings.json and Permission Modes.

🎬 Prefer video? Watch QA, automation and AI testing tutorials on the SQA Tools YouTube channel.

Independent study material by SQA Tools. Not affiliated with, endorsed by or sponsored by Anthropic. Claude is a trademark of Anthropic. Practice questions are original, not real exam content. Code outputs marked “sample run” come from running the exact code against a local stand-in for the Claude API, so real replies, IDs and token counts will differ. Exam facts checked against Anthropic’s official CCDV-F exam guide v1.1 on 24 Nov 2026.