skipLink.label

Claude Code Reference

Claude Code Reference

Terminal Agent Anthropic

Overview

Claude Code เป็น AI coding agent ที่รันใน terminal ของ Anthropic — มันอ่าน/เขียนไฟล์, รันคำสั่ง, และทำงานหลายขั้นตอนให้เสร็จภายใน repository ของคุณ โดยใช้ Claude models

You → Claude Code CLI → files, commands, tests, git

When to Use

  • งานที่ต้องแก้หลายไฟล์พร้อมกัน (multi-file refactor)
  • งาน autonomous ที่ต้องรัน test / build / git เอง
  • งานที่ต้องการ agentic loop (อ่าน → แก้ → verify → retry)
  • งานที่ต้องการ integ/กับ MCP servers หรือ subagents

When NOT to Use:

  • แค่ autocomplete สั้นๆ (ใช้ IDE inline completion ก็พอ)
  • งานที่ต้อง transaction กับระบบภายนอกโดยไม่มีการ review

Key Features

FeatureDescription
Terminal-basedทำงานใน CLI, ยึดกับ current directory (working directory)
File I/Oอ่าน/เขียนไฟล์ใน repo ได้โดยตรง
Command executionรัน shell commands, tests, builds
Agentic loopวางแผน → ลงมือ → ตรวจสอบ → retry เอง
MCP supportเชื่อมต่อ tools ภายนอกผ่าน Model Context Protocol
Subagentsเรียก agent ย่อยเฉพาะทาง (เช่น Explore, Plan)
Plan modeวางแผนก่อนแก้ โดยไม่เขียน code จนกว่าจะ approve
Hookstrigger scripts ตามเหตุการณ์ (pre-tool, post-tool, …)

Basic Usage

Terminal window
# เริ่มใน directory ของโปรเจกต์
claude
# รัน command เดียวแบบ non-interactive
claude -p "Add a /health endpoint to the server"
# เปิดโหมด Plan (วางแผนก่อนแก้)
claude --plan "Design the auth flow"

Common Workflows

1. Fresh Task in a Repo

Terminal window
cd my-project
claude
# > Add error handling to the fetch wrapper
Terminal window
claude --plan "Add a dark-mode toggle"
# Review the plan, then approve before any code is written

3. Delegating to a Subagent

Use the Explore agent to find every place we read process.env,
then propose a config module.

4. Verify-Before-Trust

After generating the function, run the test suite and fix any failures.
Quote the test output when you're done.

Tips

  • Be explicit about the working directory and scope — Claude Code acts on the current directory.
  • Ask for verification output — instruct it to run node test.js / your gate and quote the result.
  • Use Plan mode for reversible decisions — approve before it mutates files.
  • Guard verbs — “read X, change Y, run Z, stop” keeps the agent bounded.

📚 Resources