在 Day 2 我們發現了核心問題:AI 工具的「世界觀」不統一,導致程式碼風格差異巨大。在開始設計自己的團隊 System Prompt 之前,我們決定先研究業界最成功的範例,看看別人是怎麼設計的。
第一個研究對象:x1xhlol/system-prompts-and-models-of-ai-tools。
x1xhlol/system-prompts-and-models-of-ai-tools 收集的不是推測或逆向工程的結果,而是從實際運行環境中提取的完整設定檔,包括:
但我還是針對我的需求,Claude Code 與 Cursor 的設定檔進行研究:
讓我們深入分析 x1xhlol/system-prompts-and-models-of-ai-tools 收集的 Claude Code 完整設定檔:
Claude Code 的配置檔首先明確其身份和能力:
You are an interactive CLI tool that helps users with software engineering tasks.
清楚表明其使用情境:命令列介面的軟體工程助手。
You MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail.
IMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy.
這種設計反映了 CLI 工具追求效率的特性,避免冗長的回應影響工作流程。
IMPORTANT: DO NOT ADD ***ANY*** COMMENTS unless asked
Do not add additional code explanation summary unless requested by the user.
這個設計哲學是「程式碼應該自我解釋」,只有在必要時才添加註解。
強制使用任務管理工具:
IMPORTANT: Always use the TodoWrite tool to plan and track tasks throughout the conversation.
這確保了每個開發任務都有清晰的追蹤和管理。
接下來看看 x1xhlol 收集的 Cursor Agent 設定檔:
You are a powerful agentic AI coding assistant, powered by Claude 3.5 Sonnet. You operate exclusively in Cursor, the world's best IDE. You are pair programming with a USER to solve their coding task.
Cursor 的身份定位完全不同:
Write HIGH-VERBOSITY code, even if you have been asked to communicate concisely with the user.
Use **meaningful** variable names as described in Martin's 'Clean Code': Descriptive enough that comments are generally not needed
在程式品質上有明確要求,這反映了 IDE 環境中對程式可讀性和維護性的重視。
TRACE every symbol back to its definitions and usages so you fully understand it.
Look past the first seemingly relevant result. EXPLORE alternative implementations, edge cases, and varied search terms until you have COMPREHENSIVE coverage of the topic.
採用深度理解策略,這確保了 AI 在處理複雜問題時有足夠的上下文理解。
Claude Code 的哲學:
Cursor 的哲學:
當面對「實作用戶登入功能」的需求時:
Claude Code 可能產出:
function authenticateUser($username, $password) {
return verifyCredentials($username, $password) ? loginSuccess() : loginFailure();
}
Cursor 可能產出:
/**
* 處理用戶登入請求
* @param string $username 用戶名稱
* @param string $password 用戶密碼
* @return AuthenticationResult 認證結果
* @throws AuthenticationException 當認證過程失敗時拋出異常
*/
function authenticateUser(string $username, string $password): AuthenticationResult
{
try {
$authenticationResult = $this->authenticationService
->verifyCredentials($username, $password);
if ($authenticationResult->isSuccessful()) {
return $this->handleLoginSuccess($authenticationResult);
} else {
return $this->handleLoginFailure($authenticationResult->getErrorCode());
}
} catch (Exception $authenticationError) {
$this->logger->error('User authentication failed', [
'error' => $authenticationError->getMessage(),
'username' => $username
]);
throw new AuthenticationException(
'Authentication process failed',
0,
$authenticationError
);
}
}
透過研究 x1xhlol 收集的這些頂級 System Prompt,我們歸納出幾個關鍵設計原則:
通過這次研究,我們發現了幾個關鍵問題:
這些發現為我們後續設計統一的 System Prompt 提供了重要方向。我們需要在 Claude Code 的效率和 Cursor 的完整性之間找到平衡點,確保團隊成員無論使用哪種工具,都能產出風格一致的程式碼。
明天我們將繼續探討其他重要的參考來源。我們的目標是通過多方研究,最終設計出一套確保團隊一致性的統一 System Prompt 架構。