Claude Code Basics: Installation, Permissions, Models, and Context Management
This guide explains Claude Code step by step, from installation and first launch to permission modes, model selection, context cleanup, and writing CLAUDE.md. It also corrects oversimplified information about permissions and costs in the source material based on the official documentation.
Claude Code is an agentic coding tool that can read and modify files in a project directory and run terminal tools.
VS Code is a convenient option but not a requirement; Claude Code can also run in supported terminal environments.
For beginners, it is safer to review the scope of work in Plan mode before switching to default mode or Accept Edits mode.
Costs vary depending on the authentication method, selected model, input context, and number of task iterations.
CLAUDE.md is not a repository for conversation memory, but an instruction file that repeatedly provides the project's structure, commands, and rules.
Claude Code is an agentic development tool that lets you use Anthropic's Claude in the terminal and code repositories. Rather than merely answering with code snippets, it can explore and edit files, run commands, execute tests, and analyze errors within the permitted scope.
This guide explains not only the installation process, but also how to configure permissions safely, how to choose the right model for a task, and how to manage context and project instructions. Commands and supported environments may be updated, so when installing, check the latest commands shown in the official setup documentation.
Three Ways to Code with Claude
The key difference between these approaches is not the output, but the extent to which the tool interacts with the local project.
Approach | Local file access | Command execution | Suitable tasks | Main limitations
Claude web | Limited by default | Unavailable by default | Questions, code explanations, short examples, design reviews | Requires copying and running responses to apply them directly to the project
Claude desktop app | Varies by feature, integration, and user approval | Varies by feature and integration | Document work, conversation-based tasks, supported local integrations | Does not automatically control repositories and shells in every installation environment
Claude Code | Available within the project scope | Available according to permission policies | Editing actual repositories, testing, refactoring, long-term projects | Requires review and security configuration because it handles shell and file permissions
Claude Code is not only for professional developers. However, because it can perform tasks that affect the system, such as deleting files, installing dependencies, and running build scripts, beginners in particular should use Plan mode together with version control.
Prerequisites
Prepare the following first.
· Check the currently supported operating systems and shell environments in the official documentation.
· Prepare an Anthropic account that can use Claude Code or a supported authentication and billing environment.
· For an existing project, create a Git repository and commit or back up your changes.
· Identify the project's test, build, and lint commands.
· You can use an editor such as VS Code, but VS Code itself is not a requirement for Claude Code.
On Windows, check the PowerShell, Command Prompt, or WSL requirements provided in the official documentation. If the computer is managed by an organization, first review installation permissions, proxy settings, firewall rules, and data-handling policies.
Installing and Launching Claude Code
1. Check the Official Installation Command
Select the latest installation method for your operating system from the official Claude Code setup documentation. Installation methods and commands may change, so use the official documentation as your source rather than reusing commands from outdated videos or blog posts.
2. Open the Project Folder
Create a new folder or navigate to an existing repository. If you use VS Code, open the folder with File > Open Folder, then select Terminal > New Terminal.
cd path/to/project
claude
When you run claude, a browser authentication process may appear if needed. After you log in, Claude Code examines the project based on the current working directory. Therefore, it is safer to run it from the actual repository root rather than your home directory or an overly broad parent folder.
3. Start Small with the First Request
Rather than asking it to build an entire application from the outset, divide the work into steps like these.
· Ask it to read and summarize the project structure.
· Ask it to present an implementation plan and the files to be changed.
· Ask it to implement only one feature.
· Ask it to run tests or static analysis.
· Ask it to explain the changes and remaining risks.
Example request:
Read this repository and summarize its structure and how to run it. Do not modify any files yet.
Only propose a plan for adding a login form and the files that would need to change.
Permission Modes and Safe Configuration
The wording shown for Claude Code's permission modes may vary by version and settings screen. The main mode concepts used in the official configuration are as follows.
Mode | Behavior | Recommended use
Default | Requests approval as needed when editing files or running potentially risky tools | General day-to-day work
Accept Edits | Automatically allows file edits, though separate approval may still apply to other tools | Development work where changed files are tracked with Git
Plan | Focuses on analysis and planning without editing files or running commands | Understanding repositories, reviewing designs, and a beginner's first step
Don't Ask | A non-interactive policy that rejects operations not approved in advance instead of asking about them | Automation environments or when using strict allowlists
Bypass Permissions | Bypasses permission checks | Avoid except in environments where risks are controlled, such as isolated containers
Shift+Tab may be used to switch between some permission states provided in the interactive interface. However, not all settings necessarily cycle using this shortcut alone, so check the status shown on the current screen and the official permission documentation.
Recommended Workflow for Beginners
· Receive an implementation plan in Plan mode.
· Review the files to be changed and the commands to be run.
· Implement in Default or Accept Edits mode.
· Manually review package installations, database changes, and deletion commands.
· Review git diff and test results before committing.
Bypass Permissions is not merely a convenient high-speed mode. It can amplify the harm caused by incorrect commands, excessive file access, or exposure of secrets, so do not use it as the default on a personal computer or in an important repository.
Model Selection and Cost Management
In an interactive session, you can use /model to view or change the models available for your account and environment. Model names, aliases, and availability may vary by time and authentication method, so it is better not to build automation around a fixed model list.
/model
General selection principles are as follows.
Task type | Selection criteria
Architecture design, difficult debugging, complex reasoning | Consider a higher-performance model first
General implementation, test writing, repetitive development | Consider a model with a good balance of performance and speed
Simple searches, format conversions, minor edits | If supported by your account, consider a faster and more economical model
Opus, Sonnet, and Haiku are names that distinguish model families, but the exact versions in each family and their availability in Claude Code may continue to change. Some environments may support aliases such as /model sonnet, but checking the options displayed in the current session is the most accurate approach.
Practical Ways to Reduce Costs
· Run it from the necessary subdirectory to reduce unnecessary file exploration.
· Specify the goal, constraints, and completion criteria in a single request to reduce rework.
· Provide the area around an error and the reproduction steps rather than an entire large log.
· Exclude unnecessary paths such as generated files, build outputs, and large datasets.
· Once exploration and design are complete, start a fresh session for the next unit of work.
· Handle simple tasks with a faster, less expensive model where available.
· If using the API, check cost-related commands together with usage information in the Anthropic Console.
The cost structure varies depending on the login method. Claude subscription accounts may have plan-specific usage limits, while usage through the Anthropic API or cloud providers may be billed by token. Therefore, do not assume that a particular model is always free or always costs a fixed amount.
Managing the Context Window
The context window is the range of conversations, file contents, tool results, project instructions, and other information that the model can reference when generating the current response. It is not the same as permanent memory or simply the character count of the conversation.
Main Commands
Command | Purpose | Caution
/context | Check the composition of context usage | The display format may vary by version
/compact | Summarize the current conversation to free up context space | Details may be condensed during summarization
/clear | Clear the current conversation history and start a new conversation | First record necessary decisions and work status in a document
There is no universal threshold at which response quality necessarily declines once context usage exceeds a certain percentage. Claude Code may perform automatic compaction, and quality is affected not only by the amount of information included, but also by its relevance, redundancy, and conflicts.
Consider cleaning up the context if you notice the following signs.
· It repeatedly misses requirements that have already been revised.
· It mistakes an outdated file state for the current state.
· It confuses requirements from different features.
· It rereads the same files unnecessarily.
· The conversation and tool output have become excessively long.
You do not need to run /clear every time you finish a feature. Instead, you can reduce information loss by recording completed decisions, unresolved items, and test results in project documentation or work logs before moving to a new session.
Managing Project Instructions with CLAUDE.md
The filename is generally written as CLAUDE.md, including uppercase letters. This file is not Claude's permanent memory, but a persistent instruction document that Claude Code references within the project. Including it in the repository lets you share instructions with team members, but sensitive information must not be recorded in it.
You can use the /init command to analyze the project and begin creating an initial CLAUDE.md, but the result must be reviewed by a person.
Recommended Content
· The project's purpose and core features
· Languages, frameworks, and runtime versions used
· The roles of important directories and modules
· Installation, development server, test, lint, and build commands
· Code style and naming conventions
· Files that must not be modified and generated code
· Security and personal data handling principles
· Completion criteria and verification procedures
Example:
# Project instructions
## Stack
- Use TypeScript and Node.js.
- The package manager is pnpm.
## Commands
- Tests: `pnpm test`
- Lint: `pnpm lint`
- Build: `pnpm build`
## Rules
- Do not read or commit `.env` or actual credentials.
- Present a plan before changing the response format of a public API.
- Add relevant tests for feature changes.
There is no official maximum limit of 200 lines for CLAUDE.md. However, overly long instructions can consume context and create conflicts between rules, so it is practical to keep them brief and specific. Separate detailed design explanations into other documents and provide the relevant paths.
Recommended Workflow
The following basic procedure improves both safety and output quality.
· Confirm that the Git status is clean and create a backup or commit.
· Run Claude Code from the repository root.
· Review CLAUDE.md and existing documentation.
· In Plan mode, obtain the goal, files to modify, and test plan.
· Divide large tasks into small, reviewable units.
· Implement one unit at a time in Default or Accept Edits mode.
· Manually review commands that install, delete, deploy, or modify data.
· Check tests, linting, type checks, and git diff.
· Document the completion status and remaining issues.
· If the next task is unrelated to the previous conversation, start a new session with /clear.
Security Checklist
· Prevent .env, API keys, certificates, and customer data from being exposed in prompts or repositories.
· Do not experiment directly on production servers or databases.
· Read shell commands or installation scripts from unknown sources before running them.
· Review dependencies, licenses, security vulnerabilities, and tests even for code written by Claude.
· Apply the principle of least privilege and use an isolated development environment for important work.
· Review automatically generated changes with Git diff, with a person retaining final responsibility.
Claude Code can significantly shorten the development process, but it is not an automatic safeguard that guarantees the accuracy and safety of results. The most reliable approach combines clear instructions, limited permissions, small units of change, automated tests, and human review.