- Home
- Skills
- Data & Databases
- Broken CSV Repair & Fast Parser
Works with the AI Agents you already use
Broken CSV Repair & Fast Parser
by Jace Reid
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.
$5
Broken CSV Repair & Fast Parser
Example session with this skill installed
I exported orders.csv from an old order system and pandas won't read it: there's a missing closing quote somewhere, a couple of rows have the wrong number of columns, and I think the encoding might not be UTF-8. Clean it up for me — give me a JSON file and a normalized CSV, and tell me exactly what was wrong and where.
- Read your context and instructions
- Compiled the broken csv repair
- Generated the data export
Repair report
examples/messy-export.csv, shipped with the skill so you can rerun it: 6 columns, 8 rows, 0.4 KB. One command, nine issues found, five of them changed data:
node scripts/csvfix.mjs examples/messy-export.csv --json table.json --out clean.csv
| Line | Record | Code | What happened |
|---|---|---|---|
| 1 | 0 | bom_stripped | byte-order mark removed |
| 3 | 2 | bare_quote | unquoted he said "ship it" kept as text (2 quotes) |
| 4 | 3 | short_row | 5 of 6 fields, padded |
| 7 | 5 | unterminated_quote | field closed at the end of its line |
| 7 | 5 | short_row | 5 of 6 fields, padded |
| 8 | 6 | long_row | 7 fields, 1 dropped: ["more"] |
| 10 | 8 | stray_cr | lone CR read as a line break |
| 11 | 9 | blank_lines | 1 empty line skipped |
The row that would have ruined the file is 1005: its opening quote is never closed. A strict parser swallows rows 1006-1008 into that one cell. Here the field was closed at line 7 and the following rows survived — and row 1004's genuine multi-line quoted note stayed intact, because only the tail from the bad line was re-read.
Read messy-export.csv: 6 columns, 8 rows (utf-8, delimiter ',', 0.4 KB)
Issues: 9 (5 changed data) — bom_stripped ×1, bare_quote ×2, short_row ×2, unterminated_quote ×1, long_row ×1, stray_cr ×1, blank_lines ×1
• unterminated_quote at line 7, record 5 — closed at the end of its line
• long_row at line 8, record 6 — 7 fields, 1 dropped: ["more"]
Wrote table.json
Wrote clean.csv
First row: {"order_id":"1001","customer":"Ann Lee","email":"ann@example.com","amount":"120.50","note":"said \"looks good\"","tags":"vip,repeat"}
Clean output — every row the same width, quoting preserved:
order_id,customer,email,amount,note,tags
1001,Ann Lee,ann@example.com,120.50,"said ""looks good""","vip,repeat"
1002,Bob,bob@example.com,88.00,"he said ""ship it""",fragile
1003,Cara Diaz,cara@example.com,,,
1004,Dan,dan@example.com,45.00,"multi
line note",new
1005,Eve,eve@example.com,10.00,"missing closing quote, x",
1006,Frank,frank@example.com,12.00,ok,extra
1007,Gil,gil@example.com,7.00,ok,
1008,Hana,hana@example.com,9.00,ok,
Next steps
- Row 1006 lost a seventh field (
more); check whether it was real data or a stray comma in the source. - Row 1005's note ends where the missing quote was: read the original line before trusting that cell.
table.jsonis ready for the agent:rowsare objects keyed by the header, all values strings.
messy-export.csv
CSV · data export
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
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"defkeep 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
--encodingwhen 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.
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
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 7 days ago
- Software
Node.js 18+
Permissions
File Scopes
What's inside
Frequently Asked Questions
New in Data & Databases
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Data & Databases.