使用 Claude Code 進行軟體開發
Dani Zysman
AI Curriculum Manager @ DataCamp

Agents 是 Claude Code 裡的專用 AI 助理:
| Agent | 目的 | 何時使用 |
|---|---|---|
| Explore | 只讀瀏覽程式碼庫 | 「Map this architecture」 |
| Plan | 研究與擬定策略 | 「How should we approach this?」 |
| General | 以完整工具執行工作 | 多數情境的預設 |
使用 /agents 列出所有可用 agents。

.claude/agents/code-reviewer.mdname:Agent 識別名稱description:觸發條件說明___
# code-reviewer.md
name: code-reviewer
description: Reviews code for
best practices
___
Check for:
1. Clear naming conventions
2. Proper error handling
3. Performance concerns
> /agents> [Select] Create new agent> [Select] Project level (.claude/agents)> [Select] Generate with Claude (recommended)> Create a code reviewer agent that reviews code for naming, error handling, and performance.
檢視並核可產生的檔案。
music-analytics-api/
app.py
routes.py # <- 我們要審查這個檔案
models.py
analytics.py
CLAUDE.md
.claude/
agents/
code-reviewer.md # <- 我們的自訂 agent
無子 agent(直接處理):
"Fix the bug in routes.py"
-> Claude handles it
"Add validation here"
-> Claude handles it
會啟動子 agent:
"Map the architecture"
-> Explore agent
"How should we refactor?"
-> Plan agent
> @code-reviewer review @routes.py
Review Complete
Quick Fixes:
- Remove unused `session` import (line 3)
- Replace hardcoded `* 5` popularity metric with a named constant
Structural Issues:
- Album dictionaries built twice in get_album_stats() and
get_average_tracks() extract to a shared helper
- get_artist_albums() returns empty list if artist doesn't exist;
validate artist first
- No range validation on artist_id parameter
Would you like me to fix any of these?

| 問題類型 | 系統動作 |
|---|---|
| 「What does this function do?」 | 由 Claude 直接回答 |
| 「How does auth work across this codebase?」 | 交由 Explore 調查 |
| 「What's the best approach to refactor this?」 | 交由 Plan 研究 |
| 「code review @routes.py」 | 交由自訂 agent 處理 |
使用 Claude Code 進行軟體開發