Skip to content
cccskills
FreePublished on GitHub

data-analysis

Analyze Excel and CSV files to summarize statistics, filter records, compare groups, and join data across sheets or files. Export results as CSV, JSON, or Markdown tables for further work or sharing.

OriginalShow the original description

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.

Works withExcel
See how to install

Good for

  • Compare monthly sales and top-selling products
  • Combine order records with customer data
  • Check missing values and statistical summaries
  • Export filtered records as CSV

Files included (3)

  • SKILL.md9.8 KB
  • AGENTS.md1.5 KB
  • scripts/analyze.py20.1 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Data Analysis Skill

Overview

This skill analyzes user-uploaded Excel/CSV files using DuckDB — an in-process analytical SQL engine. It supports schema inspection, SQL-based querying, statistical summaries, and result export, all through a single Python script.

Environment setup

Prepare the Python environment before running analyses. Install the required packages explicitly using the same interpreter that will run the script:

python -m pip install duckdb openpyxl

If either package is missing, the script exits with a setup instruction; it does not invoke an installer or modify the environment. DuckDB's existing spatial-extension setup for loading files is unchanged.

Core Capabilities

  • Inspect Excel/CSV file structure (sheets, columns, types, row counts)
  • Execute arbitrary SQL queries against uploaded data
  • Generate statistical summaries (mean, median, stddev, percentiles, nulls)
  • Support multi-sheet Excel workbooks (each sheet becomes a table)
  • Export query results to CSV, JSON, or Markdown
  • Handle large files efficiently with DuckDB's columnar engine

Workflow

Step 1: Understand Requirements

When a user uploads data files and requests analysis, identify:

  • File location: Path(s) to uploaded Excel/CSV files under /mnt/user-data/uploads/
  • Analysis goal: What insights the user wants (summary, filtering, aggregation, comparison, etc.)
  • Output format: How results should be presented (table, CSV export, JSON, etc.)
  • You don't need to check the folder under /mnt/user-data

Step 2: Inspect File Structure

First, inspect the uploaded file to understand its schema:

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

This returns:

  • Sheet names (for Excel) or filename (for CSV)
  • Column names, data types, and non-null counts
  • Row count per sheet/file
  • Sample data (first 5 rows)

Step 3: Perform Analysis

Based on the schema, construct SQL queries to answer the user's questions.

Run SQL Query

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"

Generate Statistical Summary

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

This returns for each numeric column: count, mean, std, min, 25%, 50%, 75%, max, null_count. For string columns: count, unique, top value, frequency, null_count.

Export Results

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

Supported output formats (auto-detected from extension):

  • .csv — Comma-separated values
  • .json — JSON array of records
  • .md — Markdown table

Parameters

ParameterRequiredDescription
--filesYesSpace-separated paths to Excel/CSV files
--actionYesOne of: inspect, query, summary
--sqlFor querySQL query to execute
--tableFor summaryTable/sheet name to summarize
--output-fileNoPath to export results (CSV/JSON/MD)

[!NOTE] Do NOT read the Python file, just call it with the parameters.

Table Naming Rules

  • Excel files: Each sheet becomes a table named after the sheet (e.g., Sheet1, Sales, Revenue)
  • CSV files: Table name is the filename without extension (e.g., data.csv → data)
  • Multiple files: All tables from all files are available in the same query context, enabling cross-file joins
  • Collisions: Repeated names (including case-only differences) receive unique SQL names in input order, such as report, report_1, report_2. This also applies to repeated Excel sheet names. Use the SQL names shown by inspect for queries and summaries. An original-name alias never overrides an earlier SQL name.
  • Special characters: Sheet/file names are sanitized into SQL names (for example, sales-2026 → sales_2026). Use the SQL names printed by inspect, or double-quote a unique original name, e.g., SELECT * FROM "sales-2026". Queries execute unchanged: string literals, column aliases, comments, and CTEs retain normal DuckDB semantics. Names containing a double quote escape it by doubling it, e.g., "net""amount"

Analysis Patterns

Basic Exploration

-- Row count
SELECT COUNT(*) FROM Sheet1

-- Distinct values in a column
SELECT DISTINCT category FROM Sheet1

-- Value distribution
SELECT category, COUNT(*) as cnt FROM Sheet1 GROUP BY category ORDER BY cnt DESC

-- Date range
SELECT MIN(date_col), MAX(date_col) FROM Sheet1

Aggregation & Grouping

-- Revenue by category and month
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

-- Top 10 customers by spend
SELECT customer_name, SUM(amount) as total_spend
FROM Orders GROUP BY customer_name
ORDER BY total_spend DESC LIMIT 10

Cross-file Joins

-- Join sales with customer info from different files
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

Window Functions

-- Running total and rank
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

Pivot-style Analysis

-- Pivot: monthly revenue by category
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

Complete Example

User uploads sales_2024.xlsx (with sheets: Orders, Products, Customers) and asks: "Analyze my sales data — show top products by revenue and monthly trends."

Step 1: Inspect the file

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

Step 2: Top products by revenue

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"

Step 3: Monthly revenue trends

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

Step 4: Statistical summary

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

Present results to the user with clear explanations of findings, trends, and actionable insights.

Multi-file Example

User uploads orders.csv and customers.xlsx and asks: "Which region has the highest average order value?"

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"

Output Handling

After analysis:

  • Present query results directly in conversation as formatted tables
  • For large results, export to file and share via present_files tool
  • Always explain findings in plain language with key takeaways
  • Suggest follow-up analyses when patterns are interesting
  • Offer to export results if the user wants to keep them

Caching

The script automatically caches loaded data to avoid re-parsing files on every call:

  • On first load, files are parsed and stored in a persistent DuckDB database under the system temporary directory (.data-analysis-cache/)
  • The cache key hashes the ordered input basenames and a separate SHA256 digest of each file. Renaming, reordering, or changing inputs creates a new cache; moving unchanged, identically named inputs to another directory preserves reuse. The updated key namespace ignores older cached table maps, which are rebuilt on first use
  • Subsequent calls with the same files will use the cached database directly (near-instant startup)
  • Cache is transparent — no extra parameters needed

This is especially useful when running multiple queries against the same data files (inspect → query → summary).

Notes

  • DuckDB supports full SQL including window functions, CTEs, subqueries, and advanced aggregations
  • Excel date columns are automatically parsed; use DuckDB date functions (DATE_TRUNC, EXTRACT, etc.)
  • For very large files (100MB+), DuckDB handles them efficiently without loading everything into memory
  • Column names with spaces are accessible using double quotes: "Column Name"

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Turn academic papers into structured reviews that explain findings, strengths, weaknesses, and research methods. Assess originality and supporting evidence, compare relevant literature, and provide specific improvement suggestions in a detailed review or brief summary.

  • Understanding a paper's findings and limitations
  • Preparing a draft peer review
  • Checking experimental design and reproducibility
bytedance/deer-flow84.1KUpdated Oct 19, 2026

Find Python input/output calls that may stall asynchronous backend work, then fix or guard each relevant path with runtime tests. Verify that tests fail when blocking behavior returns and pass after the fix is restored.

  • Checking asynchronous Python changes before a pull request
  • Triaging blocking input/output across the codebase
  • Adding tests for cleanup and error branches
bytedance/deer-flow84.1KUpdated Oct 19, 2026

bootstrap

FreeSummary

Create or update a SOUL.md file that defines an AI partner’s behavior through a guided conversation. Clarify communication style, autonomy, honesty, and expectations, then review a concise English profile before saving it with setup_agent.

  • Define an AI partner’s initial personality and role
  • Adjust tone and how the AI expresses disagreement
  • Clarify which decisions the AI can make independently
bytedance/deer-flow84.1KUpdated Oct 19, 2026

Turn data into chart images by selecting a suitable format from 26 options. Visualize trends, comparisons, distributions, flows, or relationships, then receive the image URL and the complete settings used to generate it.

  • Visualize changes over time
  • Compare categories and proportions
  • Show distributions and correlations
bytedance/deer-flow84.1KUpdated Oct 19, 2026

Send research and analysis tasks to a running DeerFlow instance through its HTTP API, an interface for exchanging requests. Retrieve responses, continue conversations, upload documents, and inspect available models, skills, agents, and service health.

  • Delegate research and analysis to DeerFlow
  • Upload documents for a conversation
  • Resume an earlier conversation
bytedance/deer-flow84.1KUpdated Oct 19, 2026

Turn source code into project documentation, from a README with installation steps and examples to API references, architecture diagrams, developer guides, and changelogs. Match the scope and comment format to the project's size and programming language.

  • Creating a README with installation steps and usage examples
  • Documenting public functions, parameters, and return values
  • Preparing architecture and contributor guides for new developers
bytedance/deer-flow84.1KUpdated Oct 19, 2026

See all skills by bytedance

Report a problem with this skill