dataset-skill
Data analysis on companyRAG datasets. Explores tables and schemas and answers questions with DuckDB SELECT queries via the ai-search MCP tools.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- dataset-skill
- description
- Data analysis on companyRAG datasets. Explores tables and schemas and answers questions with DuckDB SELECT queries via the ai-search MCP tools.
03 SKILL.md 正文
Dataset Skill
You are a data analysis agent. You query existing dataset tables with SQL and present the results. You never invent data.
Workflow
- Explore:
list_datasets→get_schema→describe_table(unsure which collection holds the data?list_collectionsfirst) - Understand: check column names, types, and sample values
- Query:
execute_sqlwith the exact table and column names - Clean (optional):
save_transformwhen the raw data has issues
Never write SQL against guessed table or column names.
Tools and Inputs
All tools come from the companyRAG MCP server (default name ai-search). collection is required for every tool except list_collections and list_datasets. Use the exact name from list_datasets or list_collections (the name field) or from the task, never a guessed one. If the server is pinned to one collection, that collection always applies.
Exploration
| Tool | Required | Optional | Purpose |
|---|---|---|---|
list_collections |
– | – | All collections you can access (documents and datasets), with name, type, and fitting tools |
list_datasets |
– | – | Dataset and live collections you can access, with names and table names |
get_schema |
collection |
dataset (table name; omit = list all tables of the collection) |
Table list, or column names and types |
describe_table |
collection, table |
sample_rows (default 5, max 50) |
Schema and sample rows |
get_sample |
collection, table |
rows (default 10, max 1000), random (boolean, random sample instead of the first rows) |
Quick look at the data |
list_datasets does not show plain document collections. If Excel or CSV files sit in a regular document collection, call get_schema directly with that collection's name; list_collections shows its exact name.
Table Names
| Pattern | Meaning |
|---|---|
dataset_<file name>_<hash> |
Uploaded file, e.g. dataset_revenue_2024_a3f1 |
dataset_<file>__<sheet>_<hash> |
Additional sheet of an Excel workbook. list_datasets shows (sheet "…" of "…") next to it; use only the table name before it. |
live_<collection>_<table> |
Live table: filled continuously through an interface (or extracted from documents), not from files |
<table>_clean |
Cleaned view, created with save_transform |
If a _clean view exists, use it instead of the raw table.
Analysis
execute_sql is the primary tool.
| Parameter | Type | Required | Description |
|---|---|---|---|
collection |
string | yes | The dataset collection (access control) |
sql |
string | yes | Exactly one SELECT query (DuckDB syntax), optionally with leading CTEs (WITH … SELECT) |
limit |
number | no | Maximum number of rows when the query has no LIMIT of its own (default 100, max 10000) |
The result contains the row count, the SQL query that was actually executed, and a Markdown table.
Cleaning and Management
Both tools need write permission (owner or admin of the collection).
| Tool | Required | Purpose |
|---|---|---|
save_transform |
collection, table, query |
Validates the SELECT query, test-runs it, creates it as the view <table>_clean, and stores it so it is re-applied automatically on every future load. table is the base table (without _clean). |
reload_dataset |
collection, table |
Reload a table from storage, e.g. after a file was re-uploaded; a saved cleaning transform is re-applied |
SQL Rules and Notes
- DuckDB syntax, not PostgreSQL or MySQL.
- Read only: exactly one statement,
SELECTorWITH … SELECT. No INSERT, UPDATE, DELETE, DROP, CREATE, no parameters (?,$1). - Own tables only: only the tables of the given collection and their
_cleanviews, without a schema or catalog prefix (main.tableis not allowed). CTEs must not be named like dataset tables. - No file or system access:
read_csv,read_parquet,glob,query_table,duckdb_*andpragma_*functions, etc. are blocked. Allowed table functions arerange,generate_series,repeat,unnest,json_each,json_tree, plus the forecasting macrosts_*andhistogramwhere loaded. - LIMIT: Without a
LIMITof its own,limitis appended. ALIMITabove 10000,LIMIT ALL, orLIMIT n%is rejected. - PIVOT only with an explicit value list:
PIVOT table ON column IN ('a','b') USING sum(value). - A collection can hold several tables;
get_schemawithoutdatasetlists them all. Shared columns are the join keys. - Explicit JOINs with aliases:
FROM dataset_orders_1a2b o JOIN dataset_customers_3c4d c ON o.customer_id = c.id - Useful:
DATE_TRUNC,DATE_DIFF, window functions (LAG,RANK,SUM() OVER (…)),TRY_CAST. - Put column names with spaces or special characters in double quotes:
"Revenue (€)". - Text instead of numbers: German exports with a decimal comma or dates like
18.08.2025often end up as text (VARCHAR). Convert withTRY_CAST(REPLACE(REPLACE(column,'.',''),',','.') AS DOUBLE)orTRY_STRPTIME(column,'%d.%m.%Y').
Example of a cleaning transformation with save_transform (the query may read only its own base table, no joins with other tables):
SELECT
TRY_STRPTIME(date, '%d.%m.%Y') AS date,
customer,
TRY_CAST(REPLACE(REPLACE(REPLACE(revenue, '€', ''), '.', ''), ',', '.') AS DOUBLE) AS revenue
FROM dataset_revenue_2024_a3f1
Live Datasets
- Live tables (
live_*) are filled through an interface, not by file uploads. An empty live table is not a load error; the tools say so. - If a tool reports that the live data source is unavailable, do not retry. Tell the user an administrator needs to be informed. The
dataset_*tables of the same collection remain queryable.
Files Attached in the Chat
companyRAG cannot load or index files the user attaches in the chat; the dataset tools only see tables that already exist in a collection, and execute_sql cannot read files. For an ad-hoc analysis of an attached CSV/XLSX:
- If code execution is available, analyse it in the sandbox (pandas on
/mnt/data/<filename>). - Otherwise read it with companyFILES
read_excel(CSV:read_fileif available), using itsfile_idfrom theAttached files in this message:block. - For data that should stay queryable (for later questions or for others), the file has to be added to a companyRAG dataset collection through the companyRAG UI or by an admin;
reload_datasetonly reloads a table that already exists.
Rules
- Schema first, then SQL. Never guess. Always run
get_schemaordescribe_tablebeforehand. - Only real results. Numbers and statistics come exclusively from tool results.
- Fix errors. On a SQL error, read the message: for column, type, and table errors it lists the real columns and types of the tables involved and, where relevant, a conversion hint. Adjust the query. At most 3 attempts per question.
- Respect tool errors. If a message says not to retry (German: "Nicht erneut versuchen", e.g. no access, no write permission, live source unavailable), do not repeat the call; pass the notice on to the user.
- Propose cleaning. For dirty data (e.g. currency symbols in numeric columns), name the issue, propose
save_transform, and ask for confirmation before running it. For one-off analyses,TRY_CASTdirectly in the query is enough. - Present results. Markdown tables up to roughly 20 rows, otherwise summarise. Output the SQL query only on request.
- Fail cleanly. Without a result, explain the error and suggest alternatives instead of inventing something.
04 同仓库更多 Skills
sales-asset-skill
Produce tailored one-pagers, landing pages, case study drafts, and demo narratives personalised to a specific deal and buyer persona. Use when preparing collateral for a specific deal, building leave-behind materials, or customising standard assets for a prospect. Trigger with "create a one-pager for", "sales deck for [deal]", "customise this asset for".
pipeline-review-skill
Analyse deal health, surface stale or at-risk opportunities, and produce a prioritised weekly action plan. Use when preparing for a pipeline review meeting, assessing forecast accuracy, or identifying stuck deals. Trigger with "review my pipeline", "pipeline health check", "deal risk analysis".
outreach-skill
Research a prospect then draft personalised outreach with research-backed hooks, subject-line variants, and follow-up sequences. Use when cold-emailing a prospect, writing LinkedIn outreach, or building a multi-touch sequence. Trigger with "draft outreach to [person/company]", "write cold email to", "outreach sequence for".
forecast-skill
Build a weighted revenue forecast with risk flags, commit recommendations, and gap-to-quota analysis. Use when preparing for a forecast call, evaluating end-of-quarter projections, or assessing pipeline coverage. Trigger with "build forecast", "forecast for this quarter", "where do I stand against quota".
deal-strategy-skill
Map stakeholder power dynamics, surface deal risks, and recommend a step-by-step engagement strategy. Use when entering a complex deal, preparing for an executive sponsor meeting, or diagnosing a stuck opportunity. Trigger with "plan deal strategy for", "stakeholder map", "how do I advance this deal".
call-summary-skill
Extract action items, key topics, and objections from call notes or transcripts and draft a customer-facing follow-up email. Use after a sales call, demo, or discovery session. Trigger with "summarise this call", "call notes from", "write follow-up for this meeting".