claude-code/README.md

133 lines
4.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Claude Code 工具箱
用 Claude Code 從零到一打造產品的完整工作環境。包含 23 個 AI Agent、45 個指令、66 個技能知識庫。
---
## 目錄
- [前置需求](#前置需求)
- [快速開始](#快速開始)
- [專案結構](#專案結構)
- [指令總覽](#指令總覽)
- [從零到一:打造產品的完整流程](#從零到一打造產品的完整流程)
- [常用工作流程](#常用工作流程)
- [如何追加與擴充](#如何追加與擴充)
- [MCP Server 說明](#mcp-server-說明)
- [FAQ](#faq)
---
## 前置需求
| 工具 | 用途 | 安裝方式 |
|------|------|----------|
| **Claude Code CLI** | 核心 AI 助手 | `npm install -g @anthropic-ai/claude-code` |
| **Node.js ≥ 18** | 執行 MCP server 與腳本 | [nodejs.org](https://nodejs.org) 或 `brew install node` |
| **Git** | 版本控制 | `brew install git`macOS 通常已內建) |
以下為**選用**,依你的開發語言安裝:
| 工具 | 用途 |
|------|------|
| Go | 使用 `/go-build`、`/go-review`、`/go-test` 指令 |
| Python 3 | 使用 `/python-review` 指令 |
| PM2 | 使用 `/pm2` 服務管理指令(`npm install -g pm2` |
## 快速開始
```bash
# 1. 複製這個工具箱到你的專案
cp -r .claude/ 你的專案/.claude/
# 2. 安裝所有依賴MCP server 等)
make install
# 3. 進入你的專案,啟動 Claude Code
cd 你的專案
claude
# 4. 在 Claude Code 裡輸入斜線指令開始工作
# 輸入 / 會看到所有可用指令
```
> **提示**:第一次使用請先跑 `make install`,它會幫你裝好所有 MCP server 需要的 npm 套件。
---
## 專案結構
```
.claude/
├── CLAUDE.md # 總開發規範Claude 自動讀取)
├── agents/ # 23 個 AI Agent 定義
│ ├── architect.md # 架構師
│ ├── planner.md # 規劃師
│ ├── code-reviewer.md # 程式碼審查
│ ├── tdd-guide.md # TDD 引導
│ ├── security-reviewer.md # 安全審查
│ ├── fin-*.md # 金融分析系列5 個)
│ └── pm-*.md # 產品經理系列4 個)
├── commands/ # 45 個斜線指令
│ ├── plan.md # /plan — 規劃
│ ├── tdd.md # /tdd — 測試驅動開發
│ ├── code-review.md # /code-review — 程式碼審查
│ ├── fin-*.md # /fin-* — 金融分析系列
│ ├── pm-*.md # /pm-* — 產品經理系列
│ └── ... # 更多指令見下方總覽
├── skills/ # 66 個技能知識庫Claude 自動參考)
│ ├── golang-clean-arch/ # Go Clean Architecture
│ ├── tdd-workflow/ # TDD 工作流程
│ └── ... # 各語言/框架的最佳實踐
├── rules/ # 各語言的編碼規範
│ ├── common/ # 通用規範
│ ├── golang/ # Go 規範
│ ├── python/ # Python 規範
│ ├── typescript/ # TypeScript 規範
│ └── swift/ # Swift 規範
└── mcp-configs/ # MCP Server 設定範本
└── mcp-servers.json # 可用的 MCP server 清單
```
> **Skills 不會出現在 `/` 選單裡**它們是背景知識Claude 會在需要時自動參考。
---
## 指令總覽
在 Claude Code 裡輸入 `/` 就能看到所有指令。以下依用途分類:
### 🏗️ 規劃與架構
| 指令 | 說明 |
|------|------|
| `/plan` | 重述需求 → 風險評估 → 分步計劃。**不會動程式碼**,等你確認才開始 |
| `/orchestrate` | 串接多個 Agent 執行複雜任務feature / bugfix / refactor / security |
### 💻 開發與測試
| 指令 | 說明 |
|------|------|
| `/tdd` | 測試驅動開發:先寫測試 → 實作 → 重構 → 確保 80%+ 覆蓋率 |
| `/build-fix` | 逐一修復建置/型別錯誤,一次一個,最小改動 |
| `/code-review` | 全面程式碼審查(安全、品質、效能) |
| `/verify` | 一鍵驗證:建置 → 型別 → Lint → 測試 → 安全掃描 |
| `/test-coverage` | 分析覆蓋率缺口,自動補測試到 80%+ |
| `/refactor-clean` | 安全移除死碼,每步都跑測試驗證 |
| `/e2e` | 用 Playwright 產生並執行端對端測試 |
### 🐹 Go 專用
| 指令 | 說明 |
|------|------|
| `/go-build` | 修復 Go 建置錯誤、go vet 警告 |
| `/go-review` | Go 程式碼審查(慣用寫法、並發安全、錯誤處理) |
| `/go-test` | Go TDD 工作流程table-driven tests |
### 🐍 Python 專用
| 指令 | 說明 |
|------|------|
| `/python-review` | Python 審查PEP 8、型別提示、安全、慣用寫法 |