เริ่มต้นใช้งาน
ยินดีต้อนรับสู่ Claude Code!
คู่มือเริ่มต้นนี้จะช่วยให้คุณใช้งาน AI-powered coding assistance ได้ภายในไม่กี่นาที เมื่อจบแล้ว คุณจะเข้าใจวิธีใช้ Claude Code สำหรับงาน development ทั่วไป
ก่อนเริ่มต้น
ตรวจสอบว่าคุณมี:
- terminal หรือ command prompt ที่เปิดอยู่
- โปรเจกต์โค้ดที่จะใช้งาน
- สมาชิก Claude (Pro, Max, Team หรือ Enterprise), บัญชี Claude Console หรือสิทธิ์เข้าถึงผ่าน supported cloud provider
คู่มือนี้ครอบคลุม terminal CLI Claude Code ยังมีให้ใช้งานบน web, desktop app, ใน VS Code และ JetBrains IDEs, ใน Slack และใน CI/CD ด้วย GitHub Actions และ GitLab
ขั้นตอนที่ 1: ติดตั้ง Claude Code
ติดตั้ง Claude Code ด้วยวิธีใดวิธีหนึ่งต่อไปนี้:
macOS, Linux, WSL:
curl -fsSL https://claude.ai/install.sh | bash
Windows PowerShell:
irm https://claude.ai/install.ps1 | iex
Windows CMD:
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
คุณยังสามารถติดตั้งด้วย apt, dnf หรือ apk บน Debian, Fedora, RHEL และ Alpine ได้ด้วย
ขั้นตอนที่ 2: Login เข้าบัญชีของคุณ
Claude Code ต้องการบัญชีในการใช้งาน เริ่ม interactive session ด้วยคำสั่ง claude และคุณจะถูกให้ login ในการใช้งานครั้งแรก:
claude
สำหรับบัญชี Claude subscription หรือ Console ให้ทำตามขั้นตอนเพื่อยืนยันตัวตนในเบราว์เซอร์ เพื่อเปลี่ยนบัญชีในภายหลังหรือยืนยันตัวตนใหม่ พิมพ์ /login ใน session ที่รันอยู่:
/login
คุณสามารถ login ด้วยบัญชีประเภทใดก็ได้เหล่านี้:
- Claude Pro, Max, Team หรือ Enterprise (แนะนำ)
- Claude Console (API access พร้อม pre-paid credits)
- Amazon Bedrock, Google Vertex AI หรือ Microsoft Foundry (enterprise cloud providers)
ขั้นตอนที่ 3: เริ่ม session แรกของคุณ
เปิด terminal ในโฟลเดอร์โปรเจกต์ใดก็ได้และเริ่ม Claude Code:
cd /path/to/your/project
claude
คุณจะเห็น Claude Code prompt พิมพ์ /help เพื่อดูคำสั่งที่ใช้ได้ หรือ /resume เพื่อต่อการสนทนาก่อนหน้า
ขั้นตอนที่ 4: ถามคำถามแรกของคุณ
เริ่มต้นด้วยการทำความเข้าใจ codebase ของคุณ ลองใช้คำสั่งเหล่านี้:
what does this project do?
Claude จะวิเคราะห์ไฟล์ของคุณและให้สรุป คุณยังถามคำถามเฉพาะเจาะจงได้:
what technologies does this project use?
where is the main entry point?
explain the folder structure
คุณยังถาม Claude เกี่ยวกับความสามารถของมันได้:
what can Claude Code do?
how do I create custom skills in Claude Code?
ขั้นตอนที่ 5: แก้ไขโค้ดครั้งแรก
ลองให้ Claude Code เขียนโค้ดจริงๆ:
add a hello world function to the main file
Claude Code จะ:
- หาไฟล์ที่เหมาะสม
- แสดงการเปลี่ยนแปลงที่เสนอ
- ขอการอนุมัติจากคุณ
- แก้ไข
Claude Code จะขอ permission ก่อนแก้ไขไฟล์เสมอ คุณสามารถอนุมัติการเปลี่ยนแปลงแต่ละครั้งหรือเปิด "Accept all" mode สำหรับ session นั้น
ขั้นตอนที่ 6: ใช้ Git กับ Claude Code
Claude Code ทำให้ Git operations เป็นการสนทนา:
what files have I changed?
commit my changes with a descriptive message
คุณยังสั่งงาน Git ที่ซับซ้อนกว่าได้:
create a new branch called feature/quickstart
show me the last 5 commits
help me resolve merge conflicts
ขั้นตอนที่ 7: แก้บั๊กหรือเพิ่มฟีเจอร์
Claude เชี่ยวชาญในการ debug และการ implement ฟีเจอร์ อธิบายสิ่งที่คุณต้องการด้วยภาษาธรรมดา:
add input validation to the user registration form
หรือแก้ปัญหาที่มีอยู่:
there's a bug where users can submit empty forms - fix it
Claude Code จะ:
- ค้นหาโค้ดที่เกี่ยวข้อง
- เข้าใจ context
- Implement วิธีแก้ไข
- รัน tests ถ้ามี
ขั้นตอนที่ 8: ทดลอง workflow อื่นๆ
Refactor โค้ด
refactor the authentication module to use async/await instead of callbacks
เขียน tests
write unit tests for the calculator functions
อัปเดต documentation
update the README with installation instructions
Code review
review my changes and suggest improvements
คำสั่งที่จำเป็น
Shell commands (รันจาก terminal ของคุณ)
| คำสั่ง | สิ่งที่ทำ | ตัวอย่าง |
|---|---|---|
claude | เริ่ม interactive mode | claude |
claude "task" | รัน task แบบครั้งเดียว | claude "fix the build error" |
claude -p "query" | รัน query แบบครั้งเดียวแล้วออก | claude -p "explain this function" |
claude -c | ต่อการสนทนาล่าสุดใน directory ปัจจุบัน | claude -c |
claude -r | Resume การสนทนาก่อนหน้า | claude -r |
Session commands (รันใน Claude Code หลังเริ่ม)
| คำสั่ง | สิ่งที่ทำ | ตัวอย่าง |
|---|---|---|
/clear | ล้าง conversation history | /clear |
/help | แสดงคำสั่งที่ใช้ได้ | /help |
/exit หรือ Ctrl+D | ออกจาก Claude Code | /exit |
ดู CLI reference สำหรับรายการคำสั่ง shell ทั้งหมด และ commands reference สำหรับรายการ session commands ทั้งหมด
เคล็ดลับสำหรับผู้เริ่มต้น
ให้ข้อมูลเฉพาะเจาะจงในคำขอของคุณ
แทนที่จะ: "fix the bug"
ลอง: "fix the login bug where users see a blank screen after entering wrong credentials"
ใช้คำสั่งแบบทีละขั้นตอน
แบ่งงานที่ซับซ้อนออกเป็นขั้นตอน:
1. create a new database table for user profiles
2. create an API endpoint to get and update user profiles
3. build a webpage that allows users to see and edit their information
ให้ Claude สำรวจก่อน
ก่อนทำการเปลี่ยนแปลง ให้ Claude เข้าใจโค้ดของคุณ:
analyze the database schema
build a dashboard showing products that are most frequently returned by our UK customers
ประหยัดเวลาด้วยทางลัด
- พิมพ์
/เพื่อดูคำสั่งและ skills ทั้งหมด - ใช้ Tab สำหรับ command completion
- กด ↑ สำหรับ command history
- กด
Shift+Tabเพื่อวน permission modes
ต่อไปคืออะไร?
ตอนนี้คุณได้เรียนรู้พื้นฐานแล้ว สำรวจฟีเจอร์ขั้นสูงเพิ่มเติม:
- วิธีการทำงานของ Claude Code: เข้าใจ agentic loop, built-in tools และวิธีที่ Claude Code โต้ตอบกับโปรเจกต์
- Best practices: ได้ผลลัพธ์ที่ดีขึ้นด้วย effective prompting และการตั้งค่าโปรเจกต์
- Common workflows: คู่มือทีละขั้นตอนสำหรับงานทั่วไป
- Extend Claude Code: ปรับแต่งด้วย CLAUDE.md, skills, hooks, MCP และอื่นๆ
ขอความช่วยเหลือ
- ใน Claude Code: พิมพ์
/helpหรือถามว่า "how do I..." - เอกสาร: คุณอยู่ที่นี่แล้ว เรียกดู guides อื่นๆ
- ชุมชน: เข้าร่วม Discord สำหรับเคล็ดลับและการสนับสนุน