# Broken CSV Repair & Fast Parser

> Repairs CSV/TSV exports that strict parsers reject — unclosed quotes, stray CRs, ragged rows, BOM and GB18030 — returning clean JSON, a normalized CSV and a line-by-line report of every repair.

Broken CSV Repair & Fast Parser is a paid AI agent skill on Agensi by Jace Reid, in Data & Databases. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5 (one-time purchase)
- Creator: [Jace Reid](https://www.agensi.io/creators/wu-san)
- Category: [Data & Databases](https://www.agensi.io/skills/data-databases)
- Version: 1.0
- Last updated: 2026-11-27
- Security: scan passed (2026-11-27); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/broken-csv-repair-fast-parser
- Tags: database, automation, csv, data-cleaning, parsing, etl, json, encoding

## About this skill

Broken CSV files are where agents quietly go wrong. A strict parser throws "unexpected end of data" on one unclosed quote; an LLM asked to "just read it" invents the missing cells; a spreadsheet shifts a column without saying so.

This skill gives your agent one deterministic program that reads the file the way a careful person would, repairs only what is broken, and reports every repair with its line number - so the table it reasons over is either correct or visibly doubtful.

### What it fixes

- **Unclosed quotes** - the row-swallowing bug. The field is closed at the end of its line so the rows after it survive, and legitimate multi-line quoted cells earlier in the file are left untouched (only the tail from the bad line is re-read).
- **Bare quotes and quote junk** - `he said "ok"` and `"abc"def` keep their characters instead of splitting the row.
- **Stray CR / mixed line endings** - old-Mac CRs become record breaks instead of corrupting cells.
- **Ragged rows** - short rows are padded to the header width, long rows are trimmed, and the dropped fields are listed in the report.
- **BOM, UTF-16, GB18030, Windows-1252** - detected from the bytes; a non-UTF-8 guess is reported, never silent.
- **Wrong delimiter** - comma, semicolon, tab and pipe are scored over the first 100 lines, outside quotes, by field-count consistency.

### What you get back

- A prose summary you can read in the terminal.
- `--json table.json`: `{meta, issues[], rows[]}` - rows as objects keyed by header (duplicate names get `_2`), every cell a string.
- `--out clean.csv`: RFC 4180, CRLF, one uniform width.
- `--report`: the same JSON on stdout, for an agent to consume directly.

### Why buy it instead of prompting for it

CSV repair is exactly the task where an LLM answer looks right and is wrong. This is about 700 lines of deterministic parsing with no dependencies, no network and no key: the same bytes always produce the same output, and the repair report is the audit trail that lets you check the one row you care about. On a 200,000-row / 10.8 MB export it parses and summarizes in 0.85 s (1.45 s including a 34 MB JSON).

### Honest limits

- An unclosed quote is repaired at the end of its line: almost always right, and the line is reported so you can look.
- Non-UTF-8 files are decoded by a heuristic; pass `--encoding` when correctness matters.
- Long rows lose their extra fields (listed in the issue detail).
- No type inference - every value stays a string.
- The whole file is held in memory, roughly 10x its size at peak.

## Requires

- Node.js 18+

## Known limitations

Loads whole file into RAM. Closes missing quotes at line-end. No type inference. Delimiter detection uses first 100 lines. Max file size limited by Node memory.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Broken CSV Repair & Fast Parser skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this tool differ from a standard CSV parser or library?

This tool is built for 'hard' CSV failures that crash standard libraries like pandas or D3, specifically handling unclosed quotes, encoding mismatches (Mojibake), and mismatched column counts that typically cause ingestion to fail.

### What are the technical requirements to run the Broken CSV Repair skill?

The skill is a standalone Node.js tool (v18+) with zero external dependencies, making it compatible with any local development environment, CI/CD pipeline, or AI agent capable of executing shell scripts.

### Can I manually specify the delimiter if the tool's auto-detection fails?

While the script features high-accuracy auto-detection for popular encodings like UTF-8 and Windows-1252, you can manually override the delimiter and encoding settings via CLI flags for highly non-standard files.

### Does the tool provide a report of what was actually fixed in my file?

Yes, the skill includes a JSON export mode that produces a structured audit log detailing every repair made, including the specific line numbers and the nature of the structural correction.

### Is this more reliable than simply asking an LLM like GPT-4 to fix a broken CSV?

It is deterministic: the same bytes always produce the same output, and it never invents values - it repairs quoting and structure, then lists every change with its line number. An LLM can silently fill in a plausible-looking cell; this cannot, and where a repair is a judgement call (an unclosed quote) it reports the exact line so you can check it.

### What exactly is included in the purchase?

You receive the full source code for the repair script (scripts/csvfix.mjs), documentation on all CLI flags, and a license for use within your own workflows or agentic pipelines.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
