Deep Links
基於 Cursor 官方 Deeplinks 文件解釋 prompt、command、rule 連結、web/app 格式、確認機制、URL 長度和敏感資訊邊界。
Deep links(深度連結,能直接跳轉到應用內特定位置 / 狀態的連結,如 cursor://...)用來分享 Cursor prompt、command 和 rule,讓團隊可以複用工作流、命令和規則。
閱讀目標:讀完本章,你應該能生成和審查 Cursor deeplink,並知道它為什麼不能自動執行、為什麼要做敏感資訊檢查。
1. 先判斷
Deep links 適合分享“入口”,不適合分享秘密。
| 型別 | 用途 |
|---|---|
| Prompt link | 開啟 Cursor,並把 prompt 預填到 chat |
| Command link | 建立 .cursor/commands 風格的 custom command |
| Rule link | 建立 .cursor/rules 風格的 custom rule |
關鍵安全點:deeplink 不會自動執行。使用者點選後仍要 review 和 confirm。
2. 兩種 URL 形態
Cursor 支援 app protocol 和 web link。
| 形態 | 示例 |
|---|---|
| App protocol | cursor://anysphere.cursor-deeplink/prompt?text=Hello%20world |
| Web link | https://cursor.com/link/prompt?text=Hello%20world |
Web link 會開啟 cursor.com,再讓使用者在瀏覽器裡開啟 deeplink 或複製到 Cursor。分享給不確定是否安裝 Cursor 的人時,web link 更穩。
3. Prompt deeplink
Prompt link 只需要 text。
適合:
- 分享某個 repo 的 review prompt。
- 分享調研、排障、重構、測試生成的起手式。
- 在教程、issue template、內部文件中放統一任務入口。
不適合:
- 把 API key、password、customer data 寫進 prompt。
- 把內部 proprietary code 直接塞進 URL。
- 讓使用者誤以為點選後會自動執行。
4. Command deeplink
Command link 用來分享 custom command。引數通常包括:
| 引數 | 用途 |
|---|---|
name | command 名稱 |
text | command 內容 |
使用者點選後,Cursor 會建立一個新 command。使用者仍要 review 和 confirm,command 不會自動執行。
適合分享團隊固定動作,例如 debug API、生成測試、做 release note、檢查 migrations。
5. Rule deeplink
Rule link 用來分享 custom rule。引數通常包括:
| 引數 | 用途 |
|---|---|
name | rule 名稱 |
text | rule 內容 |
適合分享程式碼風格、專案約束、安全紅線、review 標準。
rule 的風險比 prompt 更長期:使用者確認後,rule 會影響後續 Cursor 行為。分享前要確認內容不包含臨時偏好、過期約束或不該推廣到其他專案的內部規則。
6. URL encode 和長度限制
生成 deeplink 時要 URL-encode 引數。空格、中文、換行、符號都應該透過標準 URL APIs 處理,不要手工拼接。
官方說明 deeplink URL 最大長度是 8,000 characters。注意這是 URL-encoded 之後的長度,不是原文長度。
超長內容建議:
- 改成連結到內部文件。
- 拆成多個更小 prompt / command / rule。
- 用 repo 中的
.cursor/commands或.cursor/rules直接管理。
7. 分享前檢查
每條 deeplink 發出去前至少檢查:
- 是否包含 API key、token、password、private URL。
- 是否包含客戶資料、日誌、截圖文字或內部 repo 細節。
- prompt / command / rule 是否已經 URL-encoded。
- link 是否低於 8,000 characters。
- 使用者點選後是否需要明確 review。
- command / rule 是否適合長期儲存。
8. 商業級用法
更穩的落地方式:
| 場景 | 推薦 |
|---|---|
| 教程站 | 放 web link,配清晰標題和適用場景 |
| 團隊 SOP | prompt link 只放非敏感指令,具體上下文讓使用者本地選擇 |
| Command 分發 | 小範圍試用後再公開 |
| Rule 分發 | 版本化管理,避免連結散落後不可追蹤 |
| 對外分享 | 預設只分享 prompt,不分享包含組織規則的 command / rule |
Deep links 的價值是降低啟動成本。真正的規則和命令,長期仍應進 repo 或團隊配置,便於 review、版本控制和撤回。
本章自檢
- 這個連結是 prompt、command 還是 rule?
- 使用者點選後是否需要 review 和 confirm?
- URL-encoded 後是否超過 8,000 characters?
- 是否包含任何敏感或 proprietary 內容?
- command / rule 是否應該改為 repo 檔案,而不是連結傳播?
透過標準:你能生成一條 web deeplink 和一條 app protocol deeplink,並能解釋為什麼它不會自動執行。
官方來源
- Cursor Deeplinks —— 官方 prompt、command、rule deeplink、URL 形態、確認機制和 FAQ。
- Cursor Slash Commands —— commands 背景。
- Cursor Rules —— custom rules 背景。