TTechSpecs

Cursor 安裝指南

Cursor 是一個基於 VSCode 的 AI 程式碼編輯器,內建強大的 AI 輔助程式碼撰寫能力,並完整支援 Superpowers 技能系統。

平台特色

Cursor 是目前最受歡迎的 AI 程式碼編輯器之一,特色:

  • 🎯 AI 原生整合:內建先進的程式碼補全和生成
  • 🔌 VSCode 相容:完全相容 VSCode 擴展生態
  • 🤖 多模型支援:支援 Claude、GPT-4、本地模型等
  • 🛠️ 強大編輯功能:重構、除錯、程式碼解釋
  • 📚 Superpowers 支援:完整支援技能生態系統

系統需求

硬體需求

  • 處理器:x64_64 或 ARM64 架構
  • 記憶體:至少 8 GB RAM(建議 16 GB 以上)
  • 硬碟空間:至少 1 GB 可用空間

軟體需求

  • 作業系統
    • Windows 10/11(x64)
    • macOS 11+ (Big Sur 或更高版本)
    • Ubuntu 20.04+、Debian 11+、Fedora 35+
  • 網路:穩定的網際網路連線
  • 顯示器:支援 1920x1080 或更高解析度

安裝步驟

Windows 安裝

# 第 1 步:下載 Cursor 安裝程式
# 訪問 https://cursor.sh/downloads
# 下載 Windows 版本安裝程式

# 第 2 步:執行安裝程式
# 下載完成後執行安裝程式
# 按照安裝嚮導完成安裝

# 第 3 步:啟動 Cursor
# 安裝完成後從開始選單啟動 Cursor

# 第 4 步:登入帳號
# 首次啟動時需要登入或建立帳號

macOS 安裝

# 第 1 步:使用 Homebrew 安裝
brew install --cask cursor

# 或手動下載
# 訪問 https://cursor.sh/downloads
# 下載 macOS 版本(.dmg 檔案)

# 第 2 步:開啟安裝程式
# 下載完成後開啟 .dmg 檔案
# 將 Cursor 拖曳到 Applications 資料夾

# 第 3 步:啟動 Cursor
# 從 Applications 資料夾啟動 Cursor

# 第 4 步:完成初始設定
# 按照設定嚮導完成配置

Linux 安裝

# 第 1 步:下載 AppImage
# 訪問 https://cursor.sh/downloads
# 下載 Linux AppImage 版本

# 第 2 步:設定執行權限
chmod +x cursor-*.AppImage

# 第 3 步:移動到系統路徑
sudo mv cursor-*.AppImage /usr/local/bin/cursor

# 第 4 步:建立桌面捷徑
cat > ~/.local/share/applications/cursor.desktop << 'EOF'
[Desktop Entry]
Name=Cursor
Exec=/usr/local/bin/cursor
Type=Application
Categories=Development;IDE;
EOF

# 第 5 步:啟動 Cursor
# 從應用程式選單啟動 Cursor

Superpowers 整合

安裝 Superpowers 擴展

# 在 Cursor 中開啟擴展面板
# 快捷鍵:Ctrl+Shift+X (Windows/Linux)
#          Cmd+Shift+X (macOS)

# 搜尋 "Superpowers"
# 點擊 "Install" 安裝擴展

# 或使用指令面板安裝
# 快捷鍵:Ctrl+Shift+P (Windows/Linux)
#          Cmd+Shift+P (macOS)
# 輸入:ext install superpowers

配置 Superpowers

安裝完成後需要配置 Superpowers:

// 在 settings.json 中加入 Superpowers 配置
{
  "superpowers.enabled": true,
  "superpowers.apiKey": "your-anthropic-api-key",
  "superpowers.model": "claude-fable-5",
  "superpowers.skillsPath": "~/.superpowers/skills",
  "superpowers.autoLoad": true,
  "superpowers.contextAware": true
}

環境變數設定

# 設定 API 金鑰
export ANTHROPIC_API_KEY="your-api-key"

# 設定 Superpowers 路徑
export SUPERPOWERS_SKILLS_PATH="$HOME/.superpowers/skills"

# 設定日誌等級
export SUPERPOWERS_LOG_LEVEL="info"

使用方式

AI Chat 面板使用

Cursor 內建 AI Chat 面板,可以直接與 AI 對話:

// 在編輯器中選擇程式碼
// 按下 Ctrl+K (Windows/Linux) 或 Cmd+K (macOS)
// 開啟 AI Chat 面板

// 輸入指令
"使用 brainstorming skill 探索使用者認證的實作方式"

// Cursor 會使用 Superpowers 技能系統來回應

內建指令使用

Cursor 提供多個內建 AI 指令:

# Ctrl+L (Windows/Linux) 或 Cmd+L (macOS)
# 編輯整個檔案

# Ctrl+I (Windows/Linux) 或 Cmd+I (macOS)
# 顯示行內 AI 建議

# Ctrl+Shift+A (Windows/Linux) 或 Cmd+Shift+A (macOS)
# AI 協助程式碼撰寫

# Ctrl+Shift+R (Windows/Linux) 或 Cmd+Shift+R (macOS)
# 重構選定的程式碼

Superpowers 技能觸發

在 Cursor 中使用 Superpowers 技能:

// 方法 1:透過 AI Chat 面板
"使用 test-driven-development skill 為購物車功能撰寫測試"

// 方法 2:透過註解觸發
// 在程式碼中加入註解
/**
 * SUPERPOWERS: brainstorming
 * 探索微服務架構設計
 */

// 方法 3:透過指令面板
// Ctrl+Shift+P -> "Superpowers: Run Skill"

進階設定

自訂快捷鍵

// 在 keybindings.json 中設定自訂快捷鍵
{
  "key": "ctrl+shift+s",
  "command": "superpowers.runSkill",
  "args": {
    "skill": "systematic-debugging"
  }
}

{
  "key": "ctrl+shift+v",
  "command": "superpowers.verification"
}

工作區配置

// 在 .vscode/settings.json 中設定工作區配置
{
  "superpowers.projectContext": {
    "contextFiles": [
      "README.md",
      "CLAUDE.md",
      "package.json",
      "tsconfig.json"
    ],
    "ignorePatterns": [
      "node_modules",
      "dist",
      "build",
      ".git"
    ]
  },
  "superpowers.autoSkills": {
    "onSave": "verification-before-completion",
    "onCommit": "requesting-code-review"
  }
}

技能熱鍵

# 設定技能熱鍵快速存取常用技能
{
  "superpowers.hotkeys": {
    "ctrl+alt+b": "brainstorming",
    "ctrl+alt+p": "writing-plans",
    "ctrl+alt+t": "test-driven-development",
    "ctrl+alt+d": "systematic-debugging",
    "ctrl+alt+v": "verification-before-completion"
  }
}

整合開發流程

Git 整合

# 在 Git 操作中使用 Superpowers
# Cursor 會在 commit 前自動執行驗證

git commit -m "feat: add user authentication"

# Cursor 自動執行:
# 1. verification-before-completion
# 2. 基本 linting 檢查
# 3. 測試執行

測試整合

// 在測試檔案中使用 Superpowers 技能

describe('Shopping Cart', () => {
  /**
   * SUPERPOWERS: test-driven-development
   * 為購物車功能撰寫 TDD 測試
   */
  it('should add item to cart', () => {
    // Superpowers 協助撰寫測試案例
  });
});

CI/CD 整合

# 在 CI/CD pipeline 中使用 Cursor
# .github/workflows/cursor-review.yml

name: Cursor AI Review
on: [pull_request]

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      
      - name: Install Cursor
        run: |
          curl -fsSL https://cursor.sh/install | sh
          
      - name: Run Superpowers Review
        run: |
          cursor --skill requesting-code-review \
            --diff origin/main...HEAD \
            --output review-report.md

常見問題

安裝問題

Q1: Windows 安裝時遇到防毒軟體警告

A:

  • Cursor 是官方簽名的應用程式
  • 可以在安裝前暫時停用防毒軟體
  • 安裝完成後將 Cursor 加入白名單

Q2: macOS 無法開啟 Cursor

A:

# 檢查安全性設定
# 系統偏好設定 -> 安全性與隱私 -> 允許來自 "App Store"

# 或使用終端機開啟
open /Applications/Cursor.app

Q3: Linux AppImage 無法執行

A:

# 確保執行權限正確
chmod +x cursor-*.AppImage

# 檢查是否缺少依賴
ldd cursor-*.AppImage

# 安裝缺少的依賴
sudo apt install libgtk-3-0 libxss1 libasound2

配置問題

Q4: Superpowers 擴展無法載入

A:

# 檢查擴展目錄
ls -la ~/.cursor/extensions/superpowers

# 重新安裝擴展
# 在 Cursor 中按 Ctrl+Shift+X
# 找到 Superpowers 點擊重新安裝

Q5: API 金鑰設定無效

A:

// 在 settings.json 中直接設定
{
  "superpowers.apiKey": "sk-ant-..."
}

// 或使用環境變數
export ANTHROPIC_API_KEY="sk-ant-..."

Q6: 技能回應異常緩慢

A:

// 調整效能設定
{
  "superpowers.maxTokens": 100000,
  "superpowers.temperature": 0.5,
  "superpowers.timeout": 60000
}

// 使用較小的模型
{
  "superpowers.model": "claude-opus-4-8"
}

使用問題

Q7: AI 建議不符合專案風格

A:

// 在 .cursorrules 中定義專案規範
/*
 * 程式碼風格:
 * - 使用 TypeScript strict 模式
 * - 函式使用 camelCase
 * - 類別使用 PascalCase
 * - 常數使用 UPPER_SNAKE_CASE
 * - 使用 2 空格縮排
 */

// 設定 EditorConfig
// .editorconfig
[*.ts]
indent_style = space
indent_size = 2

Q8: 技能無法理解專案上下文

A:

# 確保專案上下文已正確設定
# 檢查 CLAUDE.md 是否存在
ls -la CLAUDE.md

# 在專案根目錄建立 CLAUDE.md
cat > CLAUDE.md << 'EOF'
# 專案描述

## 技術棧
- Frontend: React + TypeScript
- Backend: Node.js + Express
- Database: PostgreSQL

## 專案結構
src/
├── components/
├── hooks/
├── utils/
└── types/

## 開發規範
- 使用 ESLint 和 Prettier
- 提交前執行測試
- 遵循 Conventional Commits
EOF

效能優化

快取管理

# 清除 AI 回應快取
# File -> Preferences -> Superpowers -> Clear Cache

# 或透過設定檔案
{
  "superpowers.cache.enabled": false
}

並行處理

# 啟用並行處理多個檔案
{
  "superpowers.parallel.enabled": true,
  "superpowers.parallel.maxWorkers": 4
}

記憶體優化

# 限制 AI 上下文大小
{
  "superpowers.maxContextFiles": 10,
  "superpowers.maxTokensPerFile": 5000
}

資源連結

官方資源

學習資源

社群資源

下一步

安裝完成後,建議:

  1. 完成初始設定:設定 AI 模型和 API 金鑰
  2. 安裝 Superpowers:安裝並配置技能擴展
  3. 探索快捷鍵:熟悉 AI 輔助快捷鍵
  4. 建立專案配置:為專案設定 .cursorrules
  5. 嘗試技能:使用 brainstorming 技能探索新功能

開始使用 Cursor 和 Superpowers,體驗 AI 輔助程式開發的強大能力!