jpskill.com
💼 ビジネス コミュニティ

data-processor

配列データのフィルタリング、マッピング、集計といった一般的な処理を実行し、ビジネスで扱うデータを使いやすい形に変換・加工するSkill。

📜 元の英語説明(参考)

Process and transform arrays of data with common operations like filtering, mapping, and aggregation

🇯🇵 日本人クリエイター向け解説

一言でいうと

配列データのフィルタリング、マッピング、集計といった一般的な処理を実行し、ビジネスで扱うデータを使いやすい形に変換・加工するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o data-processor.zip https://jpskill.com/download/17265.zip && unzip -o data-processor.zip && rm data-processor.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17265.zip -OutFile "$d\data-processor.zip"; Expand-Archive "$d\data-processor.zip" -DestinationPath $d -Force; ri "$d\data-processor.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して data-processor.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → data-processor フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Data Processor Skill

オブジェクトの配列を変換するための汎用データ処理スキルです。このスキルは、コード実行によるトークン効率の利点を示します。自然言語で変換を記述する代わりに、一度コードを記述して再利用します。

このスキルの機能

一般的な変換を使用してデータの配列を処理します。

  • 条件に基づいてレコードをフィルタリング
  • フィールドを新しい値にマッピング
  • データを集計 (合計、平均、カウントなど)
  • データをソートおよびグループ化
  • 重複を削除
  • データセットをマージ

このスキルの使用時

以下が必要な場合は、このスキルを使用します。

  • 大規模なデータセット (数百または数千のレコード) を変換する
  • 一貫したビジネスロジックをデータに適用する
  • データを集計または要約する
  • データをクリーンまたは正規化する
  • 複数のソースからのデータを結合する

トークン効率: コードで 1000 件のレコードを処理するには、約 500 トークンを使用します。同じ操作を自然言語で記述すると、50,000 トークンを使用します。

実装

/**
 * Data Processor - General purpose data transformation
 * @param {Array} data - Array of objects to process
 * @param {Object} operations - Operations to apply
 * @returns {Object} Processed data and statistics
 */
async function processData(data, operations = {}) {
  if (!Array.isArray(data)) {
    throw new Error('Data must be an array');
  }

  let result = [...data];
  const stats = {
    inputCount: data.length,
    operations: [],
  };

  // Filter operation
  if (operations.filter) {
    const beforeCount = result.length;
    result = result.filter(operations.filter);
    stats.operations.push({
      type: 'filter',
      recordsRemoved: beforeCount - result.length
    });
  }

  // Map operation (transform fields)
  if (operations.map) {
    result = result.map(operations.map);
    stats.operations.push({ type: 'map' });
  }

  // Sort operation
  if (operations.sort) {
    const { field, order = 'asc' } = operations.sort;
    result.sort((a, b) => {
      const aVal = a[field];
      const bVal = b[field];
      const comparison = aVal < bVal ? -1 : aVal > bVal ? 1 : 0;
      return order === 'asc' ? comparison : -comparison;
    });
    stats.operations.push({ type: 'sort', field, order });
  }

  // Aggregate operation
  if (operations.aggregate) {
    const { field, operation: aggOp } = operations.aggregate;
    const values = result.map(r => r[field]).filter(v => v != null);

    let aggregateResult;
    switch (aggOp) {
      case 'sum':
        aggregateResult = values.reduce((sum, v) => sum + v, 0);
        break;
      case 'average':
        aggregateResult = values.reduce((sum, v) => sum + v, 0) / values.length;
        break;
      case 'count':
        aggregateResult = values.length;
        break;
      case 'min':
        aggregateResult = Math.min(...values);
        break;
      case 'max':
        aggregateResult = Math.max(...values);
        break;
      default:
        throw new Error(`Unknown aggregate operation: ${aggOp}`);
    }

    stats.aggregateResult = {
      field,
      operation: aggOp,
      value: aggregateResult
    };
  }

  // Remove duplicates
  if (operations.unique) {
    const { field } = operations.unique;
    const seen = new Set();
    const beforeCount = result.length;
    result = result.filter(item => {
      const key = item[field];
      if (seen.has(key)) return false;
      seen.add(key);
      return true;
    });
    stats.operations.push({
      type: 'unique',
      field,
      duplicatesRemoved: beforeCount - result.length
    });
  }

  stats.outputCount = result.length;

  return {
    data: result,
    stats
  };
}

module.exports = processData;

例 1: フィルタリングとソート

const processData = require('/skills/data-processor.js');

const salesData = [
  { id: 1, amount: 150, status: 'completed' },
  { id: 2, amount: 200, status: 'pending' },
  { id: 3, amount: 175, status: 'completed' },
  { id: 4, amount: 225, status: 'completed' }
];

const result = await processData(salesData, {
  filter: (record) => record.status === 'completed',
  sort: { field: 'amount', order: 'desc' }
});

console.log(result);
// Output:
// {
//   data: [
//     { id: 4, amount: 225, status: 'completed' },
//     { id: 3, amount: 175, status: 'completed' },
//     { id: 1, amount: 150, status: 'completed' }
//   ],
//   stats: {
//     inputCount: 4,
//     operations: [
//       { type: 'filter', recordsRemoved: 1 },
//       { type: 'sort', field: 'amount', order: 'desc' }
//     ],
//     outputCount: 3
//   }
// }

例 2: データの集計

const processData = require('/skills/data-processor.js');

const orders = [
  { orderId: 1, total: 100 },
  { orderId: 2, total: 150 },
  { orderId: 3, total: 200 }
];

const result = await processData(orders, {
  aggregate: { field: 'total', operation: 'sum' }
});

console.log(result.stats.aggregateResult);
// Output: { field: 'total', operation: 'sum', value: 450 }

例 3: 複雑な変換

const processData = require('/skills/data-processor.js');

const customers = [
  { name: '  John Doe  ', email: 'JOHN@EXAMPLE.COM', age: 30 },
  { name: 'Jane Smith', email: 'jane@example.com', age: 25 },
  { name: '  John Doe  ', email: 'JOHN@EXAMPLE.COM', age: 30 } // duplicate
];

const result = await processData(customers, {
  map: (customer) => ({
    name: customer.name.trim(),
    email: customer.email.toLowerCase(),
    age: customer.age
  }),
  unique: { field: 'email' },
  filter: (customer) => customer.age >= 25,
  sort: { field: 'age', order: 'asc' }
});

console.log(result.data);
// Output:
// [
//   { name: 'Jane Smith', email: 'jane@example.com', age: 25 },
//   { name: 'John Doe', email: 'john@example.com', age: 30 }
// ]

MCP ツールとの統合

このスキルは、MCP ツールと組み合わせて使用​​すると効果的です。


// Fetch data from an MCP tool
const rawData = await callMCPTool('database__query', {
  query: 'SELECT * FROM customers WHER

(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Data Processor Skill

A general-purpose data processing skill for transforming arrays of objects. This skill demonstrates the token efficiency benefits of code execution - instead of describing transformations in natural language, write code once and reuse it.

What This Skill Does

Processes arrays of data with common transformations:

  • Filter records based on conditions
  • Map fields to new values
  • Aggregate data (sum, average, count, etc.)
  • Sort and group data
  • Remove duplicates
  • Merge datasets

When to Use This Skill

Use this skill when you need to:

  • Transform large datasets (hundreds or thousands of records)
  • Apply consistent business logic to data
  • Aggregate or summarize data
  • Clean or normalize data
  • Combine data from multiple sources

Token Efficiency: Processing 1000 records in code uses ~500 tokens. Describing the same operations in natural language would use ~50,000 tokens.

Implementation

/**
 * Data Processor - General purpose data transformation
 * @param {Array} data - Array of objects to process
 * @param {Object} operations - Operations to apply
 * @returns {Object} Processed data and statistics
 */
async function processData(data, operations = {}) {
  if (!Array.isArray(data)) {
    throw new Error('Data must be an array');
  }

  let result = [...data];
  const stats = {
    inputCount: data.length,
    operations: [],
  };

  // Filter operation
  if (operations.filter) {
    const beforeCount = result.length;
    result = result.filter(operations.filter);
    stats.operations.push({
      type: 'filter',
      recordsRemoved: beforeCount - result.length
    });
  }

  // Map operation (transform fields)
  if (operations.map) {
    result = result.map(operations.map);
    stats.operations.push({ type: 'map' });
  }

  // Sort operation
  if (operations.sort) {
    const { field, order = 'asc' } = operations.sort;
    result.sort((a, b) => {
      const aVal = a[field];
      const bVal = b[field];
      const comparison = aVal < bVal ? -1 : aVal > bVal ? 1 : 0;
      return order === 'asc' ? comparison : -comparison;
    });
    stats.operations.push({ type: 'sort', field, order });
  }

  // Aggregate operation
  if (operations.aggregate) {
    const { field, operation: aggOp } = operations.aggregate;
    const values = result.map(r => r[field]).filter(v => v != null);

    let aggregateResult;
    switch (aggOp) {
      case 'sum':
        aggregateResult = values.reduce((sum, v) => sum + v, 0);
        break;
      case 'average':
        aggregateResult = values.reduce((sum, v) => sum + v, 0) / values.length;
        break;
      case 'count':
        aggregateResult = values.length;
        break;
      case 'min':
        aggregateResult = Math.min(...values);
        break;
      case 'max':
        aggregateResult = Math.max(...values);
        break;
      default:
        throw new Error(`Unknown aggregate operation: ${aggOp}`);
    }

    stats.aggregateResult = {
      field,
      operation: aggOp,
      value: aggregateResult
    };
  }

  // Remove duplicates
  if (operations.unique) {
    const { field } = operations.unique;
    const seen = new Set();
    const beforeCount = result.length;
    result = result.filter(item => {
      const key = item[field];
      if (seen.has(key)) return false;
      seen.add(key);
      return true;
    });
    stats.operations.push({
      type: 'unique',
      field,
      duplicatesRemoved: beforeCount - result.length
    });
  }

  stats.outputCount = result.length;

  return {
    data: result,
    stats
  };
}

module.exports = processData;

Examples

Example 1: Filter and Sort

const processData = require('/skills/data-processor.js');

const salesData = [
  { id: 1, amount: 150, status: 'completed' },
  { id: 2, amount: 200, status: 'pending' },
  { id: 3, amount: 175, status: 'completed' },
  { id: 4, amount: 225, status: 'completed' }
];

const result = await processData(salesData, {
  filter: (record) => record.status === 'completed',
  sort: { field: 'amount', order: 'desc' }
});

console.log(result);
// Output:
// {
//   data: [
//     { id: 4, amount: 225, status: 'completed' },
//     { id: 3, amount: 175, status: 'completed' },
//     { id: 1, amount: 150, status: 'completed' }
//   ],
//   stats: {
//     inputCount: 4,
//     operations: [
//       { type: 'filter', recordsRemoved: 1 },
//       { type: 'sort', field: 'amount', order: 'desc' }
//     ],
//     outputCount: 3
//   }
// }

Example 2: Aggregate Data

const processData = require('/skills/data-processor.js');

const orders = [
  { orderId: 1, total: 100 },
  { orderId: 2, total: 150 },
  { orderId: 3, total: 200 }
];

const result = await processData(orders, {
  aggregate: { field: 'total', operation: 'sum' }
});

console.log(result.stats.aggregateResult);
// Output: { field: 'total', operation: 'sum', value: 450 }

Example 3: Complex Transformation

const processData = require('/skills/data-processor.js');

const customers = [
  { name: '  John Doe  ', email: 'JOHN@EXAMPLE.COM', age: 30 },
  { name: 'Jane Smith', email: 'jane@example.com', age: 25 },
  { name: '  John Doe  ', email: 'JOHN@EXAMPLE.COM', age: 30 } // duplicate
];

const result = await processData(customers, {
  map: (customer) => ({
    name: customer.name.trim(),
    email: customer.email.toLowerCase(),
    age: customer.age
  }),
  unique: { field: 'email' },
  filter: (customer) => customer.age >= 25,
  sort: { field: 'age', order: 'asc' }
});

console.log(result.data);
// Output:
// [
//   { name: 'Jane Smith', email: 'jane@example.com', age: 25 },
//   { name: 'John Doe', email: 'john@example.com', age: 30 }
// ]

Integration with MCP Tools

This skill works great in combination with MCP tools:

// Fetch data from an MCP tool
const rawData = await callMCPTool('database__query', {
  query: 'SELECT * FROM customers WHERE created_date > "2024-01-01"'
});

// Process with the skill
const processData = require('/skills/data-processor.js');
const result = await processData(rawData, {
  filter: (r) => r.status === 'active',
  sort: { field: 'revenue', order: 'desc' },
  aggregate: { field: 'revenue', operation: 'sum' }
});

// Save results
await callMCPTool('storage__save', {
  key: 'processed_customers',
  value: result.data
});

// Return summary to agent (not full data)
return {
  processedRecords: result.stats.outputCount,
  totalRevenue: result.stats.aggregateResult.value
};

Tips and Best Practices

  1. Save Intermediate Results: For large datasets, save to /workspace after each major operation
  2. Return Summaries: Send statistics to the agent, not full datasets
  3. Chain Operations: Combine multiple operations for complex transformations
  4. Validate Input: Always check data types and handle edge cases
  5. Reuse This Skill: Save to /skills and use across multiple tasks

Related Skills

  • validator - Validate data before processing
  • exporter - Export processed data to various formats
  • aggregator - Advanced statistical aggregations

Performance Notes

This skill can process:

  • 1,000 records: < 50ms
  • 10,000 records: < 200ms
  • 100,000 records: < 2s

All operations use efficient JavaScript array methods with O(n) or O(n log n) complexity.


Inspired by: The Anthropic skills pattern for token-efficient data processing. See Code Execution with MCP for the philosophy behind this approach.