Claude Code — Introduction

Claude Code is a terminal agent — here is what it does and why developers love it.

What this covers

Claude Code is a terminal agent — here is what it does and why developers love it.

Key tools and concepts:

  • Claude Code: Anthropic’s command-line AI coding agent that can read, edit, and run code in your terminal.
  • Claude: Anthropic’s conversational AI assistant (similar in role to ChatGPT) with file, long-context, and tool support.

Who this is for

Developers comfortable with the command line.

When to reach for it

Multi-file changes, agentic tasks, codebase exploration.

Step by step

  1. Install via the official install instructions.
  2. Run claude in a project directory.
  3. Write a CLAUDE.md describing the project.
  4. Issue a first task: “Add a /health endpoint to src/server.ts.”

Keyboard Shortcuts Guide

Claude Code shortcuts can vary by terminal, IDE, operating system, and version. The safest habit is to press ? inside a session to see the shortcuts available in your current environment. If Shift + Enter does not insert a newline, run /terminal-setup first.

Shortcut / inputWhat it doesWhen to use it
?Shows the current shortcut helpWhen you forgot a key, changed terminals, or just installed Claude Code
Ctrl + CCancels the current input or interrupts generationWhen Claude is going off track or a command is taking too long
EscInterrupts the current Claude response or tool callWhen you want to redirect without losing the completed work
Esc then EscOpens the rewind / checkpoint menuWhen you need to return to an earlier conversation or code state
Shift + TabCycles permission modes: default, auto-accept edits, Plan, and related modesWhen moving from planning to editing, or tightening permissions again
Ctrl + RSearches prompt historyTo recover an earlier long prompt or command
/ Browses prompt history; also moves within multiline inputTo reuse or adjust the previous task
Ctrl + OOpens the detailed transcript viewTo inspect which files Claude read and which tools it ran
Ctrl + LRedraws the terminal screenWhen the terminal display looks stale or broken
Ctrl + BBackgrounds a running taskWhen a long task should not block the current screen
Ctrl + TShows or hides the task listWhen background tasks, subagents, or long commands are running
Ctrl + A / Ctrl + EMoves to the start / end of the current lineWhen editing a long prompt
Ctrl + K / Ctrl + U / Ctrl + WDeletes to end of line / start of line / previous wordTo rewrite input quickly
Ctrl + YPastes back recently deleted textTo recover a prompt fragment you just removed
Shift + EnterInserts a newlineFor multiline requirements, logs, or checklists
Ctrl + JInserts a newline in many terminalsFallback when Shift + Enter is not supported
\ then EnterUniversal newline inputWorks across terminal setups
/ at the startOpens the command / skill menuTo find /plan, /diff, /skills, or a custom skill
@ + pathReferences a file or directoryTo tell Claude exactly which file, component, or config directory to read
! at the startEnters shell mode and brings command output back into contextTo show Claude npm test, git status, or logs

On macOS, shortcuts such as Option + P for model switching, Option + T for thinking mode, and Option + O for fast mode may require configuring Option as Meta in your terminal. iTerm2, Apple Terminal, and VS Code place this setting in different places; if the shortcut does nothing, check the terminal settings first.

Detailed Operation Guide

1. Start from the right directory

Enter the project root, then run:

claude

The project root is usually the level with package.json, pyproject.toml, Cargo.toml, or .git. Avoid launching from src/, app/, or components/; otherwise Claude may reason from a partial project view.

2. Initialize project memory first

For a new repository, run:

/init

This creates or updates CLAUDE.md. Include:

  • What the project is and the main tech stack.
  • Common commands: install, dev, test, build, format.
  • Directory map: pages, components, APIs, scripts, and tests.
  • Files Claude should avoid: production config, migrations, generated output, secrets-related files.
  • Code style: naming, component organization, error handling, testing habits.

Use /memory later to view or edit the active CLAUDE.md.

3. Use Plan mode before large edits

For broad changes, do not start with code. Start with:

/plan Add a forgot-password flow to the login page. Read the relevant files and propose an implementation plan. Do not edit code yet.

Review three things:

  • Did it read the right files?
  • Did the plan expand beyond the requested scope?
  • Did it include validation: tests, build, or manual check paths?

If the plan is too large, narrow it: “UI only, no API integration”, “only these two files”, or “write tests first, do not implement.”

4. Use /skills and specific /skill-name commands

People sometimes say “use /skill”, but the more reliable model is:

  • Type / to open available commands, built-in workflows, plugin commands, and skills.
  • Use /skills to list skills available in the current session.
  • To run a skill, use its own slash name, such as /security-review, /simplify, or /claude-api; follow what your / menu shows.
  • Custom skills usually live in .claude/skills/<name>/SKILL.md, and the invocation name is usually /<name>.

Use a skill when:

  • The task has a repeatable workflow, such as security review, release checks, API migration, or documentation generation.
  • The workflow needs reference docs, scripts, or templates, not just a short prompt.
  • The team wants everyone to run the same checklist.

Skip a skill when:

  • The task is a one-off small question and a direct prompt is faster.
  • You only need to reuse one short instruction; a custom slash command or prompt template is enough.

5. Put boundaries around execution

After approving a plan, give Claude a narrow task:

Execute step 1 from the plan. Only modify files under src/routes/auth and src/components/auth. Do not commit. When done, list changed files and validation commands.

Good boundaries usually include:

  • Which files or directories may change.
  • Which files or directories must not change.
  • Which step this round covers.
  • What validation should run after the edit.
  • Whether Claude may commit. Default to no unless you explicitly ask.

6. Review the diff before continuing

After each round, check:

/diff

Look for:

  • Unrelated files changed.
  • New dependencies, config, or environment variables.
  • Code that looks complete but does not cover the real path.

If the diff is wrong, press Esc, or use Esc + Esc to rewind. For small problems, say: “Keep A, revert B, only fix C.”

7. Finish with tests and builds

Before Claude validates, specify the commands:

Run npm test and npm run build. If either fails, explain the failure first; do not make broad edits immediately.

If the project has no tests, ask for at least:

  • git diff --check for whitespace errors.
  • Typecheck or build.
  • Manual checks for key pages or APIs.
  • A list of anything Claude could not verify.

8. Manage context during long tasks

When context gets long, use:

  • /context to see what is taking up context.
  • /compact to summarize the session; add: “Keep changed files, open todos, validation results, and omit casual chat.”
  • /clear to start a new task while keeping CLAUDE.md project memory.
  • /resume to return to an earlier session.

A useful habit after each milestone:

Summarize current state: changed files, key decisions, test results, remaining todos, and recommended next step. Keep it under 20 lines.
  1. Run claude in the project.
  2. Use /init to create CLAUDE.md.
  3. Use /plan <task> before editing.
  4. Approve one small step.
  5. Review with /diff.
  6. Run tests / build.
  7. Commit manually.
  8. Move to the next step.

CLAUDE.md → first prompt → review diff → iterate.

Common mistakes

  • Running it outside a project root
  • No CLAUDE.md
  • Letting it commit without review

FAQ

Q: Do I need to know the command line to use Claude Code? A: Yes — basic terminal comfort is required. You’ll run claude in your project root, navigate directories, and read diff output. If cd, git status, and ls aren’t familiar yet, learn those first.

Q: What’s the role of CLAUDE.md? A: It’s the persistent project brief Claude Code reads on every run — coding conventions, build commands, test commands, and anything you’d tell a new teammate on day one. Without it, the agent rediscovers your setup each session and makes more mistakes.

Q: Will Claude Code commit changes for me automatically? A: It can run git commit if you ask, but always review the diff first. Letting it commit unreviewed work is the #1 source of regressions — treat its output like a junior teammate’s PR.

Q: How is Claude Code different from chatting with Claude.ai? A: Claude.ai is a web chat; Claude Code is an agent that lives in your terminal and can read/edit files and run commands. Use Claude.ai for one-off questions, Claude Code for multi-file changes inside a real repo.

Tags: #Claude #Tutorial #Claude Code