slack-search
教你用搜尋修飾詞有效在 Slack 找訊息、檔案和人
中文翻譯
--- name: slack-search description: 有效搜尋 Slack 來找訊息、檔案、頻道和人員的指引 --- # Slack 搜尋 這個 skill 提供有效搜尋 Slack 來找訊息、檔案和資訊的指引。 ## 何時使用 只要需要在 Slack 裡找資訊,就套用這個 skill,包括使用者要你找訊息、對話、檔案或人,或你需要先蒐集 Slack 裡的脈絡才能回答問題的時候。 ## 搜尋工具總覽 | Tool | Use When | |------|----------| | `slack_search_public` | 只搜公開頻道。不需要使用者同意。 | | `slack_search_public_and_private` | 搜所有頻道,包括私人頻道、私訊和群組私訊。需要使用者同意。 | | `slack_search_channels` | 依名稱或描述找頻道。 | | `slack_search_users` | 依姓名、email 或角色找人。 | ## 搜尋策略 ### 先廣再窄 1. 從簡單的關鍵字或自然語言問題開始。 2. 結果太多,就加篩選條件(`in:`、`from:`、日期範圍)。 3. 結果太少,就拿掉篩選條件,改試同義詞或相關詞。 ### 選對搜尋模式 - **自然語言問題**(例如「What is the deadline for project X?」):適合模糊、概念性的搜尋,你不知道確切關鍵字的時候。 - **關鍵字搜尋**(例如 `project X deadline`):適合找特定、精確的內容。 ### 多搜幾次 不要只靠一次搜尋。把複雜的問題拆成幾個小搜尋: - 先搜主題 - 再搜特定人員的發言 - 再搜特定頻道 ## 搜尋修飾詞參考 ### 位置篩選 - `in:channel-name` — 在特定頻道內搜尋 - `in:<#C123456>` — 用 ID 在頻道內搜尋 - `-in:channel-name` — 排除某個頻道 - `in:<@U123456>` — 搜尋和某位使用者的私訊 ### 使用者篩選 - `from:<@U123456>` — 特定使用者(用 ID)發的訊息 - `from:username` — 某位使用者(用 Slack 使用者名稱)發的訊息 - `to:me` — 直接傳給你的訊息 ### 內容篩選 - `is:thread` — 只找討論串內的訊息 - `has:pin` — 已釘選的訊息 - `has:link` — 含連結的訊息 - `has:file` — 含檔案附件的訊息 - `has::emoji:` — 有特定表情反應的訊息 ### 日期篩選 - `before:YYYY-MM-DD` — 某日期之前的訊息 - `after:YYYY-MM-DD` — 某日期之後的訊息 - `on:YYYY-MM-DD` — 特定日期的訊息 - `during:month` — 特定月份的訊息(例如 `during:january`) ### 文字比對 - `"exact phrase"` — 比對精確片語 - `-word` — 排除含某個字的訊息 - `wild*` — 萬用字元比對(`*` 前面至少要 3 個字元) ## 檔案搜尋 搜尋檔案時,用 `content_types="files"` 參數加上類型篩選: - `type:images` — 圖片檔 - `type:documents` — 文件檔 - `type:pdfs` — PDF 檔 - `type:spreadsheets` — 試算表檔 - `type:canvases` — Slack Canvases 範例:`content_types="files" type:pdfs budget after:2025-01-01` ## 追蹤搜尋結果 找到相關訊息之後: - 用 `slack_read_thread` 取得任何討論串訊息的完整脈絡。 - 用 `slack_read_channel` 搭配 `oldest`/`latest` 時間戳,讀取前後的訊息來補脈絡。 - 結果裡出現使用者 ID 時,用 `slack_read_user_profile` 查那個人是誰。 ## 常見陷阱 - **布林運算子沒用。** 不支援 `AND`、`OR`、`NOT`。用空格(隱含 AND)和 `-` 來排除。 - **括號沒用。** 不要想用 `()` 把搜尋詞分組。 - **搜尋不是即時的。** 最新的訊息(最近幾秒內)可能不會出現在搜尋結果裡。要看最新訊息就用 `slack_read_channel`。 - **私人頻道的存取。** 需要包含私人頻道時用 `slack_search_public_and_private`,但注意這需要使用者同意。
英文原文
--- name: slack-search description: Guidance for effectively searching Slack to find messages, files, channels, and people --- # Slack Search This skill provides guidance for effectively searching Slack to find messages, files, and information. ## When to Use Apply this skill whenever you need to find information in Slack — including when a user asks you to locate messages, conversations, files, or people, or when you need to gather context before answering a question about what's happening in Slack. ## Search Tools Overview | Tool | Use When | |------|----------| | `slack_search_public` | Searching public channels only. Does not require user consent. | | `slack_search_public_and_private` | Searching all channels including private, DMs, and group DMs. Requires user consent. | | `slack_search_channels` | Finding channels by name or description. | | `slack_search_users` | Finding people by name, email, or role. | ## Search Strategy ### Start Broad, Then Narrow 1. Begin with a simple keyword or natural language question. 2. If too many results, add filters (`in:`, `from:`, date ranges). 3. If too few results, remove filters and try synonyms or related terms. ### Choose the Right Search Mode - **Natural language questions** (e.g., "What is the deadline for project X?") — Best for fuzzy, conceptual searches where you don't know exact keywords. - **Keyword search** (e.g., `project X deadline`) — Best for finding specific, exact content. ### Use Multiple Searches Don't rely on a single search. Break complex questions into smaller searches: - Search for the topic first - Then search for specific people's contributions - Then search in specific channels ## Search Modifiers Reference ### Location Filters - `in:channel-name` — Search within a specific channel - `in:<#C123456>` — Search in channel by ID - `-in:channel-name` — Exclude a channel - `in:<@U123456>` — Search in DMs with a user ### User Filters - `from:<@U123456>` — Messages from a specific user (by ID) - `from:username` — Messages from a user (by Slack username) - `to:me` — Messages sent directly to you ### Content Filters - `is:thread` — Only threaded messages - `has:pin` — Pinned messages - `has:link` — Messages containing links - `has:file` — Messages with file attachments - `has::emoji:` — Messages with a specific reaction ### Date Filters - `before:YYYY-MM-DD` — Messages before a date - `after:YYYY-MM-DD` — Messages after a date - `on:YYYY-MM-DD` — Messages on a specific date - `during:month` — Messages during a specific month (e.g., `during:january`) ### Text Matching - `"exact phrase"` — Match an exact phrase - `-word` — Exclude messages containing a word - `wild*` — Wildcard matching (minimum 3 characters before `*`) ## File Search To search for files, use the `content_types="files"` parameter with type filters: - `type:images` — Image files - `type:documents` — Document files - `type:pdfs` — PDF files - `type:spreadsheets` — Spreadsheet files - `type:canvases` — Slack Canvases Example: `content_types="files" type:pdfs budget after:2025-01-01` ## Following Up on Results After finding relevant messages: - Use `slack_read_thread` to get the full thread context for any threaded message. - Use `slack_read_channel` with `oldest`/`latest` timestamps to read surrounding messages for context. - Use `slack_read_user_profile` to identify who a user is when their ID appears in results. ## Common Pitfalls - **Boolean operators don't work.** `AND`, `OR`, `NOT` are not supported. Use spaces (implicit AND) and `-` for exclusion. - **Parentheses don't work.** Don't try to group search terms with `()`. - **Search is not real-time.** Very recent messages (last few seconds) may not appear in search results. Use `slack_read_channel` for the most recent messages. - **Private channel access.** Use `slack_search_public_and_private` when you need to include private channels, but note this requires user consent.