agentleFS
bernhardbruggerbernhardbrugger/claude-skill-data-transform/skills/data-transform/SKILL.md

data-transform

Skill1 starsChanged 6 days agoMITView on GitHub

This skill should be used when the user asks to "convert CSV to JSON", "transform data to SQL", "turn JSON into a table", "flatten nested JSON", "convert to YAML", "generate INSERT statements", "parse and reshape data", "normalize my CSV", "export data as markdown table", "convert spreadsheet data", "transform my data format", "change file format", "convert NDJSON to CSV", "explode array field", or mentions converting between data formats like CSV, JSON, SQL, YAML, TSV, Markdown tables, TOML, or NDJSON. Also use this skill when the user asks to "infer schema from data", "detect column types", "what columns are in this file", "generate CREATE TABLE from my data", "find null values", or "validate data structure". Use this skill any time a user pastes data and wants it in a different format — even if they just say "can you turn this into JSON" or "make this a table" without naming a specific format.

  • Installs packages

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. Starlitnightly/omicverse★ 1.4ksame name
    2. johnson7788/collect_skills★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run these three commands in sequence before committing to a conversion:

    line 90
  2. Very specific:

    When --no-infer is not set, string values are parsed in this order:

    line 127

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Data Transform

Convert CSV, TSV, JSON, NDJSON and YAML (input) into any of CSV, TSV, JSON, NDJSON, SQL, YAML, Markdown tables and TOML (output) with two bundled Python scripts. XML, TOML and Markdown are not accepted as input. Handles encoding detection, type inference, null normalization, nested-object flattening, array explosion, and large-file streaming. Only the standard library is needed, except that reading YAML requires pip install pyyaml.

Quick Start

# Basic conversion
python scripts/transform.py data.csv --to json
python scripts/transform.py data.json --to sql --table users
python scripts/transform.py data.csv --to markdown

# Flatten nested JSON before converting to CSV
python scripts/transform.py nested.json --to csv --flatten

# Explode an array field (one row per element)
python scripts/transform.py orders.json --to csv --explode items

# Understand your data first
python scripts/infer_schema.py data.csv --output summary

# Stream a large file without loading it all into memory
python scripts/transform.py big.csv --to ndjson --stream

# Pipe from stdin
cat records.ndjson | python scripts/transform.py --from ndjson --to csv

Format Support Matrix

From \ ToCSVJSONNDJSONSQLYAMLMarkdownTOML
CSV / TSV✓✓✓✓✓✓✓
JSON✓—✓✓✓✓✓
NDJSON✓✓—✓✓✓—
YAML✓✓✓✓—✓—

Key Options: transform.py

FlagDefaultPurpose
--to(required)Output format: json ndjson csv tsv sql yaml markdown toml
--fromautoForce input format when piping stdin
--tabledataTable name for SQL output
--dialectsqliteSQL dialect: sqlite mysql postgres
--batch500Rows per SQL INSERT statement
--delimiter,Input CSV field delimiter
--no-headerfalseInput CSV has no header row
--null-valuesnull,NULL,N/A,…Comma-separated strings to treat as NULL
--flattenfalseRecursively flatten nested JSON objects
--sep__Key separator for flattened paths (e.g. address__city)
--explode FIELD—Expand array field: one row per element. Also accepts a nested path (user__tags or user.tags); an empty array keeps the row with the field set to null. Runs before --flatten
--no-inferfalseKeep all values as strings (skip type inference)
--streamfalseWrite rows as they are read (CSV/TSV/NDJSON output). CSV/TSV/NDJSON input is read row by row; JSON/YAML input is still parsed whole. CSV columns come from the first row (a warning lists columns dropped later)
--prettyfalsePretty-print JSON output
--encodingautoForce input encoding (e.g. latin-1, cp1252)
-o FILEstdoutWrite output to file instead of stdout

Key Options: infer_schema.py

FlagDefaultPurpose
--outputjson-schemaOutput mode: json-schema sql summary
--tabledataTable name for SQL output
--sample1000Max rows to analyze
--enum-threshold20Max unique values before dropping enum detection

Recommended Workflow for Unknown Data

Run these three commands in sequence before committing to a conversion:

# 1. Inspect what you have
python scripts/infer_schema.py myfile.csv --output summary

# 2. Preview the conversion
python scripts/transform.py myfile.csv --to markdown | head -20

# 3. Run the real conversion
python scripts/transform.py myfile.csv --to json --pretty -o output.json

Handling Common Edge Cases

Encoding problems — The script auto-detects UTF-8 and Latin-1. For Windows files, pass --encoding cp1252. For UTF-8 with BOM, the auto-detector handles it.

Semicolon-delimited CSV (common in European Excel exports) — pass --delimiter ";".

Custom null values — extend the default list: --null-values "null,NULL,N/A,#N/A,-,unknown".

Numbers stored as strings — type inference is on by default; pass --no-infer to keep everything as string (useful before a SQL COPY load where the schema is already defined).

Nested JSON to SQL — chain --flatten with --to sql to produce a flat table with double-underscore column names (address__city, address__zip).

One row per order item — use --explode items where items is the array field name.

Files > 100 MB — use --stream with NDJSON/CSV input and NDJSON/CSV output. Convert big JSON arrays to NDJSON first, because JSON input is parsed as a whole.

PostgreSQL COPY format — use --dialect postgres with --to csv then import with \COPY tablename FROM 'file.csv' CSV HEADER;.

Type Inference Rules

When --no-infer is not set, string values are parsed in this order:

  1. NULL — value is in the --null-values list or is an empty string → None
  2. Boolean — case-insensitive true/false/yes/no/on/off → True/False
  3. Integer — plain ASCII digits, optional sign, no leading zeros (007 and ZIP codes like 01234 stay strings, as does 1_000) → int
  4. Float — decimal or scientific notation (41.5, 1e5, .5) → float. nan and inf stay strings, because they are not valid JSON numbers
  5. String — everything else

SQL output promotes types per column: if a column has mixed int and float values, the whole column becomes REAL/DOUBLE.

Additional Resources

Reference Files

  • references/format-specs.md — Per-format edge cases: CSV quirks, JSON null handling, SQL dialect differences, YAML boolean gotchas, encoding notes.
  • references/transform-patterns.md — Ready-to-run recipes: normalizing API responses, log analysis, database seed data, pivot-style reshaping, joining two CSVs, batch processing a directory of files.

Scripts

  • scripts/transform.py — Main conversion engine. Run with --help for full usage.
  • scripts/infer_schema.py — Schema inference. Outputs JSON Schema draft-07, SQL DDL, or a human-readable column summary with type, nullability, and sample values.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.