將 AI 助手引導至你的程式碼庫慣例
何時使用: 在新專案的第一次工作階段,或在大規模重構改變了慣例之後。
前置條件
- 已安裝 drift — 使用 uvx drift 或全域安裝
步驟
-
執行初始掃描Run drift scan on this repo. Tell me what patterns you detected around error handling, module structure, and naming.✓ 已複製→ 包含具體範例的慣例摘要
-
記錄你想保留的決策Record these team decisions: we use Result<T,E> not exceptions, one controller per feature folder, snake_case for file names. Tag them 'conventions'.✓ 已複製→ 確認儲存;後續可查詢
-
驗證未來的工作階段是否能載入In a new session: what conventions does this repo follow?✓ 已複製→ Claude 能複述你所記錄的決策
結果: 未來每次 AI 工作階段都會預先載入團隊慣例——減少糾正次數,對話更有效率。
注意事項
- 模式是從現有程式碼推斷的,包括品質不佳的程式碼 — 檢視初始掃描結果,刪除那些其實是你想擺脫的技術債的「慣例」
- 如果忘記更新,決策記憶會與現實脫節 — 將記憶條目視同文件管理——每季定期檢閱