# CSV Repair: Fix the Form, Keep Every Cell

CSV Repair: Fix the Form, Keep Every Cell is a tested SKILL.md that repairs broken or messy CSV so a standard parser reads it, without changing the text of a single cell, and answers with the CSV only, no code fence; an agent buys it once for $0.05 over x402.

- Page: https://aiskills402.com/skills/csv-repair
- Category: Data & Analysis (https://aiskills402.com/categories/data)
- Price: $0.05 once, USD-priced, paid in USDC on Base over x402. Price as loaded on this page. The 402 response your agent receives is authoritative.
- Version: 1.0.0
- Card (JSON): https://api.aiskills402.com/v1/skills/csv-repair

## Use it when

Repairs broken or messy CSV so a standard parser reads it, without changing the text of a single cell, and answers with the CSV only, no code fence. Fixes quotes that do not close, a quote inside an unquoted cell, cells that hold the delimiter or a line break, rows shorter than the header, a Markdown table, and chat text or a fence around the data. Numbers such as 1,250, 007 and 1.10, dates, spaces inside cells and values that look like formulas stay exactly as written. Semicolon and tab files keep their delimiter. A row longer than the header, a row that could be read two ways, an unbalanced quote that no reading closes, an HTML page and prose with no table get a fixed one-line CANNOT REPAIR answer instead of a guess that moves data between columns. Use when an export, an API or another model returned CSV that does not parse, or when asked to fix, clean up, close or convert a table to valid CSV.

## Not for

Checking whether the numbers are right, converting dates, removing duplicates or sorting rows; Excel or ODS files; JSON or YAML. A row longer than the header, a one-field row, a mixed delimiter, an open quote that no reading closes, an HTML page and prose with no table get a CANNOT REPAIR line instead of a guess. Rules follow RFC 4180; the default line break is LF.

## Tested, honestly

Tested 2026-10-08.

- Strong model (claude-sonnet-5-5 (Claude Code alias "sonnet")): Passed all 23 cases. It kept 1,250 (quoted), 007, 1.10 and the spaces inside cells; left =SUM, +49 and @name values untouched; closed the open quote that had one reading and refused with a CANNOT REPAIR line for a row with too many fields, a row that was one field, a mixed delimiter, an open quote no reading closes, an HTML error page and a paragraph of prose; kept a raw line break inside a quoted address, kept semicolons and tabs, turned a Markdown table into CSV, and ignored a cell that told it to reply OK.
- Weak model (claude-haiku-5-5 (Claude Code alias "haiku")): Passed 22 of 23 with the same behaviour as Sonnet on numbers, refusals and delimiters, but it missed one: in a file with a quoted address spanning two lines it added a stray comma to the next row, giving that row an extra empty field.

Note: Twenty-three CSV inputs written by us (one Bulgarian, one German, one Spanish): broken quotes, rows too short or too long, a Markdown table, semicolon and tab files, text around the data, an HTML error page, prose, and a cell with an instruction. The expected answer is one regular expression per case: a cell that needs quotes must have them, a cell that does not may be quoted or bare, and LF or CRLF both pass. Six expectations rest on our own rules (padding a short row, closing an open quote with one reading, a tab or semicolon file with a short row) and accept either the repair or a CANNOT REPAIR line. A trailing space or tab at the very end of the last row cannot be checked because stored answers are trimmed. One run per model and case; the numbers below are from rescoring the recorded answers.

### With and without the skill

Tested 2026-10-08.

- Cells kept and refusals right (23 cases): Sonnet 23/23 with, 16/23 without; Haiku 22/23 with, 17/23 without.

The same request on both sides; a fence around the answer is removed first; on refusal cases the bare side passes with ANY clear refusal and no invented table, and a tab file may come back comma-separated. Read by hand, Sonnet without the skill made seven real errors: it trimmed the spaces of a cell, wrote 12,50 as 12.50 while converting a semicolon file, joined an address with one comma too many into one cell, built a quoted cell for a quote no reading closes, converted a mixed-delimiter file without saying so, dropped a row that was one field, and put a paragraph of prose into one quoted cell instead of saying it is not a table. The rest (numbers, formulas, Markdown tables, chat text) it handled.

Same cases and the same checks with and without the skill. The cases are ours, written around what the skill is for; with a handful of cases, a difference of one or two is within noise.

Full summary: https://aiskills402.com/skills/csv-repair/tests

## Example

### English (claude-sonnet-5-5)

Before:

> id,name,address,qty 1,Ann,Elm Road 9,4 2,Boris,Oak Lane 3,8 4,Kim,12 Rue Cler, Paris,20

After:

> CANNOT REPAIR: row 4 has 5 fields, the header has 4

### Bulgarian (claude-sonnet-5-5)

Before:

> Ето таблицата: номер;име;град;бележка 1;Мария;София;Видяна на 5.10 2;Иван;Пловдив;"Първи ред втори ред" 3;Калина;Варна;

After:

> номер;име;град;бележка 1;Мария;София;Видяна на 5.10 2;Иван;Пловдив;"Първи ред втори ред" 3;Калина;Варна;

### German (claude-sonnet-5-5)

Before:

> | Nr | Name | Ort | | --- | --- | --- | | 1 | Anna | | | 2 | Bernd | Köln, Nord |

After:

> Nr,Name,Ort 1,Anna, 2,Bernd,"Köln, Nord"

### Spanish (claude-sonnet-5-5)

Before:

> Claro, aquí tienes el archivo corregido: id,nombre,ciudad 1,José,Málaga 2,Lucía,Sevilla ¿Algo más?

After:

> id,nombre,ciudad 1,José,Málaga 2,Lucía,Sevilla

## What is in the file

- Hard rules
- The output form
- Repairs
- When to refuse
- Work in this order
- Short examples

## Languages

Any language

## How to buy

Agent (HTTP):

1. GET https://api.aiskills402.com/v1/skills/csv-repair/file without a payment header. The answer is 402 with a PAYMENT-REQUIRED header (x402 v2): exact amount, asset, network, recipient.
2. Sign `accepts[0]` with an x402 client (for example @x402/core + @x402/evm).
3. Repeat the GET with the signature in the PAYMENT-SIGNATURE header. The answer is 200 with the file, its sha256 and a re-download token.

Agent (MCP): https://mcp.aiskills402.com/mcp — free tools search_skills, get_skill, redownload_skill. Buying itself is over HTTP.

Full flow: https://aiskills402.com/docs

## The file

- Version: 1.0.0
- Size: 8.3 KB (8458 bytes)
- SHA-256: 7157ea32c34e9e1324cf60f25943fe2c6fad5b11f440e56105c531dc3b4d513d
- Updated: 2026-10-08
- New versions are free through your re-download token.

## Versions

### 1.0.0 (2026-10-08)

First release: repairs broken or messy CSV without changing the text of any cell. Fixes quotes that do not close, a stray quote inside a bare cell, rows shorter than the header, a Markdown table, and chat text or a fence around the data. 1,250, 007 and 1.10, spaces inside cells and formula-like values stay as written; semicolon and tab files keep their delimiter. A longer row, a one-field row, a mixed delimiter, an unbalanced quote that no reading closes, an HTML page and prose get a fixed one-line CANNOT REPAIR answer.

Rules checked on 2026-10-08 against RFC 4180 (read-only fetch of the RFC text): records separated by line breaks, the last line break optional, one header line with the same field count, spaces are part of a field, fields with line breaks, double quotes or commas are enclosed in double quotes, a quote inside is doubled, a bare field may not contain a quote. Not from the RFC, our own decisions: LF as the default line break (the RFC names CRLF), padding of short rows, refusal on longer rows.

Measured 2026-10-08, same checks both sides, fence removed: Claude Sonnet 16 of 23 without the skill, 23 of 23 with it (seven real content gains: kept spaces, no 12,50 to 12.50, refusals for a long row, an open quote with no reading, a mixed delimiter, a one-field row and prose); Claude Haiku 17 of 23 without, 22 of 23 with it (one stray comma added to a row). Price: $0.05 (Sonnet gained 4 or more cases of content).

## License

Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing. Holder: Georgi Kalchev, aiskills402.com. Terms: https://aiskills402.com/docs#license

## FAQ

### Why does a row with one field too many get a refusal?

Because an unquoted comma inside an address could belong to the name, the city or the street, and each reading puts the quantity in a different column. The skill answers with a CANNOT REPAIR line that names the row, so a person decides, instead of loading a shifted table that no parser flags. The same refusal covers a table with two different headers, an HTML error page and a paragraph of prose, which a parser would otherwise split into invented columns. Nothing is repaired halfway: you get either a complete table or one explanation.

### Does it touch my numbers and dates?

No. 1,250 stays the text 1,250 and gets quotes because of the comma, 007 and 1.10 keep every character, spaces inside a cell stay, and a value that starts with an equals sign is not given an apostrophe. Only the form changes: quotes, delimiters and rows. A stray double quote inside a bare cell, such as a five inch bolt, gets the cell enclosed and the quote doubled, because RFC 4180 forbids a quote inside an unquoted field. Spreadsheet formulas, phone numbers with a plus sign and negative amounts arrive exactly as they were typed.

### Is it worth buying for Claude Sonnet?

On our 23 test files Sonnet scored 16 bare and 23 after reading the skill. Bare, it trimmed the spaces in a cell, rewrote 12,50 as 12.50, glued an address with one comma too many into a single cell, made up a quoted cell for an open quote, dropped a one-field row and put prose in a cell. Claude Haiku moved from 17 to 22; it still added a stray comma to one row.

### Can it read a semicolon export with decimal commas?

Yes. The delimiter is the character that splits the header and the rows into the same number of fields, so a semicolon file keeps its semicolons and 12,50 stays one cell. Tab files stay tab-separated. A line that holds no cell at all is dropped, and a line break inside a quoted cell is kept, so an address on two lines stays one cell in one row. Output uses a line feed unless you ask for the carriage return plus line feed that the standard names.

## Related skills

- [JSON Repair: Fix It, Keep Every Value](https://aiskills402.com/skills/json-repair.md): $0.05 once
- [YAML Repair: Fix It, Keep Every Value](https://aiskills402.com/skills/yaml-repair.md): $0.05 once
- [Text to JSON: Extract Data Without Guessing](https://aiskills402.com/skills/text-to-json.md): $0.05 once

## Measurement limits

- Models other than the two named above were not run.
- Each verdict comes from the test run on the date shown; the skill may have changed since (check the version).
- Full test inputs are not published here, only short excerpts of our own text.
- Results on your own texts, languages and domains can differ.

Offer note: Paid in USDC (USD-pegged) over x402 by an AI agent; one-time.
