Community程式設計與開發github.com

資料分析

當使用者上傳 Excel (.xlsx/.xls) 或 CSV 檔案,並希望進行資料分析、產生統計數據、建立摘要、樞紐分析表、SQL 查詢或任何形式的結構化資料探索時,使用此技能。支援多工作表 Excel 活頁簿、彙總、篩選、合併,以及將結果匯出為 CSV/JSON/Markdown 格式。

資料分析 是什麼?

此技能利用 DuckDB(一個內嵌式分析型 SQL 引擎)來分析使用者上傳的 Excel/CSV 檔案。它透過單一 Python 腳本提供結構檢查、SQL 查詢、統計摘要與結果匯出等功能。使用者可以檢查檔案結構(工作表、欄位、型別、筆數),對上傳的資料執行任意 SQL 查詢,並取得數值欄位的平均值、中位數、標準差、百分位數等統計數據。此技能支援多工作表的 Excel 活頁簿(每個工作表會變成一個資料表),並允許跨檔案合併(JOIN)。查詢結果可以匯出為 CSV、JSON 或 Markdown 表格。此外,腳本會自動快取載入的資料,當對相同檔案執行多個查詢時,可避免重複解析檔案,實現近乎即時的啟動。此技能適用於 Claude Code、Cursor 等支援自訂技能的 AI 代理平台。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/bytedance/deer-flow/tree/main/skills/public/data-analysis

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

資料分析技能

概述

此技能使用 DuckDB(一個內嵌式分析型 SQL 引擎)分析使用者上傳的 Excel/CSV 檔案。它支援結構檢查、SQL 查詢、統計摘要與結果匯出,全部透過單一 Python 腳本完成。

核心功能

  • 檢查 Excel/CSV 檔案結構(工作表、欄位、型別、筆數)
  • 對上傳的資料執行任意 SQL 查詢
  • 產生統計摘要(平均值、中位數、標準差、百分位數、空值數)
  • 支援多工作表 Excel 活頁簿(每個工作表變成一個資料表)
  • 將查詢結果匯出為 CSV、JSON 或 Markdown
  • 利用 DuckDB 的欄位式引擎高效處理大型檔案

工作流程

步驟 1:了解需求

當使用者上傳資料檔案並要求分析時,請確認:

  • 檔案位置:上傳的 Excel/CSV 檔案在 /mnt/user-data/uploads/ 下的路徑
  • 分析目標:使用者想要獲取哪些洞察(摘要、篩選、彙總、比較等)
  • 輸出格式:結果應如何呈現(表格、CSV 匯出、JSON 等)
  • 你不需要檢查 /mnt/user-data 下的資料夾

步驟 2:檢查檔案結構

首先,檢查上傳的檔案以了解其結構:

python /mnt/skills/public/data-analysis/scripts/analyze.py \
  --files /mnt/user-data/uploads/data.xlsx \
  --action inspect

這會回傳:

  • 工作表名稱(Excel)或檔案名稱(CSV)
  • 欄位名稱、資料型別與非空值數量
  • 每個工作表/檔案的筆數
  • 範例資料(前 5 行)

步驟 3:執行分析

根據結構,建構 SQL 查詢來回答使用者的問題。

執行 SQL 查詢

python /mnt/skills/public/data-analysis/scripts/analyze.py \
  --files /mnt/user-data/uploads/data.xlsx \
  --action query \
  --sql "SELECT category, COUNT(*) as count, AVG(amount) as avg_amount FROM Sheet1 GROUP BY category ORDER BY count DESC"

產生統計摘要

python /mnt/skills/public/data-analysis/scripts/analyze.py \
  --files /mnt/user-data/uploads/data.xlsx \
  --action summary \
  --table Sheet1

這會對每個數值欄位回傳:數量、平均值、標準差、最小值、25%、50%、75%、最大值、空值數。 對字串欄位回傳:數量、不重複值、最常見值、頻率、空值數。

匯出結果

python /mnt/skills/public/data-analysis/scripts/analyze.py \
  --files /mnt/user-data/uploads/data.xlsx \
  --action query \
  --sql "SELECT * FROM Sheet1 WHERE amount > 1000" \
  --output-file /mnt/user-data/outputs/filtered-results.csv

支援的輸出格式(根據副檔名自動判斷):

  • .csv — 逗號分隔值
  • .json — JSON 物件陣列
  • .md — Markdown 表格

參數

參數必要說明
--files是Excel/CSV 檔案路徑(空格分隔)
--action是可為:inspect、query、summary
--sql用於 query要執行的 SQL 查詢
--table用於 summary要摘要的工作表/資料表名稱
--output-file否匯出結果的路徑(CSV/JSON/MD)

[!NOTE] 請勿讀取 Python 檔案,只需以參數呼叫即可。

資料表命名規則

  • Excel 檔案:每個工作表變成一個以工作表名稱命名的資料表(例如 Sheet1、Sales、Revenue)
  • CSV 檔案:資料表名稱為不含副檔名的檔案名稱(例如 data.csv → data)
  • 多個檔案:所有檔案的所有資料表都在同一個查詢上下文中可用,支援跨檔案合併
  • 特殊字元:含有空格或特殊字元的工作表/檔案名稱會自動清理(空格 → 底線)。對於以數字開頭或包含特殊字元的名稱,請使用雙引號,例如 "2024_Sales"

分析模式

基本探索

-- 筆數
SELECT COUNT(*) FROM Sheet1

-- 欄位中的不重複值
SELECT DISTINCT category FROM Sheet1

-- 數值分佈
SELECT category, COUNT(*) as cnt FROM Sheet1 GROUP BY category ORDER BY cnt DESC

-- 日期範圍
SELECT MIN(date_col), MAX(date_col) FROM Sheet1

彙總與分組

-- 按類別與月份的營收
SELECT category, DATE_TRUNC('month', order_date) as month,
       SUM(revenue) as total_revenue
FROM Sales
GROUP BY category, month
ORDER BY month, total_revenue DESC

-- 消費金額最高的前 10 名客戶
SELECT customer_name, SUM(amount) as total_spend
FROM Orders GROUP BY customer_name
ORDER BY total_spend DESC LIMIT 10

跨檔案合併

-- 合併來自不同檔案的銷售資料與客戶資訊
SELECT s.order_id, s.amount, c.customer_name, c.region
FROM sales s
JOIN customers c ON s.customer_id = c.id
WHERE s.amount > 500

視窗函數

-- 累計總和與排名
SELECT order_date, amount,
       SUM(amount) OVER (ORDER BY order_date) as running_total,
       RANK() OVER (ORDER BY amount DESC) as amount_rank
FROM Sales

樞紐分析

-- 樞紐:各類別的每月營收
SELECT category,
       SUM(CASE WHEN MONTH(date) = 1 THEN revenue END) as Jan,
       SUM(CASE WHEN MONTH(date) = 2 THEN revenue END) as Feb,
       SUM(CASE WHEN MONTH(date) = 3 THEN revenue END) as Mar
FROM Sales
GROUP BY category

完整範例

使用者上傳 sales_2024.xlsx(包含工作表:Orders、Products、Customers)並要求:「分析我的銷售資料 — 顯示營收最高的產品以及每月趨勢。」

步驟 1:檢查檔案

python /mnt/skills/public/data-analysis/scripts/analyze.py \
  --files /mnt/user-data/uploads/sales_2024.xlsx \
  --action inspect

步驟 2:營收最高的產品

python /mnt/skills/public/data-analysis/scripts/analyze.py \
  --files /mnt/user-data/uploads/sales_2024.xlsx \
  --action query \
  --sql "SELECT p.product_name, SUM(o.quantity * o.unit_price) as total_revenue, SUM(o.quantity) as total_units FROM Orders o JOIN Products p ON o.product_id = p.id GROUP BY p.product_name ORDER BY total_revenue DESC LIMIT 10"

步驟 3:每月營收趨勢

python /mnt/skills/public/data-analysis/scripts/analyze.py \
  --files /mnt/user-data/uploads/sales_2024.xlsx \
  --action query \
  --sql "SELECT DATE_TRUNC('month', order_date) as month, SUM(quantity * unit_price) as revenue FROM Orders GROUP BY month ORDER BY month" \
  --output-file /mnt/user-data/outputs/monthly-trends.csv

步驟 4:統計摘要

python /mnt/skills/public/data-analysis/scripts/analyze.py \
  --files /mnt/user-data/uploads/sales_2024.xlsx \
  --action summary \
  --table Orders

向使用者呈現結果,並附上清楚的發現說明、趨勢以及可行的洞察。

多檔案範例

使用者上傳 orders.csv 與 customers.xlsx,並要求:「哪個地區的平均訂單金額最高?」

python /mnt/skills/public/data-analysis/scripts/analyze.py \
  --files /mnt/user-data/uploads/orders.csv /mnt/user-data/uploads/customers.xlsx \
  --action query \
  --sql "SELECT c.region, AVG(o.amount) as avg_order_value, COUNT(*) as order_count FROM orders o JOIN Customers c ON o.customer_id = c.id GROUP BY c.region ORDER BY avg_order_value DESC"

輸出處理

分析完成後:

  • 直接在對話中以格式化表格呈現查詢結果
  • 對於大量結果,匯出至檔案並使用 present_files 工具分享
  • 務必用白話解釋發現,並提供關鍵要點
  • 當模式有趣時,建議後續分析
  • 如果使用者想保留結果,主動提供匯出選項

快取

腳本會自動快取已載入的資料,避免每次呼叫都重新解析檔案:

  • 首次載入時,檔案會被解析並儲存至 /mnt/user-data/workspace/.data-analysis-cache/ 下的持久化 DuckDB 資料庫中
  • 快取鍵是所有輸入檔案內容的 SHA256 雜湊值 — 如果檔案變更,就會建立新的快取
  • 對相同檔案的後續呼叫將直接使用快取的資料庫(近乎即時啟動)
  • 快取是透明的 — 不需要額外參數

這在對相同資料檔案執行多個查詢(檢查 → 查詢 → 摘要)時特別有用。

注意事項

  • DuckDB 支援完整的 SQL,包括視窗函數、CTE、子查詢與進階彙總
  • Excel 日期欄位會自動解析;請使用 DuckDB 的日期函數(DATE_TRUNC、EXTRACT 等)
  • 對於非常大的檔案(100MB 以上),DuckDB 可高效處理,無需將所有資料載入記憶體
  • 包含空格的欄位名稱可使用雙引號存取:"Column Name"

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

academic-paper-review

Use this skill when the user requests to review, analyze, critique, or summarize academic papers, research articles, preprints, or scientific publications. Supports comprehensive structured reviews covering methodology assessment, contribution evaluation, literature positioning, and constructive feedback generation. Trigger on queries involving paper URLs, uploaded PDFs, arXiv links, or requests like "review this paper", "analyze this research", "summarize this study", or "write a peer review".

bootstrap

Generate a personalized SOUL.md through a warm, adaptive onboarding conversation. Trigger when the user wants to create, set up, or initialize their AI partner's identity — e.g., "create my SOUL.md", "bootstrap my agent", "set up my AI partner", "define who you are", "let's do onboarding", "personalize this AI", "make you mine", or when a SOUL.md is missing. Also trigger for updates: "update my SOUL.md", "change my AI's personality", "tweak the soul".

bytedance/academic-paper-review

Use this skill when the user requests to review, analyze, critique, or summarize academic papers, research articles, preprints, or scientific publications. Supports comprehensive structured reviews covering methodology assessment, contribution evaluation, literature positioning, and constructive feedback generation. Trigger on queries involving paper URLs, uploaded PDFs, arXiv links, or requests like "review this paper", "analyze this research", "summarize this study", or "write a peer review".

bytedance/chart-visualization

This skill should be used when the user wants to visualize data. It intelligently selects the most suitable chart type from 26 available options, extracts parameters based on detailed specifications, and generates a chart image using a JavaScript script.

bytedance/claude-to-deerflow

Interact with DeerFlow AI agent platform via its HTTP API. Use this skill when the user wants to send messages or questions to DeerFlow for research/analysis, start a DeerFlow conversation thread, check DeerFlow status or health, list available models/skills/agents in DeerFlow, manage DeerFlow memory, upload files to DeerFlow threads, or delegate complex research tasks to DeerFlow. Also use when the user mentions deerflow, deer flow, or wants to run a deep research task that DeerFlow can handle.

bytedance/consulting-analysis

Use this skill when the user requests to generate, create, or write professional research reports including but not limited to market analysis, consumer insights, brand analysis, financial analysis, industry research, competitive intelligence, investment due diligence, or any consulting-grade analytical report. This skill operates in two phases — (1) generating a structured analysis framework with chapter skeleton, data query requirements, and analysis logic, and (2) after data collection by other skills, producing the final consulting-grade report with structured narratives, embedded charts, and strategic insights.

bytedance/data-analysis

Use this skill when the user uploads Excel (.xlsx/.xls) or CSV files and wants to perform data analysis, generate statistics, create summaries, pivot tables, SQL queries, or any form of structured data exploration. Supports multi-sheet Excel workbooks, aggregation, filtering, joins, and exporting results to CSV/JSON/Markdown.

bytedance/deep-research

Use this skill instead of WebSearch for ANY question requiring web research. Trigger on queries like "what is X", "explain X", "compare X and Y", "research X", or before content generation tasks. Provides systematic multi-angle research methodology instead of single superficial searches. Use this proactively when the user's question needs online information.

bytedance/find-skills

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

bytedance/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.

bytedance/github-deep-research

Conduct multi-round deep research on any GitHub Repo. Use when users request comprehensive analysis, timeline reconstruction, competitive analysis, or in-depth investigation of GitHub. Produces structured markdown reports with executive summaries, chronological timelines, metrics analysis, and Mermaid diagrams. Triggers on Github repository URL or open source projects.

bytedance/image-generation

Use this skill when the user requests to generate, create, imagine, or visualize images including characters, scenes, products, or any visual content. Supports structured prompts and reference images for guided generation.

bytedance/podcast-generation

Use this skill when the user requests to generate, create, or produce podcasts from text content. Converts written content into a two-host conversational podcast audio format with natural dialogue.

bytedance/ppt-generation

Use this skill when the user requests to generate, create, or make presentations (PPT/PPTX). Creates visually rich slides by generating images for each slide and composing them into a PowerPoint file.

bytedance/skill-creator

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

bytedance/surprise-me

Create a delightful, unexpected "wow" experience for the user by dynamically discovering and creatively combining other enabled skills. Triggers when the user says "surprise me" or any request expressing a desire for an unexpected creative showcase. Also triggers when the user is bored, wants inspiration, or asks for "something interesting".

bytedance/vercel-deploy

Deploy applications and websites to Vercel. Use this skill when the user requests deployment actions such as "Deploy my app", "Deploy this to production", "Create a preview deployment", "Deploy and give me the link", or "Push this live". No authentication required - returns preview URL and claimable deployment link.

bytedance/video-generation

Use this skill when the user requests to generate, create, or imagine videos. Supports structured prompts and reference image for guided generation.

bytedance/web-design-guidelines

Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

chart-visualization

This skill should be used when the user wants to visualize data. It intelligently selects the most suitable chart type from 26 available options, extracts parameters based on detailed specifications, and generates a chart image using a JavaScript script.

相關技能