docs: Add CLAUDE.md for Claude Code auto-load configuration

- Skills index and routing table
- Core rules (simplified)
- Props mapping lesson from Y/n button incident

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-03-23 14:05:58 +08:00
parent 962b1e75a5
commit 41127f1e8b

59
CLAUDE.md Normal file
View File

@@ -0,0 +1,59 @@
# AWOOOI Project Configuration
> 此文件由 Claude Code 自動讀取,定義專案核心規則
## 專案架構
- **apps/api/** - FastAPI 後端 (Python)
- **apps/web/** - Next.js 前端 (TypeScript)
- **k8s/** - Kubernetes 配置
- **packages/** - 共用套件
## Skills 載入指令
執行任務前,請先讀取相關 Skill
| 任務類型 | Skill 路徑 |
|---------|-----------|
| 前端修改 | `.agents/skills/01-awoooi-frontend-aesthetics.md` |
| 後端修改 | `.agents/skills/02-lewooogo-backend-core.md` |
| AI/決策邏輯 | `.agents/skills/03-openclaw-cognitive-expert.md` |
| DevOps/K8s | `.agents/skills/04-awoooi-devops-commander.md` |
| 測試/診斷 | `.agents/skills/05-awoooi-sre-qa.md` |
| Git/依賴 | `.agents/skills/06-awoooi-monorepo-master.md` |
## 核心鐵律 (簡版)
1. **i18n 零硬編碼** - 所有 UI 文字必須用 next-intl
2. **禁止 SQLite** - 只用 PostgreSQL
3. **禁止 latest tag** - K8s image 必須精確版本
4. **CORS 白名單** - 禁止 `*`
5. **Dry-Run 先行** - K8s 變更必須先 dry-run
6. **Memory 同步** - 任務完成後更新 Memory MD
## Memory 系統
長期記憶存放在:`~/.claude/projects/-Users-ogt-awoooi/memory/`
索引文件:`MEMORY.md`
## 2026-03-23 Props Mapping 教訓
> **事故**: Y/n 按鈕灰色無法點擊,因為 `mapToDualState()` 遺漏傳遞 `decision` 欄位
### 鐵律: 新增 API 欄位時的檢查清單
1. API Response 有該欄位 ✓
2. Mapper 函數有轉換該欄位 ✓ ← 常遺漏
3. TypeScript 型別有定義該欄位 ✓
4. 組件 Props 有接收該欄位 ✓
5. 組件有使用該欄位 ✓
### 快速診斷
```bash
# 確認 API 有回傳
curl -s API_URL | jq '.[0].decision'
# 確認 Mapper 有轉換
grep -n "decision" apps/web/src/app/*/page.tsx
```