v0.2.29 & SDK 기준 종합 가이드

CLI Commands

claude
Main

Claude Code 대화형 세션을 시작합니다.

claude
claude agents
Agents

구성된 에이전트 목록을 표시합니다.

claude agents
claude auth
Auth

인증을 관리합니다 (login, logout, status).

claude doctor
System

설정 및 환경 상태를 점검합니다.

claude mcp
MCP

MCP 서버를 구성하고 관리합니다.

claude update
System

최신 버전으로 업데이트합니다.

CLI Flags

-p, --prompt
Flag

비대화형 모드로 명령을 실행합니다.

claude -p "Explain this code"
-c, --continue
Flag

최근 대화를 이어서 시작합니다.

-w, --worktree
Flag

새 git worktree를 생성하여 작업합니다.

--tools
Flag

사용할 도구 목록을 지정합니다 (Bash, Edit, Read 등).

Session & Context Control

/compact
Slash

대화 이력을 요약하여 컨텍스트 토큰을 절약합니다.

/compact [instructions]
/clear
Slash

대화 기록을 지우고 세션을 초기화합니다.

/rewind
Slash

이전 상태로 코드와 대화를 되돌립니다.

/add-dir
Slash

추가 디렉토리의 내용을 컨텍스트에 포함합니다.

Custom Slash Commands

Custom Command 위치
Config

마크다운(.md) 파일을 통해 자신만의 명령어를 정의할 수 있습니다.

Storage Paths - 프로젝트: .claude/commands/*.md
- 글로벌: ~/.claude/commands/*.md
인수와 플레이스홀더
Feature

`$1`, `$2` 또는 `$ARGUMENTS`를 사용하여 동적 인수를 전달합니다.

Example (.claude/commands/fix.md) ---
argument-hint: [issue-id]
---
Fix the bug reported in issue #$1.
Bash 명령어 실행
Feature

!`cmd` 문법을 사용하여 실행 결과를 컨텍스트에 포함합니다.

Example Review the current status:
!`git status`
파일 참조 (@)
Feature

@파일명 문법을 사용하여 특정 파일의 내용을 명령어에 포함합니다.

Example Review this config:
@package.json

Claude Agent SDK Integration

SDK 명령어 전송
SDK

프로그램 코드 내에서 슬래시 명령어를 직접 실행할 수 있습니다.

import { query } from "@anthropic-ai/claude-agent-sdk";
await query({ prompt: "/compact" });
사용 가능 명령어 확인
SDK

세션 초기화(`init`) 메시지에서 사용 가능한 명령어 목록을 받아올 수 있습니다.

if (msg.subtype === "init") {
console.log(msg.slash_commands);
}

Configuration Files

CLAUDE.md
Rule

프로젝트별 코딩 규칙, 빌드 명령어, 아키텍처 가이드를 정의합니다.

.claude.json
Settings

테마, 권한 등 로컬 세션 설정을 저장합니다.