📐 什麼是 Spec-driven
Spec-driven 開發是先定義清晰的規格(API 格式、資料結構、互動流程),再讓 AI 根據規格實作。📝 撰寫 API Spec
POST /api/auth/register
Request:
{
"email": "user@example.com",
"password": "securepass123",
"name": "John Doe"
}
Response:
{
"success": true,
"token": "jwt_token_here",
"user": { "id": 1, "email": "...", "name": "..." }
}
🎯 給 Claude 的指令
claude chat "根據以下 API Spec 實作後端: [貼上 API Spec] 要求: - 使用 Express + TypeScript - 密碼使用 bcrypt 加密 - JWT token 有效期 7 天 - 加入輸入驗證與錯誤處理"