Community编程与开发github.com

数据分析

当用户上传Excel(.xlsx/.xls)或CSV文件并希望执行数据分析、生成统计、创建摘要、透视表、SQL查询或任何形式的结构化数据探索时使用。支持多工作表Excel工作簿、聚合、过滤、连接以及将结果导出为CSV/JSON/Markdown格式。

数据分析 是什么?

此技能利用DuckDB(一种嵌入式分析型SQL引擎)分析用户上传的Excel/CSV文件。它支持模式检查、基于SQL的查询、统计摘要和结果导出。用户可以通过一个Python脚本轻松检查数据结构、执行任意SQL查询、生成统计摘要(包括均值、中位数、标准差、百分位数和空值计数),并将结果导出为CSV、JSON或Markdown格式。该技能特别适合数据探索、清洗和初步分析,能高效处理大型文件并支持多工作表Excel工作簿(每个工作表成为一个表)以及跨文件连接。它提供了完整的分析工作流:理解需求、检查文件结构、执行分析并呈现结果。脚本会自动缓存数据以避免重复解析,加快后续查询速度。

兼容平台~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.

相关技能