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
- Install via the official install instructions.
- Run
claudein a project directory. - Write a CLAUDE.md describing the project.
- 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 / input | What it does | When to use it |
|---|---|---|
? | Shows the current shortcut help | When you forgot a key, changed terminals, or just installed Claude Code |
Ctrl + C | Cancels the current input or interrupts generation | When Claude is going off track or a command is taking too long |
Esc | Interrupts the current Claude response or tool call | When you want to redirect without losing the completed work |
Esc then Esc | Opens the rewind / checkpoint menu | When you need to return to an earlier conversation or code state |
Shift + Tab | Cycles permission modes: default, auto-accept edits, Plan, and related modes | When moving from planning to editing, or tightening permissions again |
Ctrl + R | Searches prompt history | To recover an earlier long prompt or command |
↑ / ↓ | Browses prompt history; also moves within multiline input | To reuse or adjust the previous task |
Ctrl + O | Opens the detailed transcript view | To inspect which files Claude read and which tools it ran |
Ctrl + L | Redraws the terminal screen | When the terminal display looks stale or broken |
Ctrl + B | Backgrounds a running task | When a long task should not block the current screen |
Ctrl + T | Shows or hides the task list | When background tasks, subagents, or long commands are running |
Ctrl + A / Ctrl + E | Moves to the start / end of the current line | When editing a long prompt |
Ctrl + K / Ctrl + U / Ctrl + W | Deletes to end of line / start of line / previous word | To rewrite input quickly |
Ctrl + Y | Pastes back recently deleted text | To recover a prompt fragment you just removed |
Shift + Enter | Inserts a newline | For multiline requirements, logs, or checklists |
Ctrl + J | Inserts a newline in many terminals | Fallback when Shift + Enter is not supported |
\ then Enter | Universal newline input | Works across terminal setups |
/ at the start | Opens the command / skill menu | To find /plan, /diff, /skills, or a custom skill |
@ + path | References a file or directory | To tell Claude exactly which file, component, or config directory to read |
! at the start | Enters shell mode and brings command output back into context | To 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
/skillsto 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 --checkfor 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:
/contextto see what is taking up context./compactto summarize the session; add: “Keep changed files, open todos, validation results, and omit casual chat.”/clearto start a new task while keepingCLAUDE.mdproject memory./resumeto 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.
9. Recommended beginner sequence
- Run
claudein the project. - Use
/initto createCLAUDE.md. - Use
/plan <task>before editing. - Approve one small step.
- Review with
/diff. - Run tests / build.
- Commit manually.
- Move to the next step.
Recommended workflow
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.
Related
Tags: #Claude #Tutorial #Claude Code