CLI Commands
claude
MainClaude Code 대화형 세션을 시작합니다.
claudeclaude agents
Agents구성된 에이전트 목록을 표시합니다.
claude agentsclaude auth
Auth인증을 관리합니다 (login, logout, status).
claude doctor
System설정 및 환경 상태를 점검합니다.
claude mcp
MCPMCP 서버를 구성하고 관리합니다.
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테마, 권한 등 로컬 세션 설정을 저장합니다.