Module 09는 Claude Code의 고급 기능들을 다룬다. Planning Mode, Permission Modes, Print Mode(-p), Session Management가 핵심이다. 이 기능들이 앞서 배운 CLAUDE.md + Hooks + MCP + Subagents와 합쳐지면 완전 자동화된 개발 워크플로우가 완성된다.
코드를 바로 짜기 전에 단계별 계획을 먼저 세우고 사람이 승인하는 방식이다.
# 방법 1: 슬래시 커맨드
/plan REST API for blog 만들어줘
# 방법 2: permission-mode 플래그
claude --permission-mode plan
Planning Mode 없이 바로 요청하면 Claude가 요구사항을 놓칠 수 있다. /plan을 쓰면 Phase별 단계 계획을 먼저 세우고 "진행할까요? (yes/no/modify)"를 물어본다. 수정사항이 있으면 입력해서 계획에 반영할 수 있다.
특히 아래 상황에서 반드시 사용한다:
Claude Code가 작업을 실행할 때 사용자 승인을 얼마나 요구하는지 조절한다.
| 모드 | 설명 | 사용 시점 |
|---|---|---|
default | 위험한 작업은 승인 요청 | 일반 개발 (기본값) |
acceptEdits | 파일 편집은 자동, 나머지는 질문 | 코드 작성 집중 시 |
plan | 읽기 전용 분석만, 수정 없음 | 안전한 코드베이스 분석 |
dontAsk | 위험한 것 빼고 전부 자동 | CI/CD 파이프라인 |
auto | 백그라운드 분류기가 자동 결정 | 팀 플랜 이상 |
bypassPermissions | 모든 작업 승인 없이 자동 실행 | 격리된 샌드박스만 |
bypassPermissions는 실수해도 복구 가능한 격리된 환경에서만 써야 한다. 실제 프로덕션, 중요한 코드베이스, 보안이 중요한 환경에서는 절대 사용하면 안 된다.
대화 없이 명령어 하나로 Claude를 실행하고 결과를 받는 방식이다. CI/CD 파이프라인 통합의 핵심이다.
# 기본 사용
claude -p "이 코드 리뷰해줘"
# 파일 내용을 파이프로 전달
cat error.log | claude -p "이 에러 설명해줘"
# JSON 형식으로 출력 (스크립트에서 파싱)
claude -p --output-format json "함수 목록 나열해줘"
# CI/CD에서 자동 실행
claude -p "PR 변경사항 리뷰해줘" --permission-mode dontAsk
CI/CD에 넣을 때 필요한 조합:
Print Mode(-p) + Permission Mode(dontAsk)
= 대화 없이 실행 + 승인 요청 없이 자동 처리
CI/CD란?
CI/CD = Continuous Integration / Continuous Deployment (지속적 통합/배포)
개발자가 GitHub에 코드 push
↓
자동으로 실행:
→ 테스트 실행
→ 빌드 확인
→ 코드 리뷰 (← 여기에 Claude 삽입 가능)
↓
전부 통과하면 자동 배포
Claude를 CI/CD에 넣는 예시:
# GitHub Actions에서
- name: Claude Code Review
run: claude -p "PR 변경사항 리뷰해줘" --permission-mode dontAsk
긴 작업을 여러 세션에 걸쳐 이어갈 수 있다.
# 세션에 이름 붙이기
/rename "feature-auth"
# 이전 세션 이어가기
claude -c # 가장 최근 세션
claude -r "feature-auth" # 이름으로 특정 세션 재개
# 대화 분기 (실험용)
/fork # 현재 세션 복사 후 새 방향 실험
지금까지 배운 모든 기능이 합쳐진 모습:
CLAUDE.md 팀 규칙 기억
+
Hooks 자동 포맷, 보안 게이트
+
MCP GitHub, DB 직접 접근
+
Subagents 전문 에이전트 병렬 작업
+
Planning Mode 실행 전 계획 검토 및 승인
+
Print Mode CI/CD 파이프라인 통합
=
완전 자동화된 개발 워크플로우
실제 예시:
/review-pr 입력 시:
1. CLAUDE.md에서 팀 코딩 표준 로드
2. GitHub MCP로 PR 내용 가져오기
3. code-reviewer Subagent에 코드 품질 리뷰 위임
4. secure-reviewer Subagent에 보안 검사 위임
5. Hooks로 결과 자동 저장
6. 종합 리뷰 제공
bypassPermissions는 샌드박스 환경에서만Module 09 covers Claude Code's advanced capabilities. The four key features are Planning Mode, Permission Modes, Print Mode (-p), and Session Management. When combined with CLAUDE.md + Hooks + MCP + Subagents learned earlier, these features form a fully automated development workflow.
Creates a step-by-step plan before writing any code, allowing the user to review and approve it.
# Method 1: Slash command
/plan Build a REST API for a blog
# Method 2: permission-mode flag
claude --permission-mode plan
Without Planning Mode, Claude may start coding immediately and miss requirements. With /plan, Claude creates a phased plan first and asks "Ready to proceed? (yes/no/modify)". You can provide modifications to refine the plan before execution.
Always use for:
Controls how much user approval Claude requests when executing tasks.
| Mode | Description | When to Use |
|---|---|---|
default | Asks approval for risky actions | Normal development (default) |
acceptEdits | Auto-accepts file edits, asks for rest | When focused on writing code |
plan | Read-only analysis, no modifications | Safe codebase analysis |
dontAsk | Auto-approves everything except dangerous | CI/CD pipelines |
auto | Background classifier decides | Team plan or above |
bypassPermissions | All actions proceed without approval | Isolated sandboxes only |
bypassPermissions must only be used in isolated environments where mistakes can be recovered. Never use it in production, important codebases, or security-sensitive environments.
Runs Claude with a single command without any conversation. Essential for CI/CD pipeline integration.
# Basic usage
claude -p "Review this code"
# Pipe file content
cat error.log | claude -p "Explain this error"
# JSON output (for script parsing)
claude -p --output-format json "List all functions"
# Automated CI/CD execution
claude -p "Review PR changes" --permission-mode dontAsk
The key combination for CI/CD:
Print Mode(-p) + Permission Mode(dontAsk)
= Runs without conversation + No approval prompts
CI/CD = Continuous Integration / Continuous Deployment
Developer pushes code to GitHub
↓
Automatically runs:
→ Tests
→ Build verification
→ Code review (← Claude can be inserted here)
↓
If all pass → automatic deployment
Example of inserting Claude into CI/CD:
# In GitHub Actions
- name: Claude Code Review
run: claude -p "Review PR changes" --permission-mode dontAsk
Long tasks can be resumed across multiple sessions.
# Name a session
/rename "feature-auth"
# Resume a previous session
claude -c # Most recent session
claude -r "feature-auth" # Resume by name
# Branch a session (for experimentation)
/fork # Copy current session, try a new direction
Everything learned so far, combined:
CLAUDE.md Team rules remembered
+
Hooks Auto-format, security gates
+
MCP Direct access to GitHub, DB
+
Subagents Parallel specialist agents
+
Planning Mode Review and approve plan before execution
+
Print Mode CI/CD pipeline integration
=
Fully automated development workflow
Real-world example:
When /review-pr is invoked:
1. Load team coding standards from CLAUDE.md
2. Fetch PR content via GitHub MCP
3. Delegate code quality review to code-reviewer Subagent
4. Delegate security check to secure-reviewer Subagent
5. Auto-save results via Hooks
6. Deliver comprehensive review
bypassPermissions only in sandbox environments