콘텐츠로 이동

Install Claude Code globally using npm

Claude Code CLI 치트시트

개요

Claude Code는 Anthropic의 에이전트형 코딩 어시스턴트로, 터미널에서 작동합니다. 전체 코드베이스를 이해하고, 자연어 설명에서 기능을 구축하며, 버그를 수정하고, 지루한 개발 작업을 자동화할 수 있습니다. 이 치트시트는 명령줄 인터페이스(CLI) 사용에 중점을 둡니다.

설치

# Install Claude Code globally using npm
npm install -g @anthropic-ai/claude-code

시작하기

# Navigate to your project directory
cd your-project

# Start an interactive session with Claude Code
claude

핵심 명령

# Ask a question about your codebase
claude "How does the authentication middleware work?"

# Build a new feature
claude -p "Create a new API endpoint for user profiles"

# Fix a bug from an error message
claude -p "Fix this error: 'TypeError: Cannot read property 'id' of undefined'"

# Run a command and pipe the output to Claude
tail -f server.log | claude -p "Alert me if you see any critical errors"

주요 기능

  • 코드베이스 인식: 전체 프로젝트 구조를 이해합니다.
  • 에이전트 기능: 파일을 읽고, 명령을 실행하고, 커밋을 생성할 수 있습니다.
  • 자연어 인터페이스: 일반 영어로 코드베이스와 상호작용합니다.
  • 터미널 통합: 기존 터미널 워크플로우와 완벽하게 연동됩니다.
  • MCP 통합: Google Drive, Figma, Jira와 같은 외부 도구에 연결됩니다.

일반적인 워크플로우

  • 기능 개발: 기능을 설명하면 Claude Code가 계획하고 구현합니다.
  • 디버깅: 오류 메시지를 붙여넣으면 Claude가 근본 원인을 찾아 수정합니다.
  • 코드 리팩토링: 파일이나 함수를 더 읽기 쉽게 리팩토링하도록 요청합니다.
  • 문서화: 코드베이스의 특정 부분에 대한 문서를 생성합니다.
  • CI/CD 자동화: 린팅, 테스트, 릴리즈 노트 등의 작업을 자동화합니다.

고급 사용법

# Use a specific model for a task
claude --model claude-3-opus -p "Analyze the performance of this function"

# Set a custom prompt for a session
claude --prompt "You are a senior security engineer. Review this code for vulnerabilities."

# Integrate with other tools
claude -p "Read the design doc from Google Drive and implement the new UI"

추가 리소스