Week 4 of 12 ⌨️

Slash Commands & Configuration

Slash Commands และการตั้งค่า

Slash 命令与配置

Slash Commands & Configuration

1. Introduction / บทนำ / 简介

Slash commands คือทางลัดที่เริ่มต้นด้วย / และควบคุมพฤติกรรมของ Claude Code ช่วยให้คุณจัดการเซสชัน เปลี่ยนโมเดล ดูค่าใช้จ่าย ตั้งค่า และอื่นๆ อีกมากมาย — โดยไม่ต้องออกจากการสนทนา
Slash 命令是以 / 开头的快捷方式,用来控制 Claude Code 的行为。它们让你管理会话、切换模型、查看费用、配置设置等等——全都不用离开对话。
Slash commands are shortcuts that start with / and control Claude Code's behavior. They let you manage sessions, change models, view costs, configure settings, and much more — all without leaving the conversation.

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

  • /compact can save 80% of your context window!
  • /model lets you switch between Opus, Sonnet, and Haiku.
  • /diff opens an interactive viewer for uncommitted changes.
Close-up of computer keyboard keys
One key, one clear meaning — slash commands work the same way. — Photo: Wikimedia Commons, CC0, via Wikimedia Commons

2. Vocabulary / คำศัพท์ / 词汇

Click a card to flip it. คลิกการ์ดเพื่อพลิก 点击卡片翻面。

command
คำสั่ง
命令
An instruction to the program
slash
สแลช / เครื่องหมาย /
斜杠 / 符号 /
The / character used before commands
clear
ล้าง
清除
To remove all conversation history
compact
ย่อ
压缩
To compress conversation to save context
config
คอนฟิก / ตั้งค่า
配置
To change program settings
model
โมเดล
模型
The AI model being used
effort
ระดับความพยายาม
努力程度
How hard the AI tries (low/medium/high)
diff
ดิฟฟ์
差异对比
To show changes between file versions
status
สถานะ
状态
Current state of the program
cost
ต้นทุน / ค่าใช้จ่าย
成本 / 费用
Token usage and billing
resume
กลับมาต่อ
继续会话
To continue a previous session
export
ส่งออก
导出
To save conversation as a file

3. Grammar Focus / ไวยากรณ์ / 语法焦点

Modal Verbs (can, should, must) / คำกริยาช่วย (can, should, must) / 情态动词(can、should、must)

Thai:
คำกริยาช่วย (can, should, must) มาก่อนกริยาหลักและไม่เปลี่ยนรูป 'Can' = ความสามารถ 'Should' = คำแนะนำ 'Must' = ข้อบังคับ ตัวอย่าง: 'You can use /clear to reset.' 'You should save before exiting.'
中文:
情态动词(can、should、must)放在主要动词前面,形式不变。'Can' = 能力/可能,'Should' = 建议,'Must' = 必须。例如:'You can use /clear to reset.'(你可以用 /clear 重置。)'You should save before exiting.'(退出前你应该先保存。)
English:
Modal verbs (can, should, must) come before the main verb and don't change form. 'Can' = ability/possibility. 'Should' = recommendation. 'Must' = obligation. Example: 'You can use /clear to reset.' 'You should save before exiting.'
คุณสามารถใช้ /compact เพื่อประหยัดบริบท
你可以用 /compact 来节省上下文。
You can use /compact to save context.
คุณควรตรวจสอบ /cost ก่อนเซสชันยาว
长会话之前你应该先查看 /cost。
You should check /cost before long sessions.
คุณต้องเข้าสู่ระบบก่อนใช้ Claude Code
使用 Claude Code 之前你必须先登录。
You must login before using Claude Code.

Section Check 1

What does /compact do?

/compact ทำอะไร?

/compact 是做什么的?

Section Check 2

Which modal means 'recommendation'?

คำกริยาช่วยตัวใดหมายถึง 'คำแนะนำ'?

哪个情态动词表示"建议"?

Section Check 3

How do you change the AI model?

เปลี่ยนโมเดล AI ยังไง?

怎么切换 AI 模型?

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

1
Type / to see all commands / พิมพ์ / เพื่อดูคำสั่งทั้งหมด / 输入 / 查看所有命令
A menu appears showing all available slash commands.

How to do it

  • On an empty prompt, type / — a menu of every command appears.
  • Use the arrow keys to move, Enter to run, Esc to close.
  • Keep typing to filter: /mo narrows the list to /model.
2
Clear your conversation / ล้างการสนทนา / 清除对话
Type /clear to start fresh. Your files and project stay the same.

How to do it

  • Type /clear and press Enter.
  • The chat history is wiped — but your files and project are untouched.
  • Use it between unrelated tasks: a fresh context gives more focused answers.
3
Change the AI model / เปลี่ยนโมเดล AI / 切换 AI 模型
Type /model and select from Opus (powerful), Sonnet (balanced), or Haiku (fast).

How to do it

  • Type /model — a list appears (Opus = most powerful, Sonnet = balanced, Haiku = fastest).
  • Pick with arrows + Enter. The new model is used from your next message.
  • Tip: heavy thinking → Opus; quick questions → Haiku.
4
Check your costs / ตรวจสอบค่าใช้จ่าย / 查看费用
Type /cost to see how many tokens you've used in this session.

How to do it

  • Type /cost to see the tokens used in this session.
  • Check it before and after a big task — you will quickly learn what things cost.
  • On a subscription plan this counts toward your usage limits rather than a bill.
5
Configure settings / ตั้งค่า / 配置设置
Type /config to open the settings interface.

How to do it

  • Type /config to open the settings screen.
  • Move with arrows, change values with Enter.
  • Changes save automatically — Esc closes the screen.

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

แบบฝึกหัด: ลอง /status, /cost และ /model ในเซสชัน Claude Code จดบันทึกว่าแต่ละคำสั่งแสดงอะไร
练习:在 Claude Code 会话里试试 /status、/cost 和 /model。记下每个命令显示的内容。
Practice: Try /status, /cost, and /model in a Claude Code session. Write down what each command shows you.

Step by step

  1. Type /status — note your model and working directory.
  2. Type /cost — note the tokens used so far.
  3. Type /model — look at the choices, then press Esc (or switch and switch back).
  4. Ask Claude any question, then run /cost again and compare the numbers.

✓ You did it right if: you can say which model you are using and how many tokens your question cost.

📜 A complete command session / ตัวอย่างคำตอบ / 示例答案
> /status
  model: Sonnet - dir: ~/my-project - 0 tokens used

> /cost
  0 tokens used this session

> What is a slash command?
* A slash command starts with / and controls Claude Code itself
  instead of talking to the project...

> /cost
  412 tokens used this session      <- your question had a price!

> /model
  * Sonnet (current)    Opus    Haiku    <- pick with arrow keys

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

Command / ToolEnglishภาษาไทย中文
/clearReset conversationรีเซ็ตการสนทนา重置对话
/compactCompress contextบีบอัดบริบท压缩上下文
/modelChange AI modelเปลี่ยนโมเดล AI切换 AI 模型
/costShow token usageแสดงการใช้โทเค็น显示 token 用量
/diffView file changesดูการเปลี่ยนแปลงไฟล์查看文件改动
/configOpen settingsเปิดการตั้งค่า打开设置

7. Interactive Lab / ห้องทดลอง / 互动实验室

A working slash-command menu, and a context bucket you can overflow and rescue. / ลองใช้เมนู slash commands จริง ๆ / 试用真实的斜杠命令菜单

Type in the box. Start with / to see the command menu, or type a normal message.

session started — 0 tokens

8. Summary / สรุป / 总结

Slash commands ควบคุมพฤติกรรมของ Claude Code คำสั่งสำคัญ ได้แก่ /clear (รีเซ็ต), /compact (ประหยัดบริบท), /model (สลับ AI) และ /config (ตั้งค่า) คำกริยาช่วย (can/should/must) แสดงความสามารถ คำแนะนำ และข้อบังคับ
Slash 命令控制 Claude Code 的行为。重要命令有 /clear(重置)、/compact(节省上下文)、/model(切换 AI)和 /config(设置)。情态动词(can/should/must)表达能力、建议和义务。
Slash commands control Claude Code's behavior. Key commands include /clear (reset), /compact (save context), /model (switch AI), and /config (settings). Modal verbs (can/should/must) express ability, advice, and obligation.

Homework / การบ้าน / 作业

1. ระบุ slash commands 5 ตัวและวัตถุประสงค์
2. ใช้ /compact ในเซสชันและสังเกตความแตกต่าง
3. เขียนประโยค 3 ประโยคด้วย can, should และ must
1. 列出 5 个 slash 命令和它们的用途。
2. 在会话中使用 /compact 并观察差别。
3. 用 can、should 和 must 各写 3 个句子。
1. List 5 slash commands and their purposes.
2. Use /compact in a session and note the difference.
3. Write 3 sentences each with can, should, and must.