728x90
Claude Code는 Anthropic에서 제공하는 터미널 기반 AI 코딩 도구로, 개발자가 터미널에서 직접 Claude와 상호작용하며 코딩 작업을 수행할 수 있게 해주는 도구입니다.
운영 체제
- macOS: 10.15 이상
- Linux: Ubuntu 20.04+, Debian 10+
- Windows: WSL(Windows Subsystem for Linux) 필요
하드웨어 및 소프트웨어
- RAM: 최소 4GB
- Node.js: 18 버전 이상
- Git: 2.23+ (선택사항)
- GitHub/GitLab CLI: PR 워크플로우용 (선택사항)
- 인터넷 연결: 필수 (AI 처리용)
300x250
설치 과정
기본 설치
# 1. npm을 통한 전역 설치
npm install -g @anthropic-ai/claude-code
# 2. 프로젝트 디렉토리로 이동
cd /path/to/your/project
# 3. Claude Code 실행
claude
WSL에서 설치 (Windows 사용자)
# WSL 환경 설정
npm config set os linux
# 강제 설치 (OS 체크 무시)
npm install -g @anthropic-ai/claude-code --force --no-os-check
# Node.js가 Linux 버전인지 확인
which node # /usr/bin/node 여야 함
which npm # /usr/bin/npm 여야 함
인증 방법
옵션 1: Anthropic Console (기본)
claude
# 브라우저가 열리면 console.anthropic.com에서 OAuth 인증 완료
옵션 2: Claude App (Pro/Max 플랜)
claude
# Claude.ai 계정으로 로그인
# 구독 플랜에 맞는 옵션 선택
옵션 3: 엔터프라이즈 플랫폼
# Amazon Bedrock 설정
claude config set --global provider bedrock
claude config set --global bedrock.region us-east-1
claude config set --global bedrock.profile your-aws-profile
# Google Vertex AI 설정
claude config set --global provider vertex
claude config set --global vertex.project your-project-id
claude config set --global vertex.region us-central1
프로젝트 초기화
CLAUDE.md 생성 예시
# Claude Code 시작
claude
# 프로젝트 요약 요청
> summarize this project
# CLAUDE.md 파일 생성
> /init
# 생성된 파일 확인
> show me the generated CLAUDE.md file
# Git에 커밋
> commit the CLAUDE.md file with a descriptive message
CLAUDE.md 예시 내용
# Project: E-Commerce Platform
## Overview
This is a Next.js based e-commerce platform with TypeScript.
## Tech Stack
- Frontend: Next.js 14, React 18, TypeScript
- Styling: Tailwind CSS
- State Management: Zustand
- Database: PostgreSQL with Prisma ORM
- Authentication: NextAuth.js
## Project Structure
src/
├── app/ # Next.js app router
├── components/ # Reusable React components
├── lib/ # Utility functions and configurations
├── prisma/ # Database schema and migrations
└── types/ # TypeScript type definitions
## Key Features
- Product catalog with search and filtering
- Shopping cart functionality
- User authentication and profiles
- Order management system
- Admin dashboard
## Development Commands
- `npm run dev` - Start development server
- `npm run build` - Build for production
- `npm run test` - Run tests
- `npx prisma migrate dev` - Run database migrations
터미널 설정 최적화
줄 바꿈 설정 방법 1: 백슬래시 사용
> This is a long command that \
needs multiple lines \
to be readable
줄 바꿈 설정 방법 2: Option+Enter 설정 (Mac)
Terminal.app
# 설정 → 프로파일 → 키보드
# "Option을 Meta 키로 사용" 체크
iTerm2
# Claude Code 내에서 자동 설정
> /terminal-setup
# 또는 수동 설정
# 설정 → 프로파일 → 키
# 왼쪽/오른쪽 Option 키를 "Esc+"로 설정
알림 설정
# 터미널 벨 알림 활성화
claude config set --global preferredNotifChannel terminal_bell
# macOS 시스템 알림 권한 확인
# 시스템 설정 → 알림 → Terminal/iTerm2 → 알림 허용
실제 사용 예시
예시 1: React 컴포넌트 생성
> create a React component for a product card with TypeScript. \
It should display product image, name, price, and an add to cart button. \
Use Tailwind CSS for styling.
# Claude가 생성한 코드 확인
> show me the ProductCard component
# 파일로 저장
> save this as src/components/ProductCard.tsx
# 테스트 파일도 생성
> create unit tests for this component using Jest and React Testing Library
예시 2: 데이터베이스 스키마 작업
> analyze the current Prisma schema and suggest improvements
# 새 모델 추가
> add a Review model to the schema with fields for rating, \
comment, userId, and productId with proper relations
# 마이그레이션 생성
> create and run a migration for the new Review model
예시 3: 버그 수정
> there`s a bug in the checkout process where the total price \
is not updating correctly when quantities change. help me fix it.
# Claude가 관련 파일들을 분석
> check the CartContext and CheckoutPage components
# 수정사항 적용
> apply the fix and show me the diff
# 테스트 실행
> run the tests to ensure nothing is broken
Vim 모드 사용
Vim 모드 활성화
# Vim 모드 활성화
> /vim
# 또는 설정을 통해 영구 활성화
> /config
# Vim mode 옵션 선택
지원되는 Vim 명령어
# 모드 전환
Esc # Normal 모드로
i, I # Insert 모드로 (커서 위치/줄 시작)
a, A # Insert 모드로 (커서 다음/줄 끝)
o, O # 새 줄 삽입 (아래/위)
# 이동
h, j, k, l # 좌, 하, 상, 우
w, e, b # 단어 단위 이동
0, $, ^ # 줄 시작, 끝, 첫 글자
gg, G # 문서 시작, 끝
# 편집
x # 한 글자 삭제
dw, dd # 단어, 줄 삭제
cw, cc # 단어, 줄 변경
. # 마지막 명령 반복
고급 설정
전역 설정 관리
# 모든 설정 보기
claude config list --global
# 특정 설정 변경
claude config set --global editor vscode
claude config set --global theme dark
claude config set --global autoSave true
# 설정 초기화
claude config reset --global
대용량 입력 처리
# 잘못된 방법 (긴 코드 직접 붙여넣기)
> [매우 긴 코드 붙여넣기] # 잘릴 수 있음
# 올바른 방법 (파일 사용)
# 1. 먼저 파일에 저장
echo "긴 코드 내용" > large_code.js
# 2. Claude에게 파일 읽도록 요청
> analyze the code in large_code.js and suggest improvements
문제 해결
WSL 관련 문제
# Node.js 경로 문제 해결
# Windows Node가 아닌 Linux Node 사용 확인
sudo apt update
sudo apt install nodejs npm
# 또는 nvm 사용
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 18
nvm use 18
인증 문제
# 인증 토큰 초기화
claude logout
claude login
# 캐시 정리
rm -rf ~/.claude/cache
베스트 프랙티스
1. 프로젝트별 CLAUDE.md 유지
# 프로젝트 시작 시 항상 초기화
> /init
# 주요 변경사항 발생 시 업데이트
> update the CLAUDE.md with the new authentication system we just added
2. 명확한 컨텍스트 제공
# 좋은 예
> in the UserProfile component, add a feature to upload avatar images \
using the existing S3 integration in lib/storage.ts
# 나쁜 예
> add image upload
3. 단계별 작업 수행
# 복잡한 작업을 단계로 나누기
> 1. first, analyze the current authentication flow
> 2. then, identify security vulnerabilities
> 3. finally, implement the fixes with proper error handling
Claude Code의 모든 주요 기능과 설정을 숙지하고, 실제 개발 환경에서 효과적으로 사용할 수 있는 예시를 활용해보세요.
728x90
그리드형(광고전용)
댓글