---
name: research
version: 1.0.0
description: 任務開始前的需求分析與資料收集，整合文件查詢與經驗檢索
author: miles990
tags:
  - research
  - analysis
  - planning
  - context-gathering
dependencies:
  mcp:
    - package: "@anthropic/cipher-mcp"
      required: false
      note: "用於查詢過去經驗"
    - package: "@context7/mcp-server"
      required: false
      note: "用於查詢最新文件"
interface:
  input:
    - name: task
      type: string
      description: "要分析的任務描述"
      required: true
    - name: context
      type: object
      description: "額外上下文（如專案資訊）"
      required: false
  output:
    - name: research_report
      type: object
      description: "結構化研究報告"
    - name: next_action
      type: string
      description: "建議的下一步（通常是 plan-master）"
triggers:
  - pattern: "新任務開始"
    description: "任何新任務開始前"
  - pattern: "需要了解"
    description: "需要收集資訊時"
  - pattern: "技術選型"
    description: "需要評估技術方案時"
title: research
canonical_url: https://skilld.dev/gh/miles990/skillpkg/research
last_updated: 2026-10-04T16:35:54.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install miles990/skillpkg/research`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/research`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/miles990/skillpkg/research) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/research`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/research --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/research --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Research Skill

> 收到任務 → 分析需求 → 查文件 → 查經驗 → 輸出研究報告

## 核心理念

```
┌─────────────────────────────────────────────────────────────────┐
│  在動手之前，先搞清楚狀況                                       │
│                                                                 │
│  傳統模式：收到任務 → 直接開始做 → 遇到問題再查                  │
│  研究模式：收到任務 → 分析需求 → 收集資料 → 有備而戰             │
└─────────────────────────────────────────────────────────────────┘
```

## 研究流程

### Step 1: 任務解析

```markdown
問自己：
1. 這個任務的核心目標是什麼？
2. 有哪些明確的需求？
3. 有哪些隱含的約束？
4. 成功的標準是什麼？

輸出：結構化的需求分析
```

### Step 2: 查詢過去經驗（如有 Cipher）

```javascript
// 先查是否有類似經驗
await mcp__cipher__ask_cipher({
  message: "我之前有處理過類似的任務嗎？學到了什麼教訓？"
})
```

- 有經驗 → 納入參考
- 無經驗 → 繼續收集資料

### Step 3: 查詢相關文件（如有 Context7）

```javascript
// 查詢相關技術文件
await mcp__plugin_context7_context7__resolve_library_id({
  query: "任務相關的技術",
  libraryName: "相關框架或工具"
})

await mcp__plugin_context7_context7__query_docs({
  libraryId: "/org/project",
  query: "具體問題"
})
```

### Step 4: 綜合分析

整合所有收集的資訊，形成研究報告：

```yaml
research_report:
  task: "原始任務描述"

  analysis:
    requirements:
      - "功能需求 1"
      - "功能需求 2"
    constraints:
      - "技術約束"
      - "時間約束"
    tech_stack:
      - "需要的技術 1"
      - "需要的技術 2"

  findings:
    relevant_docs:
      - source: "文件來源"
        summary: "關鍵發現"
    past_experience:
      - context: "過去情境"
        lesson: "學到的教訓"

  recommendations:
    approach: "建議的實作方法"
    risks:
      - "潛在風險 1"
      - "潛在風險 2"
    alternatives:
      - "替代方案"
```

### Step 5: 輸出與交接

```markdown
輸出：
- research_report: 完整的研究報告
- next_action: "plan" (交給 plan-master 進行任務規劃)
```

## 最小範例

```markdown
用戶：幫我用 FastAPI 建立一個 REST API

AI 執行 research skill：

1. 任務解析：
   - 目標：建立 REST API
   - 技術：FastAPI
   - 約束：未明確（需確認）

2. 查經驗 (Cipher)：
   → 找到過去 FastAPI 專案經驗
   → 教訓：記得加 CORS middleware

3. 查文件 (Context7)：
   → FastAPI 最新版本是 0.115.x
   → 新增了 Annotated 語法支援

4. 研究報告：
   {
     task: "用 FastAPI 建立 REST API",
     analysis: {
       requirements: ["RESTful 端點", "JSON 回應"],
       tech_stack: ["FastAPI", "Pydantic", "Uvicorn"]
     },
     findings: {
       past_experience: ["記得加 CORS"],
       relevant_docs: ["使用 Annotated 語法"]
     },
     recommendations: {
       approach: "使用 FastAPI + Pydantic v2"
     }
   }

5. next_action: "plan"
   → 交給 plan-master 進行任務規劃
```

## 與其他 Skill 的協作

```
┌─────────────────────────────────────────────────────────────────┐
│  協作流程                                                       │
│                                                                 │
│  [用戶任務] → [research] → [plan-master] → [執行] → [goal-verifier]
│                   │              │                      │        │
│                   ↓              ↓                      ↓        │
│              研究報告        任務計劃              驗證結果       │
└─────────────────────────────────────────────────────────────────┘
```

## 與 MCP 工具整合

| MCP 工具 | 用途 | 必要性 |
|----------|------|--------|
| cipher | 查詢過去經驗 | 推薦 |
| context7 | 查詢最新文件 | 推薦 |
| pal.thinkdeep | 深度分析複雜問題 | 可選 |

## 設計原則

1. **先調研後動手** - 避免盲目開始
2. **整合多源資訊** - 經驗 + 文件 + 分析
3. **結構化輸出** - 方便下游 skill 使用
4. **標準交接** - 輸出格式統一
5. **可選依賴** - 沒有 MCP 也能運作（降級模式）

## 限制與邊界

- 這是「研究」不是「執行」，不會產出程式碼
- 依賴 MCP 工具的品質和可用性
- 複雜任務可能需要多輪研究
- 研究報告是「建議」，最終決策權在用戶
