Workflow
When this skill triggers, follow these steps in order.
Step 1 — Locate the CSV
Check whether the user has provided a CSV path.
- If a path is provided, confirm the file exists and has a header row.
- If no path is provided, ask: "Please provide the path to your CSV file. See
resources/sales.csvfor a working example with columns: order_id, region, product, units, revenue, date." - The engine works with any CSV that has no quoted commas — simple comma-separated values only.
Step 2 — Clarify the question
Check whether the user has asked a question.
- If a question is provided, confirm it maps to a supported pattern (see list below).
- If no question is provided, ask what they want to know about the data.
Step 3 — Run the analysis engine
Execute from the skill root:
node scripts/ask.mjs <path-to-csv> "<question>"
The engine exits 0 on success (including "unsupported" responses) and exits 1 only on file/input errors. Capture stdout. If the process exits non-zero, surface the stderr message.
Step 4 — Present the answer
The engine outputs a Markdown block containing:
- The question (echoed)
- The detected intent
- The computed answer
- A supporting table (for top-N and group-by questions)
Present this output directly. For numeric answers, note the units (e.g. USD, count).
Step 5 — Offer follow-up analysis
After presenting the answer, offer one or two follow-up questions the user might ask based on the result. For example:
- After a group-by: "Would you like to see the top N within a specific group?"
- After a total: "Would you like to break that down by region or product?"
Supported question patterns
The engine handles a deterministic subset of natural-language data questions. Use the engine for these; compute directly for anything else.
| Pattern | Example |
|---|---|
| Row count | "How many rows?" |
| Filtered count | "How many rows where region is West?" |
| Sum of a column | "What is the total revenue?" |
| Average of a column | "What is the average units?" |
| Max of a column | "What is the highest revenue?" |
| Min of a column | "What is the lowest units?" |
| Top N by a column | "Show me the top 5 by revenue" |
| Group-by aggregation | "sum of revenue by region" |
If the question does not match any pattern or references an unknown column, the engine returns a clear "I can't answer that" message (exit 0) — this is not an error.
Example
See examples/input.md for the dataset and example questions, and examples/output.md for the engine's output.
Run the example yourself from the skill root:
cd skills/menza-data-analyst
bash examples/run.sh