Week 2 of 12 🔧

Core Tools: Read, Write & Edit

เครื่องมือหลัก: Read, Write และ Edit

Core Tools: Read, Write & Edit

1. Introduction / บทนำ

Claude Code มาพร้อมกับเครื่องมือในตัวที่ทรงพลังสำหรับการทำงานกับไฟล์ เครื่องมือสำคัญที่สุดสามตัวคือ Read (ดูเนื้อหาไฟล์), Write (สร้างไฟล์ใหม่) และ Edit (แก้ไขไฟล์ที่มีอยู่) เครื่องมือเหล่านี้ให้ Claude เข้าใจและเปลี่ยนแปลงโค้ดของคุณ
Claude Code comes with powerful built-in tools for working with files. The three most important are Read (view file contents), Write (create new files), and Edit (modify existing files). These tools let Claude understand and change your code.

Fun Facts / ข้อเท็จจริงที่น่าสนใจ

  • The Read tool can view images and PDFs too!
  • Edit only sends the changed part, not the whole file.
  • Write will ask for permission before creating files.

2. Vocabulary / คำศัพท์

Click a card to flip it. คลิกการ์ดเพื่อพลิก

read
อ่าน
To view the contents of a file
write
เขียน
To create a new file with content
edit
แก้ไข
To change part of an existing file
file
ไฟล์
A document stored on a computer
path
พาธ / เส้นทาง
The location of a file in a directory
content
เนื้อหา
The text or data inside a file
line
บรรทัด
A single row of text in a file
replace
แทนที่
To put new text in place of old text
create
สร้าง
To make something new
overwrite
เขียนทับ
To replace a file completely
permission
สิทธิ์
Authorization to perform an action
tool
เครื่องมือ
A feature used to perform a task

3. Grammar Focus / ไวยากรณ์

Present Simple for Descriptions (It reads... It writes...) / Present Simple สำหรับการอธิบาย (It reads... It writes...)

Thai:
Present Simple อธิบายสิ่งที่เกิดขึ้นเป็นประจำหรือถาวร สำหรับบุรุษที่สาม (he/she/it) เติม -s หรือ -es ตัวอย่าง: 'It reads the file.' 'The tool writes new content.'
English:
Present Simple describes what something does regularly or permanently. For third person (he/she/it), add -s or -es. Example: 'It reads the file.' 'The tool writes new content.'
เครื่องมือ Read แสดงเนื้อหาไฟล์
The Read tool displays file contents.
Claude เขียนโค้ดลงในไฟล์ใหม่
Claude writes the code to a new file.
เครื่องมือ Edit แทนที่ข้อความเก่าด้วยข้อความใหม่
The Edit tool replaces old text with new text.

Section Check 1

Which tool creates a new file?

เครื่องมือใดสร้างไฟล์ใหม่?

Section Check 2

What does 'It reads the file' use?

'It reads the file' ใช้ tense อะไร?

Section Check 3

Which tool needs permission?

เครื่องมือใดต้องการสิทธิ์?

4. Tutorial Steps / ขั้นตอนการเรียนรู้

1
Ask Claude to read a file / ขอให้ Claude อ่านไฟล์
Say: 'Read the file at src/index.js' — Claude uses the Read tool to show you the contents.
2
Ask Claude to create a file / ขอให้ Claude สร้างไฟล์
Say: 'Create a file called hello.py with a print statement' — Claude uses Write.
3
Ask Claude to edit a file / ขอให้ Claude แก้ไขไฟล์
Say: 'Change the function name from foo to bar in utils.js' — Claude uses Edit to make the change.
4
Check permissions / ตรวจสอบสิทธิ์
Read is automatic. Write and Edit require your approval before making changes.
5
Review changes / ตรวจสอบการเปลี่ยนแปลง
Claude shows you what will change. Type 'y' to approve or 'n' to reject.

5. Hands-On Activity / กิจกรรมลงมือทำ

แบบฝึกหัด: ขอให้ Claude สร้างไฟล์ชื่อ 'greeting.txt' พร้อมข้อความทักทาย จากนั้นขอให้แก้ไขไฟล์เพื่อเพิ่มบรรทัดที่สอง
Practice: Ask Claude to create a file called 'greeting.txt' with a hello message. Then ask it to edit the file to add a second line.

6. Reference Table / ตารางอ้างอิง

Command / ToolEnglishภาษาไทย
ReadView file contents (up to 2000 lines)ดูเนื้อหาไฟล์ (สูงสุด 2000 บรรทัด)
WriteCreate or overwrite a fileสร้างหรือเขียนทับไฟล์
EditReplace specific text in a fileแทนที่ข้อความเฉพาะในไฟล์
BashRun shell commandsรันคำสั่งเชลล์

7. Summary / สรุป

เครื่องมือไฟล์หลักของ Claude Code คือ Read, Write และ Edit Read ดูไฟล์ Write สร้างไฟล์ และ Edit แก้ไขส่วนเฉพาะ Present Simple (เติม -s สำหรับ he/she/it) อธิบายสิ่งที่เครื่องมือทำ
Claude Code's core file tools are Read, Write, and Edit. Read views files, Write creates them, and Edit changes specific parts. Present Simple (adds -s for he/she/it) describes what tools do.

Homework / การบ้าน

1. ใช้ Claude อ่านไฟล์สามประเภทที่แตกต่างกัน
2. สร้างไฟล์ Python ใหม่ด้วย Claude
3. เขียน 5 ประโยคโดยใช้ Present Simple เกี่ยวกับเครื่องมือของ Claude
1. Use Claude to read three different file types.
2. Create a new Python file with Claude.
3. Write 5 sentences using Present Simple about Claude's tools.