Advanced Features

Eleven·2026년 4월 16일

Hello, Claude Code

목록 보기
8/11

요약

Module 09는 Claude Code의 고급 기능들을 다룬다. Planning Mode, Permission Modes, Print Mode(-p), Session Management가 핵심이다. 이 기능들이 앞서 배운 CLAUDE.md + Hooks + MCP + Subagents와 합쳐지면 완전 자동화된 개발 워크플로우가 완성된다.


개념 정리

1. Planning Mode — 실행 전 계획 검토

코드를 바로 짜기 전에 단계별 계획을 먼저 세우고 사람이 승인하는 방식이다.

# 방법 1: 슬래시 커맨드
/plan REST API for blog 만들어줘

# 방법 2: permission-mode 플래그
claude --permission-mode plan

Planning Mode 없이 바로 요청하면 Claude가 요구사항을 놓칠 수 있다. /plan을 쓰면 Phase별 단계 계획을 먼저 세우고 "진행할까요? (yes/no/modify)"를 물어본다. 수정사항이 있으면 입력해서 계획에 반영할 수 있다.

특히 아래 상황에서 반드시 사용한다:

  • DB 마이그레이션 (잘못되면 데이터 손실)
  • 대규모 리팩토링 (에러 위험 요소 사전 검토 필요)
  • 새로운 기능 설계 (요구사항 누락 방지)

2. Permission Modes — 자동화 수준 조절

Claude Code가 작업을 실행할 때 사용자 승인을 얼마나 요구하는지 조절한다.

모드설명사용 시점
default위험한 작업은 승인 요청일반 개발 (기본값)
acceptEdits파일 편집은 자동, 나머지는 질문코드 작성 집중 시
plan읽기 전용 분석만, 수정 없음안전한 코드베이스 분석
dontAsk위험한 것 빼고 전부 자동CI/CD 파이프라인
auto백그라운드 분류기가 자동 결정팀 플랜 이상
bypassPermissions모든 작업 승인 없이 자동 실행격리된 샌드박스만

bypassPermissions는 실수해도 복구 가능한 격리된 환경에서만 써야 한다. 실제 프로덕션, 중요한 코드베이스, 보안이 중요한 환경에서는 절대 사용하면 안 된다.


3. Print Mode (-p) — 비대화형 자동화

대화 없이 명령어 하나로 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

4. Session Management — 세션 이어가기

긴 작업을 여러 세션에 걸쳐 이어갈 수 있다.

# 세션에 이름 붙이기
/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. 종합 리뷰 제공

핵심 요약 (TL;DR)

  • Planning Mode: 실행 전 단계별 계획 검토, DB 마이그레이션/대규모 리팩토링에 필수
  • Permission Modes: 자동화 수준 조절, bypassPermissions는 샌드박스 환경에서만
  • Print Mode(-p): 비대화형 실행, CI/CD 파이프라인 통합의 핵심
  • CI/CD: 코드 push 시 자동으로 테스트/빌드/배포가 실행되는 파이프라인
  • Print Mode + dontAsk 조합 = CI/CD에서 Claude 자동 실행의 표준 패턴
  • 모든 기능 조합 = 완전 자동화된 개발 워크플로우

다음에 알아볼 것

  • Module 03: Skills — 자동 감지 기반 재사용 워크플로우
  • Module 07: Plugins — Skills + Hooks + Commands를 하나로 묶어 팀 배포
  • 실제 프로젝트에 CI/CD + Claude Code 통합 실습


Summary

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.


Key Concepts

1. Planning Mode — Review the Plan Before Executing

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:

  • DB migrations (data loss risk if wrong)
  • Large-scale refactoring (pre-check error risks)
  • New feature design (prevent requirement gaps)

2. Permission Modes — Control Automation Level

Controls how much user approval Claude requests when executing tasks.

ModeDescriptionWhen to Use
defaultAsks approval for risky actionsNormal development (default)
acceptEditsAuto-accepts file edits, asks for restWhen focused on writing code
planRead-only analysis, no modificationsSafe codebase analysis
dontAskAuto-approves everything except dangerousCI/CD pipelines
autoBackground classifier decidesTeam plan or above
bypassPermissionsAll actions proceed without approvalIsolated 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.


3. Print Mode (-p) — Non-Interactive Automation

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

What is CI/CD?

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

4. Session Management — Continue Across Sessions

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

Complete Combined Workflow

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

TL;DR

  • Planning Mode: Review step-by-step plan before execution — essential for migrations and refactoring
  • Permission Modes: Control automation level; bypassPermissions only in sandbox environments
  • Print Mode (-p): Non-interactive execution, the key to CI/CD integration
  • CI/CD: Pipeline that automatically runs tests/build/deploy on code push
  • Print Mode + dontAsk = standard pattern for running Claude in CI/CD
  • All features combined = fully automated development workflow

0개의 댓글