Export query results to various formats (CSV, JSON, Excel, Markdown tables) with proper formatting and headers. Use when saving analysis results to files. This skill provides data export utilities for multiple formats: - CSV: Comma-separated with headers, customizable delimiters - JSON: Structured data with pretty-print option - Excel: Multiple sheets, cell formatting, formulas - Markdown: Tables for documentation Triggers: "export data", "save results", "output CSV", "output JSON", "output Excel", "データ出力", "結果保存", "エクスポート"
Exports query results to CSV, JSON, Excel, and Markdown formats with proper formatting and headers.
/plugin marketplace add takemi-ohama/ai-agent-marketplace/plugin install ndf@ai-agent-marketplaceThis skill is limited to using the following tools:
scripts/export-csv.jsこのSkillは、data-analystエージェントがクエリ結果を様々な形式でエクスポートする際に使用します。CSV、JSON、Excel、Markdownテーブルなど、用途に応じた最適な形式で出力できます。
// scripts/export-csv.js を使用
node scripts/export-csv.js input.json output.csv
入力データ形式 (input.json):
[
{"id": 1, "name": "Product A", "price": 1000},
{"id": 2, "name": "Product B", "price": 2000}
]
出力 (output.csv):
id,name,price
1,Product A,1000
2,Product B,2000
// scripts/export-json.js を使用
node scripts/export-json.js input.csv output.json --pretty
オプション:
--pretty: 整形された見やすいJSON--compact: 圧縮されたJSON(デフォルト)// scripts/export-excel.js を使用
node scripts/export-excel.js input.json output.xlsx --sheets "Sheet1,Sheet2"
機能:
// scripts/export-markdown.js を使用
node scripts/export-markdown.js input.json output.md
出力例:
| id | name | price |
|----|------|-------|
| 1 | Product A | 1000 |
| 2 | Product B | 2000 |
JSON配列をCSV形式に変換します。
機能:
使用例:
# 基本的な使用
node export-csv.js data.json output.csv
# タブ区切り
node export-csv.js data.json output.tsv --delimiter="\t"
# Excel互換(BOM付き)
node export-csv.js data.json output.csv --bom
CSV/配列データをJSON形式に変換します。
機能:
使用例:
# Pretty-print
node export-json.js data.csv output.json --pretty
# 圧縮
node export-json.js data.csv output.json --compact
JSON配列をExcelファイル(.xlsx)に変換します。
機能:
使用例:
# 単一シート
node export-excel.js data.json output.xlsx
# 複数シート(各シートのデータはdata.jsonに含む)
node export-excel.js multi-sheet-data.json output.xlsx
multi-sheet-data.json の形式:
{
"Sheet1": [
{"id": 1, "name": "Item 1"}
],
"Sheet2": [
{"id": 2, "name": "Item 2"}
]
}
JSON配列をMarkdownテーブルに変換します。
機能:
使用例:
node export-markdown.js data.json output.md
// クエリ実行(BigQuery MCP使用)
const results = await bigquery.query("SELECT * FROM dataset.table LIMIT 1000");
// CSVに変換
const fs = require('fs');
const exportCSV = require('./scripts/export-csv.js');
exportCSV(results, 'query-results.csv');
console.log('✅ CSVにエクスポート完了: query-results.csv');
// 複数の分析結果を取得
const salesData = await bigquery.query("SELECT * FROM sales");
const productData = await bigquery.query("SELECT * FROM products");
// 複数シートでExcel出力
const data = {
"Sales": salesData,
"Products": productData
};
exportExcel(data, 'monthly-report.xlsx');
console.log('✅ Excelレポート作成完了: monthly-report.xlsx');
// クエリ結果を取得
const topProducts = await bigquery.query("SELECT name, sales FROM products ORDER BY sales DESC LIMIT 10");
// Markdownテーブルに変換
const markdown = exportMarkdown(topProducts);
// README.mdに挿入
const readme = fs.readFileSync('README.md', 'utf-8');
const updatedReadme = readme.replace('<!-- TOP_PRODUCTS -->', markdown);
fs.writeFileSync('README.md', updatedReadme);
console.log('✅ README.mdにテーブルを挿入しました');
✅ 適切な形式を選択: CSV(単純データ)、Excel(複雑なレポート)、JSON(API連携) ✅ ヘッダーを含める: データの意味を明確に ✅ 大きなデータはストリーミング: メモリ効率のため ✅ UTF-8 BOMを付与: Excel互換性のため(CSV) ✅ エラーハンドリング: ファイル書き込みエラーに対処
❌ 全データをメモリに展開: 大量データは分割処理 ❌ Excel形式で巨大データ: 1048576行の制限に注意 ❌ 日付フォーマットの不統一: ISO 8601形式を推奨 ❌ 特殊文字のエスケープ忘れ: CSV/JSONで必須
A: UTF-8 BOMを付与してください:
node export-csv.js data.json output.csv --bom
A: ストリーミング処理に変更:
// ストリーミング版のスクリプトを使用
node export-csv-stream.js large-data.json output.csv
A: 複数ファイルに分割:
// 100万行ごとに分割
node export-excel.js data.json output --split 1000000
// output-1.xlsx, output-2.xlsx, ... が生成される
このSKILL.mdはメインドキュメント(約250行)です。各スクリプトの詳細な実装は scripts/ ディレクトリ内のファイルを参照してください。
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.