← 返回 Skills 市场
theshadowrose

Csv Brain

作者 Shadow Rose · GitHub ↗ · v1.0.3 · MIT-0
cross-platform ✓ 安全检测通过
321
总下载
0
收藏
2
当前安装
4
版本数
在 OpenClaw 中安装
/install csv-brain
功能描述
Load CSV files and ask questions in plain English. AI-powered natural language queries via Anthropic, OpenAI, or local Ollama. No SQL required.
使用说明 (SKILL.md)

CSVBrain

Version: 1.0.3 Author: @TheShadowRose License: MIT

Description

Load CSV files and ask questions in plain English. AI-powered natural language queries via Anthropic, OpenAI, or local Ollama. No SQL required.

CSVBrain parses CSV files (comma, semicolon, or tab-delimited), profiles your data automatically, and lets you query it with structured filters or plain English questions powered by AI.

Features

  • CSV Loading — Parse CSV files with automatic delimiter detection (comma, semicolon, tab). Handles quoted fields and escaped quotes.
  • Data Profiling — Instant statistics for every column: count, missing values, unique values, min/max/avg for numeric columns.
  • Structured Queries — Filter, sort, limit, and aggregate your data programmatically.
  • Natural Language Ask — Ask questions about your data in plain English. AI analyzes your dataset's structure, types, and statistics to give accurate answers with specific numbers.
  • Multi-Provider AI — Route questions to Anthropic (Claude), OpenAI (GPT), or local Ollama models. Just change the model prefix.
  • Zero Dependencies — Pure Node.js. No npm packages required. HTTP calls use built-in https/http modules.

Installation

Copy src/csv-brain.js into your project.

const { CSVBrain } = require('./src/csv-brain');

Quick Start

const { CSVBrain } = require('./src/csv-brain');

const brain = new CSVBrain();
const info = brain.load('sales.csv');
console.log(info);
// { rows: 1200, columns: 8, types: { month: 'text', revenue: 'number', ... } }

// Profile your data
const stats = brain.profile();
console.log(stats.revenue);
// { type: 'number', count: 1200, missing: 0, unique: 987, min: 12.5, max: 94200, avg: 8450.32 }

// Ask a question in plain English
const result = await brain.ask('What was our best month for revenue?');
console.log(result.answer);
// "Based on the data, March had the highest total revenue at $94,200."
console.log(result.model);
// "anthropic/claude-haiku-4-5"

API

new CSVBrain(options?)

Create a new instance.

Option Type Default Description
model string "anthropic/claude-haiku-4-5" Default AI model for ask()
const brain = new CSVBrain({ model: 'openai/gpt-4o-mini' });

load(filePath, options?)

Load a CSV file synchronously.

Option Type Default Description
delimiter string auto-detect Force a specific delimiter

Returns: { rows: number, columns: number, types: object }

const info = brain.load('data.csv');
const info2 = brain.load('data.tsv', { delimiter: '	' });

profile()

Get statistical profile of all columns.

Returns: Object keyed by column name, each with type, count, missing, unique, and (for numeric columns) min, max, avg.

const stats = brain.profile();
console.log(stats);

query(options)

Run a structured query against loaded data.

Option Type Description
filter { column, operator, value } Filter rows. Operators: >, \x3C, >=, \x3C=, =, contains
sort { column, order } Sort by column. Order: "asc" or "desc"
limit number Maximum rows to return
aggregate { column } Return count, sum, avg, min, max for a numeric column
// Filter and sort
const topSales = brain.query({
  filter: { column: 'revenue', operator: '>', value: 10000 },
  sort: { column: 'revenue', order: 'desc' },
  limit: 10
});

// Aggregate
const totals = brain.query({
  aggregate: { column: 'revenue' }
});
console.log(totals);
// { count: 1200, sum: 10140384, avg: 8450.32, min: 12.5, max: 94200 }

async ask(question, options?)

Ask a natural language question about your data. Requires an AI provider API key (or local Ollama).

Option Type Default Description
model string Instance default AI model with provider prefix
apiKey string From environment Override the API key
ollamaHost string "http://localhost:11434" Ollama server URL

Returns: { answer: string, data: any, query: object|null, model: string }

// Using Anthropic (default)
// Requires ANTHROPIC_API_KEY environment variable
const result = await brain.ask('Which product category has the highest average price?');
console.log(result.answer);
// "Electronics has the highest average price at $342.50, followed by Appliances at $289.00."

// Using OpenAI
// Requires OPENAI_API_KEY environment variable
const result2 = await brain.ask('How many orders were placed in Q4?', {
  model: 'openai/gpt-4o-mini'
});

// Using local Ollama (no API key needed)
const result3 = await brain.ask('Summarize the sales trends', {
  model: 'ollama/llama3'
});

AI Provider Setup

Anthropic (Claude)

Set your API key as an environment variable:

export ANTHROPIC_API_KEY="sk-ant-..."

Models: anthropic/claude-haiku-4-5, anthropic/claude-sonnet-4-20250514, etc.

OpenAI (GPT)

export OPENAI_API_KEY="sk-..."

Models: openai/gpt-4o-mini, openai/gpt-4o, etc.

Ollama (Local)

No API key required. Just run Ollama locally:

ollama serve
ollama pull llama3

Models: ollama/llama3, ollama/mistral, etc.

Optionally set a custom host:

export OLLAMA_HOST="http://192.168.1.100:11434"

Error Handling

If the AI provider is unavailable, ask() returns a graceful error instead of throwing:

const result = await brain.ask('What is the trend?');
if (result.answer.startsWith('AI unavailable:')) {
  console.log('Falling back to manual query...');
  const data = brain.query({ sort: { column: 'date', order: 'asc' } });
}

Supported File Formats

  • CSV — Comma-separated values (.csv)
  • TSV — Tab-separated values (.tsv, .txt)
  • Semicolon-delimited — Common in European locale exports

Delimiter is auto-detected from the first line, or can be specified manually.

Note: Excel files (.xlsx, .xls) are not supported. Export your spreadsheet to CSV first.

Limitations

  • Files are loaded synchronously and fully into memory. Very large files (100MB+) may cause performance issues.
  • AI answers depend on the quality and context window of the chosen model. Only column profiles and the first 5 sample rows are sent to the AI — not the entire dataset.
  • No streaming support. The full AI response is returned at once.
  • No built-in export functionality. Use query() results with your own file-writing logic.

Disclaimer

CSVBrain is provided as-is under the MIT License. AI-generated answers may not always be accurate — always verify critical data analysis. API usage may incur costs from your AI provider.

Support

安全使用建议
This skill appears to be what it claims: a local CSV parser and an LLM-backed query helper. Important things to consider before installing or using it: (1) If you call ask() with Anthropic/OpenAI, the skill sends column statistics and up to the first five rows to the remote provider — don't use it with sensitive data unless you accept that transmission. (2) API keys are optional but required to use remote providers; treat them as secrets. (3) The code reads any file path you pass to load(), so ensure you only load intended CSVs (it will read files the running process can access). (4) There are no external downloads in the install, but you should still inspect the full src/csv-brain.js (including helper methods not shown in the truncated snippet) to confirm there are no unexpected network calls or hard-coded endpoints beyond the documented providers. (5) If you need to avoid sending data off-host, prefer a local Ollama server (OLLAMA_HOST) or run without setting remote API keys.
功能分析
Type: OpenClaw Skill Name: csv-brain Version: 1.0.3 The CSVBrain skill is a utility for performing natural language queries on CSV data using AI providers like Anthropic, OpenAI, or local Ollama instances. The implementation in `src/csv-brain.js` is a clean, dependency-free Node.js class that handles CSV parsing, data profiling, and API communication using standard environment variables for authentication. While the `README.md` mentions features not yet implemented in the provided code (such as Excel support and data streaming), the core logic is transparent, lacks malicious intent, and only transmits limited data (metadata and a 5-row sample) to the user-configured AI endpoints.
能力评估
Purpose & Capability
Name/description match the implementation: src/csv-brain.js parses CSVs, profiles columns, runs structured queries, and forwards natural-language questions to Anthropic, OpenAI, or a local Ollama. The optional environment variables in SKILL.md (ANTHROPIC_API_KEY, OPENAI_API_KEY, OLLAMA_HOST) are exactly what's needed to contact those providers. No unrelated credentials, binaries, or install steps are requested.
Instruction Scope
The runtime instructions and code are within scope for a CSV-querying skill, but the ask() implementation builds a system prompt that includes column profiles and up to the first five rows and then sends that to the chosen provider. That means using remote Anthropic/OpenAI will transmit dataset summaries and sample rows to those external services — expected for this feature, but a potential data-exfiltration/privacy risk for sensitive files.
Install Mechanism
No install spec is present (instruction-only with a source file). There are no downloads or package installs; user is instructed to copy src/csv-brain.js into their project. This is low-risk from an installation perspective.
Credentials
No required environment variables are declared; the SKILL.md documents optional provider keys which are proportionate to the stated multi-provider feature. The skill reads only the documented env vars (ANTHROPIC_API_KEY, OPENAI_API_KEY, OLLAMA_HOST) to contact model APIs. These keys are sensitive — they must be provided by the user and are not required unless remote models are used.
Persistence & Privilege
The skill is user-invocable, not always-enabled, and does not request persistent or elevated agent/system privileges. It does file I/O (reads whatever file path you supply), which is necessary for a CSV loader; it does not attempt to modify other skills or global agent config.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install csv-brain
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /csv-brain 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.3
- Bump version to 1.0.3. - No functional changes; documentation version updated in SKILL.md.
v1.0.2
**CSVBrain 1.0.2 Changelog** - Added support for AI-powered natural language queries via Anthropic (Claude), OpenAI (GPT), and local Ollama models. - Introduced environment variable options for multiple AI providers (ANTHROPIC_API_KEY, OPENAI_API_KEY, OLLAMA_HOST). - Expanded documentation with detailed API, usage examples, configuration, and provider setup instructions. - Clarified feature set, supported formats, limitations, and error handling. - Changed description, version, tags, and feature list to reflect expanded AI and data profiling capabilities.
v1.0.1
- Fixed a character encoding issue in the skill name ("CSVBrain Natural Language Data Queries"). - Updated version number from 1.0.0 to 1.0.1 in documentation. - No functional changes; documentation clarity improved.
v1.0.0
Initial upload
元数据
Slug csv-brain
版本 1.0.3
许可证 MIT-0
累计安装 2
当前安装数 2
历史版本数 4
常见问题

Csv Brain 是什么?

Load CSV files and ask questions in plain English. AI-powered natural language queries via Anthropic, OpenAI, or local Ollama. No SQL required. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 321 次。

如何安装 Csv Brain?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install csv-brain」即可一键安装,无需额外配置。

Csv Brain 是免费的吗?

是的,Csv Brain 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Csv Brain 支持哪些平台?

Csv Brain 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Csv Brain?

由 Shadow Rose(@theshadowrose)开发并维护,当前版本 v1.0.3。

💬 留言讨论