home / skills / ntaksh42 / agents / data-converter

data-converter skill

/.claude/skills/data-converter

This skill converts data between JSON, YAML, XML, CSV, TOML and more, with validation, formatting, and simple transformations to ease data migration.

npx playbooks add skill ntaksh42/agents --skill data-converter

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.6 KB
---
name: data-converter
description: Convert data between formats (JSON, XML, CSV, YAML, TOML). Use when transforming data structures or migrating between data formats.
---

# Data Converter Skill

データ形式を変換するスキルです。

## 概要

JSON、YAML、XML、CSV、TOML等の各種データ形式を相互変換します。

## 主な機能

- **多様な形式**: JSON ↔ YAML ↔ XML ↔ CSV ↔ TOML ↔ INI
- **データ検証**: スキーマバリデーション
- **整形**: インデント、ソート、圧縮
- **フィルタリング**: 特定フィールドの抽出
- **変換**: キャメルケース ↔ スネークケース
- **マージ**: 複数ファイルの統合

## 使用方法

```
以下のJSONをYAMLに変換:

{
  "name": "John",
  "age": 30
}
```

## 変換例

### JSON → YAML

```json
{
  "database": {
    "host": "localhost",
    "port": 5432,
    "credentials": {
      "username": "admin",
      "password": "secret"
    }
  }
}
```

↓

```yaml
database:
  host: localhost
  port: 5432
  credentials:
    username: admin
    password: secret
```

### CSV → JSON

```csv
name,age,city
John,30,Tokyo
Jane,25,Osaka
```

↓

```json
[
  {"name": "John", "age": 30, "city": "Tokyo"},
  {"name": "Jane", "age": 25, "city": "Osaka"}
]
```

### XML → JSON

```xml
<user>
  <name>John</name>
  <age>30</age>
  <email>[email protected]</email>
</user>
```

↓

```json
{
  "user": {
    "name": "John",
    "age": 30,
    "email": "[email protected]"
  }
}
```

## バージョン情報

- スキルバージョン: 1.0.0
- 最終更新: 2025-01-22

Overview

This skill converts data between common formats: JSON, YAML, XML, CSV, TOML (and INI). It helps preserve structure, validate schemas, and apply formatting rules so data can move reliably between systems. Use it for migrations, integrations, or quick format changes.

How this skill works

The skill parses the input format into an internal data model, applies optional transformations (field filtering, case conversion, merging), validates against a provided schema, and serializes the result to the target format. It supports pretty-printing, compact output, key sorting, and basic error reporting for malformed inputs. Batch conversions and merging of multiple files are supported.

When to use it

  • Migrating configuration files between formats (e.g., JSON to YAML or TOML).
  • Preparing data exports or imports for different services that require specific formats.
  • Cleaning and normalizing datasets before analysis or ingestion.
  • Extracting specific fields or converting naming conventions (camelCase ↔ snake_case).
  • Merging multiple small files into a single structured document.

Best practices

  • Validate input with a schema before converting when structure matters.
  • Use pretty-printing for human-edited configs and compact output for network transfer.
  • Keep sensitive fields encrypted or redacted before exporting to less-secure formats.
  • Test conversions with representative sample files to catch edge cases (nested arrays, mixed types).
  • When converting CSV, provide explicit column types or headers to avoid ambiguous types.

Example use cases

  • Convert application config from JSON to TOML for a tool that only accepts TOML.
  • Transform CSV user exports into JSON arrays for API ingestion.
  • Merge multiple service-specific YAML fragments into a single production configuration file.
  • Extract and output only selected fields (name, email) from complex JSON records.
  • Normalize keys from camelCase to snake_case across a dataset before loading into a database.

FAQ

Can it validate data against a schema?

Yes. Provide a JSON Schema (or compatible schema) to validate input before conversion; errors are reported with locations.

How does CSV type inference work?

CSV conversion can infer types (numbers, booleans) or accept explicit column type hints. You can also force all values to strings.

Does it preserve ordering of keys?

You can choose to preserve original key order or sort keys alphabetically during serialization.