Trung cấpHướng dẫnClaude

Mastering Claude Code: Best Practices thực sự hiệu quả — Thinking hierarchy, Plan Mode, và .claude files

핵심 요약이 글의 주요 내용
  1. 1Directory-specific context CLAUDE.md mẫu hiệu quả Ví dụ từ Dinanjana về CLAUDE.md của anh: File CLAUDE.md không chỉ là configuration — đây là "brain implant" cho Claude về project của bạn. Global settings áp dụng cho mọi project your-project/CLAUDE.md :.
  2. 2Đây là cách các best practices kết hợp trong một feature development cycle: "Before we start, ask me about requirements" Plan Mode : Review architecture trước khi touch code Appropriate thinking level : "think hard" cho feature này CLAUDE.md check :.
  3. 3sau khi áp dụng consistent, implementations "shift from requiring extensive debugging to being remarkably close to production-ready." Không phải vì Claude thông minh hơn — mà vì process tốt hơn dẫn đến context tốt hơn, dẫn đến output tốt hơn.
  4. 4Rồi anh phát hiện ra điều gì đó quan trọng — chất lượng output không phụ thuộc vào "AI thông minh" mà phụ thuộc vào process của bạn . Dinanjana Gunaratne đã trải qua giai đoạn mà hầu hết developer trải qua khi mới dùng Claude Code:.
  5. 5Claude Code có 4 levels của "thinking" — mỗi level tăng computational resources và quality, nhưng cũng tăng token cost:.
Mastering Claude Code: Best Practices thực sự hiệu quả — Thinking hierarchy, Plan Mode, và .claude files

Best practices thực sự hiệu quả cho Claude Code: Thinking hierarchy từ "think" đến "ultrathink", Plan Mode trước execution, .claude files cho persistent context, và cách encourage Claude hỏi clarifying questions.

Từ vibe coding đến production-ready: Tư duy đúng

Dinanjana Gunaratne đã trải qua giai đoạn mà hầu hết developer trải qua khi mới dùng Claude Code: gõ prompts vague vào Claude, nhận code về, debug mãi vẫn không xong. Rồi anh phát hiện ra điều gì đó quan trọng — chất lượng output không phụ thuộc vào "AI thông minh" mà phụ thuộc vào process của bạn.

Bài viết này tổng hợp những best practices của Dinanjana đã chuyển đổi workflow của anh từ "spend hours debugging" sang "production-ready từ lần đầu".

Best Practice #1: Thinking Hierarchy — Match effort với problem

Claude Code có 4 levels của "thinking" — mỗi level tăng computational resources và quality, nhưng cũng tăng token cost:

Level Dùng khi nào Ví dụ
think Straightforward features, bug fixes đơn giản Add a new API endpoint
think hard Complex business logic, multi-file architecture Redesign authentication flow
think harder Performance optimization, security-sensitive code Optimize database queries
ultrathink Legacy integration, complex algorithms, stuck problems Migrate from monolith to microservices

"There's no point burning thinking tokens on a variable rename." — Dinanjana Gunaratne

Mistake phổ biến nhất: default về "ultrathink" cho mọi thứ. Đây là waste tokens và thời gian. Bắt đầu với "think" cho simple tasks, escalate lên khi cần thiết.

Best Practice #2: Plan Mode — Architect trước, code sau

Nhấn Shift+Tab hai lần để vào Plan Mode. Đây là mode Claude analyze codebase mà không modify bất kỳ file nào — hoạt động như architect thay vì coder.

Khi nào bắt buộc dùng Plan Mode?

  • Bắt đầu feature mới — "non-negotiable" theo Dinanjana
  • Complex multi-file refactoring
  • Debugging vấn đề không rõ nguyên nhân
  • Architectural decisions ảnh hưởng nhiều components

Workflow với Plan Mode

  1. Enter Plan Mode (Shift+Tab twice)
  2. Mô tả objective: "I want to add user authentication with JWT tokens"
  3. Review Claude's comprehensive plan — files sẽ touched, approach, potential risks
  4. Refine nếu cần: "Actually, use session-based auth instead"
  5. Exit Plan Mode và execute

Lợi ích: bạn review plan trước khi Claude bắt đầu thay đổi code. Tránh được rabbit holes và sai direction sau khi đã làm được 80%.

Best Practice #3: .claude Files — Project memory bank

File CLAUDE.md không chỉ là configuration — đây là "brain implant" cho Claude về project của bạn. Cấu trúc hierarchical:

  • ~/.claude/CLAUDE.md: Global settings áp dụng cho mọi project
  • your-project/CLAUDE.md: Project-level context
  • your-project/src/api/CLAUDE.md: Directory-specific context

CLAUDE.md mẫu hiệu quả

Ví dụ từ Dinanjana về CLAUDE.md của anh:

## Code Style
- TypeScript only (no JavaScript)
- Functional components with hooks
- 2-space indentation
- Prefer named exports

## Architecture
- State management: Zustand
- API calls: custom hooks in src/hooks/
- No business logic in components

## Hard Rules
- No class components
- Functions max 50 lines
- No files over 300 lines
- Tests required for all utilities

"The magic isn't in the format — it's in being specific about what matters for your project." — Dinanjana

Best Practice #4: Encourage Clarifying Questions

Đây là insight breakthrough lớn nhất của Dinanjana: explicitly prompt Claude để hỏi thay vì assume.

Thay vì:

"Build me an authentication system"

Dùng:

"Before starting the authentication system, ask me questions about requirements to ensure we're building exactly what's needed."

Claude sẽ hỏi: Social login hay email/password? Sessions hay JWT? Password reset flow như thế nào? Rate limiting? 2FA?

Kết quả: output chính xác ngay từ đầu thay vì làm lại 3 lần vì missed requirements.

Best Practice #5: External Memory Files

Context của Claude reset sau mỗi session — nhưng files của bạn không reset. Tận dụng điều này:

  • plan.md: Master plan với checkboxes — Claude và bạn cùng track progress
  • architecture.md: High-level system design — đọc lại khi cần context
  • todo.md: Current working checklist
  • decisions.md: Record architectural choices và lý do đằng sau chúng

Pattern hiệu quả: khi bắt đầu session mới, prompt: "Read plan.md and architecture.md, then we'll continue from where we left off."

Best Practice #6: Active Collaboration, không phải Autonomous Mode

Treat Claude như "fast junior developer" cần direction tốt — không phải autonomous system tự làm mọi thứ.

Practices cụ thể:

  • Review mọi plan trước execution — đừng just hit enter và đi pha cà phê
  • Course-correct sớm — dùng Escape key nếu Claude đang đi sai hướng
  • Break complex changes thành steps — mỗi step có thể verify độc lập
  • Challenge assumptions: "Are you sure this is the right approach? What alternatives did you consider?"

Combining practices: Workflow thực tế

Đây là cách các best practices kết hợp trong một feature development cycle:

  1. Clarifying questions first: "Before we start, ask me about requirements"
  2. Plan Mode: Review architecture trước khi touch code
  3. Appropriate thinking level: "think hard" cho feature này
  4. CLAUDE.md check: Claude đã load project conventions
  5. External memory: Update decisions.md sau khi chọn approach
  6. Active review: Không approve blindly — đọc và hiểu

Kết quả thực tế

Dinanjana báo cáo: sau khi áp dụng consistent, implementations "shift from requiring extensive debugging to being remarkably close to production-ready."

Không phải vì Claude thông minh hơn — mà vì process tốt hơn dẫn đến context tốt hơn, dẫn đến output tốt hơn.

Liên kết với broader Claude Code ecosystem

Những practices này bổ sung hoàn hảo với:

  • Agent Teams: CLAUDE.md tốt = agents làm việc với nhau hiệu quả hơn nhiều
  • MCP Servers: Plan Mode kết hợp với external data = better planning
  • CLAUDE.md nâng cao: Deep dive vào cấu trúc và patterns

Tổng kết

Core philosophy của Dinanjana: "The secret isn't in the prompts — it's in the process."

Plan first, think appropriately hard, collaborate actively, và teach Claude về project của bạn qua .claude files. Đây không phải hacks hay tricks — đây là fundamentals của working effectively với AI pair programmer.

Nguồn tham khảo

#Best Practices#Claude Code#CLAUDE.md#Plan Mode#Prompting

관련 글

코인 & VIP

코인으로 에피소드를 열거나 VIP로 모든 시리즈를 전부 감상하세요.

안전한 결제

계좌이체

QR
금액

유효 시간 30:00

  1. 은행 앱 열기
  2. QR을 스캔하거나 아래 정보로 송금
  3. 금액과 참조 번호를 그대로 유지
은행
계좌번호
예금주
금액
참조 번호

은행 앱으로 QR을 스캔하세요. 금액과 참조 번호가 자동 입력됩니다. 결제가 확인되면 코인 / VIP가 자동 지급됩니다.

결제를 기다리는 중…

어떤 작품을 좋아하세요?

좋아하는 장르를 고르면 홈에 “추천 작품”이 생겨요. 이 브라우저에 저장됩니다.

좋아하는 장르
표시
색상 테마

로그인

아직 계정이 없나요?

또는