Slash Commands • Agents • Skills • MCP
/commands — Reusable prompts
agents — Specialized AI personalities
skills — Autonomous capabilities
MCP — External integrations
hooks — Event-triggered actions
.claude/
├── commands/ # Slash commands
│ ├── wip.md
│ └── recap.md
├── agents/ # Subagents
│ ├── executor.md
│ └── context-finder.md
├── skills/ # Skills
│ └── pdf/
│ └── SKILL.md
└── knowledge/ # Reference docs
.mcp.json # MCP servers
พิมพ์ /command → Claude ทำตาม
# .claude/commands/review.md
---
description: "Review code for issues"
allowed-tools: Read, Grep
---
Check this code for:
- Security vulnerabilities
- Performance issues
- Best practices
Usage: /review
# .claude/commands/pr.md
---
description: "Review pull request"
argument-hint: "[PR number]"
---
Review PR #$ARGUMENTS
Check: code quality, tests, security
Usage: /pr 123
$ARGUMENTS = all args | $1 $2 = specific
AI ผู้เชี่ยวชาญเฉพาะด้าน
แยก context window (ไม่รก main)
กำหนด tools ที่ใช้ได้
Auto-invoke ตาม task
ตัวอย่าง: code-reviewer, debugger, test-runner
# .claude/agents/reviewer.md
---
name: code-reviewer
description: "Review code after changes"
tools: Read, Grep, Glob, Bash
model: sonnet
---
You are a senior code reviewer.
1. Run git diff to see changes
2. Check for:
- Code clarity
- Security issues
- Test coverage
3. Report: Critical → Warnings → Suggestions
Autonomous capabilities (auto-discover)
Slash Command
Manual /invoke
Single file
Skill
Auto discovery
Multi-file + scripts
.claude/skills/pdf/
├── SKILL.md # Main instructions
├── REFERENCE.md # Detailed docs
└── scripts/
└── extract.py
# .claude/skills/pdf/SKILL.md
---
name: pdf-processing
description: "Extract text and fill PDF forms.
Use when working with PDF files."
allowed-tools: Read, Bash
---
## What You Can Do
1. Extract text from PDFs
2. Fill PDF forms
3. Merge documents
## Usage
python scripts/extract.py document.pdf
Model Context Protocol — External integrations
Connect Claude to external tools & databases
Tools appear automatically
// .mcp.json
{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.github.com/mcp/"
},
"database": {
"type": "stdio",
"command": "python",
"args": ["db-server.py"],
"env": {
"DB_URL": "postgresql://localhost/mydb"
}
}
}
}
claude mcp add github https://...
claude mcp list — ดู servers ทั้งหมด
claude mcp remove github
/mcp — Authenticate & manage in Claude Code
Run commands when events happen
| Event | When |
|---|---|
| SessionStart | เริ่ม session ใหม่ |
| Stop | Claude หยุดทำงาน |
| PreToolUse | ก่อนใช้ tool |
| PostToolUse | หลังใช้ tool |
| Notification | แจ้งเตือน |
// ~/.claude/settings.json
{
"hooks": {
"SessionStart": [{
"hooks": [{
"type": "command",
"command": "say 'สวัสดีค่ะ พร้อมทำงานแล้ว'"
}]
}],
"Stop": [{
"hooks": [{
"type": "command",
"command": "say 'เสร็จแล้วค่ะ'"
}]
}]
}
}
SessionStart — Load context, play sound
Stop — Notify done, play sound
PreToolUse — Block dangerous commands
PostToolUse — Log actions, auto-format
| Feature | Location | Invocation | Complexity |
|---|---|---|---|
| Slash Command | .claude/commands/ | Manual /cmd | Single file |
| Agent | .claude/agents/ | Auto/explicit | System prompt |
| Skill | .claude/skills/ | Auto discovery | Multi-file |
| MCP Server | .mcp.json | Auto (tools) | External |
| Hooks | settings.json | Auto (events) | JSON config |
Command — Prompt ง่ายๆ ที่ใช้บ่อย
Agent — Task เฉพาะทางที่ต้องการ expertise
Skill — Workflow ซับซ้อน + scripts + templates
MCP — Connect external services
Hooks — Automate on events (start, stop, tool use)
สร้าง Slash Command ของคุณเอง:
mkdir -p .claude/commands
cat > .claude/commands/hello.md << 'EOF'
---
description: "Say hello in Thai"
---
ทักทายเป็นภาษาไทยแบบเป็นกันเอง
EOF
ลอง: /hello
/recap — Fresh start context
/trace — Search git + files
/rrr — Session retrospective
context-finder agent — Fast search
executor agent — Run specs
playwright MCP — Browser automation
Claude Code = Highly Customizable
ทุกอย่างอยู่ใน .claude/ + settings.json