Claude Code: Complete Guide to Anthropic's AI Coding CLI (2026)
Everything you need to know about Claude Code: setup, features, tips, and workflows
Hypereal로 구축 시작하기
단일 API를 통해 Kling, Flux, Sora, Veo 등에 액세스하세요. 무료 크레딧으로 시작하고 수백만으로 확장하세요.
신용카드 불필요 • 10만 명 이상의 개발자 • 엔터프라이즈 지원
Claude Code: Complete Guide to Anthropic's AI Coding CLI (2026)
Claude Code is Anthropic's official command-line interface for AI-assisted software development. Unlike browser-based AI chat tools, Claude Code operates directly in your terminal, reading and writing files, running commands, and navigating your codebase with full context awareness.
This guide covers everything from installation to advanced workflows, making it the definitive resource for getting the most out of Claude Code in 2026.
What Is Claude Code?
Claude Code is a CLI tool that gives Claude direct access to your development environment. When you run it in a project directory, it can:
- Read and understand your entire codebase
- Edit files across multiple directories
- Run shell commands (builds, tests, git operations)
- Search code and navigate file structures
- Create commits and pull requests
- Debug errors by reading logs and stack traces
It is different from AI coding tools like GitHub Copilot or Cursor in that it operates entirely in the terminal as an agent, taking multi-step actions to complete tasks rather than just providing inline suggestions.
Installation and Setup
Requirements
| Requirement | Minimum |
|---|---|
| Node.js | 18+ |
| Operating System | macOS, Linux, or Windows (via WSL) |
| Anthropic API key | Or Claude Pro/Max subscription |
Install
npm install -g @anthropic-ai/claude-code
Verify Installation
claude --version
Authentication
On first launch, Claude Code will prompt you to authenticate. You have two options:
Option 1: Anthropic API Key
export ANTHROPIC_API_KEY="sk-ant-your-key-here"
claude
Option 2: Claude Pro/Max Subscription
Launch Claude Code and follow the browser-based OAuth flow:
claude
# Follow the authentication prompts
Claude Pro subscribers get limited Claude Code usage. Claude Max ($100/month or $200/month) subscribers get significantly higher limits.
Subscription Comparison
| Plan | Claude Code Access | Monthly Limit |
|---|---|---|
| Free | No | N/A |
| Pro ($20/month) | Limited | Low usage cap |
| Max ($100/month) | Yes | High usage cap |
| Max ($200/month) | Yes | Very high usage cap |
| API (pay-per-use) | Yes | Based on spending |
| Team/Enterprise | Yes | Based on plan |
Basic Usage
Interactive Mode
Launch Claude Code in your project directory:
cd your-project
claude
You enter an interactive session where you can type natural language instructions. Claude Code reads your project structure and responds with understanding of your codebase.
One-Shot Mode
Send a single prompt without entering interactive mode:
claude "explain what this project does"
Print Mode
Get a response without any interactive session or tool use:
claude -p "what does the main function in src/index.ts do?"
Pipe Input
Feed content into Claude Code via stdin:
cat error.log | claude "explain this error and suggest a fix"
git diff | claude "review these changes"
npm test 2>&1 | claude "fix the failing tests"
Resume a Conversation
# Resume the most recent conversation
claude --resume
# Continue the last conversation
claude --continue
Key CLI Flags
| Flag | Short | Description |
|---|---|---|
--version |
-v |
Print version |
--help |
-h |
Show help |
--resume |
-r |
Resume most recent conversation |
--continue |
-c |
Continue last conversation |
--print |
-p |
Print mode (no interactive session) |
--model |
-m |
Specify model (e.g., claude-sonnet-4-20250514) |
--max-turns |
Limit agentic turns | |
--system-prompt |
Custom system prompt | |
--allowedTools |
Restrict available tools | |
--output-format |
Output format: text, json, stream-json |
|
--dangerously-skip-permissions |
Auto-approve all tool use |
Slash Commands
Inside an interactive session, use slash commands for quick actions:
| Command | Description |
|---|---|
/help |
Show available commands |
/compact |
Compress conversation to save context |
/clear |
Clear conversation history |
/cost |
Show token usage and estimated cost |
/model |
Switch the model mid-conversation |
/permissions |
View and manage tool permissions |
/config |
View current configuration |
/bug |
Report a bug to Anthropic |
/quit |
Exit Claude Code |
Configuration
Project-Level Configuration
Create a CLAUDE.md file in your project root to give Claude Code persistent context:
# CLAUDE.md
## Project Overview
This is a Next.js 15 application using the App Router, TypeScript, and Tailwind CSS.
## Tech Stack
- Next.js 15 (App Router)
- TypeScript (strict mode)
- Tailwind CSS + shadcn/ui
- Prisma ORM with PostgreSQL
- NextAuth.js for authentication
## Conventions
- Use server components by default
- Place API routes in app/api/
- Use Zod for all input validation
- Write tests with Vitest
## Important Notes
- Never modify the database schema without creating a migration
- Always run `npm run typecheck` before committing
- The env variables are in .env.local (do not read or modify this file)
Claude Code reads this file automatically at the start of every conversation.
Settings File
Create .claude/settings.json for tool permissions and behavior:
{
"allowedTools": [
"Read",
"Write",
"Glob",
"Grep",
"Bash(npm run *)",
"Bash(npx *)",
"Bash(git *)"
],
"ignorePatterns": [
"node_modules",
"dist",
".next"
]
}
User-Level Configuration
For settings that apply across all projects, create ~/.claude/settings.json or ~/.claude.md.
Common Workflows
1. Implement a Feature
Add a rate limiting middleware to the API. Use Redis for the token bucket.
It should limit to 100 requests per minute per API key.
Add tests.
Claude Code will read your existing middleware, understand the project structure, create the implementation, and write tests.
2. Fix a Bug
# Pipe the error directly
npm test 2>&1 | claude "fix these failing tests"
Or describe the bug:
Users are reporting that the password reset email is not being sent.
Debug the issue and fix it.
3. Code Review
git diff main...feature-branch | claude "review this code for bugs, security issues, and style problems"
4. Refactoring
Refactor the user service to use the repository pattern.
Move database queries out of the route handlers and into a UserRepository class.
Update all imports and tests.
5. Documentation
Add JSDoc comments to all exported functions in the src/utils/ directory.
6. Git Operations
Create a new branch called feature/rate-limiting, commit the current changes
with a descriptive message, and push to origin.
7. Debugging with Logs
cat server.log | claude "find the root cause of the 500 errors happening after 3pm"
Advanced Usage
Custom System Prompts
Override the default behavior for specific tasks:
claude --system-prompt "You are a security auditor. Review all code for vulnerabilities." \
"audit the authentication module"
Scripting and Automation
Use Claude Code in CI/CD pipelines or scripts:
# Generate a changelog from recent commits
git log --oneline v1.0..HEAD | claude -p --output-format json \
"Generate a changelog grouped by category (features, fixes, other)"
# Auto-fix lint errors
npx eslint src/ --format json 2>&1 | claude "fix all these lint errors"
Multi-Model Workflows
Switch models for different tasks:
# Use a faster model for simple tasks
claude -m claude-haiku-4-20250514 "rename the variable 'x' to 'userCount' in src/stats.ts"
# Use the most capable model for complex tasks
claude -m claude-opus-4-20250514 "redesign the database schema to support multi-tenancy"
Limit Tool Access
For sensitive operations, restrict what Claude Code can do:
# Read-only mode
claude --allowedTools "Read,Glob,Grep" "explain the authentication flow"
# No bash access
claude --allowedTools "Read,Write,Glob,Grep" "refactor the utils"
Tips for Better Results
| Tip | Example |
|---|---|
| Be specific about files | "Edit src/auth/login.ts" not "fix the login" |
| Give context on what you tried | "I tried X but got error Y" |
| Break large tasks into steps | One feature per conversation |
Use /compact for long sessions |
Prevents context window issues |
| Include error messages | Paste the full stack trace |
| Specify the "why" | "Add caching to reduce API calls" not just "add caching" |
| Use CLAUDE.md for project context | Saves repeating setup every time |
Cost Management
Monitoring Usage
/cost
This shows tokens used and estimated cost for the current session.
Reducing Costs
- Use
/compactregularly to compress long conversations. - Use print mode (
-p) for quick questions that do not need tool use. - Limit tools when you only need code reading, not editing.
- Use Haiku for simple tasks like renaming or formatting.
- Break tasks into focused sessions instead of one long conversation.
Troubleshooting
| Issue | Solution |
|---|---|
| "API key not found" | Set ANTHROPIC_API_KEY environment variable |
| Slow responses | Check internet connection; try /compact |
| Context window errors | Start a new conversation |
| Permission denied | Check .claude/settings.json allowedTools |
| Claude Code stuck in a loop | Press Escape, then give clearer instructions |
| "Rate limit exceeded" | Wait a few minutes or upgrade your plan |
| Cannot read certain files | Check .gitignore and ignorePatterns |
Wrapping Up
Claude Code is the most capable AI coding assistant available in the terminal. It works best when you give it clear instructions, maintain project context through CLAUDE.md, and break complex tasks into focused sessions. Whether you are building new features, debugging production issues, or refactoring legacy code, Claude Code can handle the heavy lifting while you stay in control.
If you are building applications that involve AI-generated media, such as images, videos, or audio, Hypereal AI provides developer-friendly APIs that work seamlessly alongside tools like Claude Code. Generate images, create videos, and more through simple API calls.
