Data & Analysis

Fixed-Width to CSV: Cut by Spec, Trim Only When Told

Converts fixed-width text (mainframe exports, bank and statistics files, printed reports) into RFC 4180 CSV from a column specification and answers with the CSV only, no code fence. Positions are 1-based and inclusive unless the spec says otherwise, and count characters, so accented and Cyrillic letters do not shift later columns. Every cell is the exact characters of its positions: nothing is trimmed unless the spec says trim, leading zeros and inner spaces stay, numbers stay text, and an implied decimal becomes a point only where the spec states it. A value with a comma or a quote is quoted. A line that does not fit the spec, overlapping columns, a tab, a byte-based spec meeting non-ASCII text, or a signed overpunch digit gets a fixed one-line CANNOT CONVERT answer instead of a guessed table. Use when a fixed-width file has to become CSV for a spreadsheet, a database or a data pipeline.

Fixed-Width to CSV: Cut by Spec, Trim Only When Told is a tested SKILL.md that converts fixed-width text (mainframe exports, bank and statistics files, printed reports) into RFC 4180 CSV from a column specification and answers with the CSV only, no code fence; an agent buys it once for $0.03 over x402.

Tested 2026-10-08No code, no hidden instructionsv1.0.0 · 8.7 KB · perpetual license

Not for

Files whose columns the spec does not define: no layout is guessed. A line that does not fit the spec, overlapping columns, a tab, a byte-based spec meeting non-ASCII text or a signed overpunch digit gets a one-line CANNOT CONVERT answer. It decodes no packed or binary fields and sums, sorts or reformats nothing. Output follows RFC 4180: comma, LF (CRLF on request).

Tested, honestly

Tested 2026-10-08 with a strong and a weak model.

With and without the skill

Results with and without the skill, for Sonnet and Haiku
SonnetHaiku
withwithoutwithwithout
Files converted or refused right (24 files)24/2421/2423/2420/24

Same request on both sides, a fence removed first. Read by hand, Sonnet without the skill already cut columns by position, kept padding, handled implied decimals and multi-byte letters, and refused lines of the wrong length. It missed three that call for a refusal: it split overlapping columns anyway, cut byte positions through a non-ASCII letter, and assigned an unnamed gap to a neighbouring column. Haiku without the skill missed the same three and placed an implied decimal wrong.

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.

SonnetStrong model, claude-sonnet-5-5
Right on all 24 files, read by hand: it cut every column by character position, kept padding unless the spec said trim, inserted implied decimals where the spec named them, skipped a header line when told, read start-plus-length and zero-based specs right, counted Cyrillic, accented and Spanish letters as one position each, quoted fields that hold a comma, and refused with one CANNOT CONVERT line where the spec cannot be applied without a guess: overlapping columns, byte positions that fall inside a non-ASCII letter, a gap no column names, a line too short or too long for the spec. It treated a planted line as data.
HaikuWeak model, claude-haiku-5-5
Right on 23 of 24 files, read by hand, but it missed one: on the Cyrillic file it counted the first line as 25 characters instead of 24 and refused a file it should have converted.

Full test summary

Example

Our own test text, before and after the skill ran. Excerpts only.

English · claude-sonnet-5-5

Before

00042 7.50Ann X1 00007 120.00Bo Lee Y2 10000 12.00Cy Z3

After

id,amount,name,code 00042 , 7.50,Ann ,X1 00007 , 120.00,Bo Lee ,Y2 10000 , 12.00,Cy ,Z3

Bulgarian · claude-sonnet-5-5

Before

Иван София A001 Георги Ив.Пловдив B002 Ели Варна C003

After

name,city,code Иван,София,A001 Георги Ив.,Пловдив,B002 Ели,Варна,C003

German · claude-sonnet-5-5

Before

Müller 12,50 0007 Weiß 1.250,00 0012 Grün 007,5 0100

After

name,betrag,menge Müller,"12,50",0007 Weiß,"1.250,00",0012 Grün,"007,5",0100

Spanish · claude-sonnet-5-5

Before

José Málaga 41 Peña Sevilla 7 Ñandú León 30

After

nombre,ciudad,edad José,Málaga,41 Peña,Sevilla,7 Ñandú,León,30

What is in the file

  • Hard rules
  • Reading the spec
  • Cutting a cell
  • The output form
  • When to refuse
  • Work in this order
  • Short examples

Languages

Any language. Tried in: English, Bulgarian, German, Spanish.

License

Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing. Holder: Georgi Kalchev, aiskills402.com. Full terms.

Versions

Current version 1.0.0, updated 2026-10-08. Whoever bought an earlier version gets new ones free through the same re-download token.

  1. v1.0.0 · 2026-10-08

    First release: converts fixed-width text into RFC 4180 CSV from a column specification. Positions are 1-based and inclusive unless the spec says otherwise (start+length and 0-based forms are read as stated), counted in characters. Every cell is the exact characters of its positions: nothing is trimmed unless the spec says trim, leading zeros and inner spaces stay, numbers stay text, and an implied decimal becomes a point only where the spec states it. Values with a comma or quote are quoted. A line that does not fit the spec (short with no rule, long with no named filler, unnamed gap, overlap, tab, a byte-based spec meeting non-ASCII text, a signed overpunch digit) gets a fixed one-line CANNOT CONVERT answer.

    Rules checked on 2026-10-08 against RFC 4180 (read-only fetch: fields with commas, double quotes or line breaks are enclosed in double quotes; a quote inside is doubled; spaces are part of a field; the last line break is optional). Fixed-width layout has no governing standard, so the conventions are our own decisions, taken from Fable's brief 3.28 and stated in every test spec. Not tested: East Asian wide characters, combining sequences, rtrim of a field made only of spaces, a spec with an unstated counting convention, and the carriage-return-only line ending.

    Tests (24 cases: 18 traps including 7 refusals, 6 controls) written and the control run done on 2026-10-08, no model calls yet. Model results and the price check come after the queued run.

FAQ

Does it trim the padding of my fields?

Only where your spec says trim, for one column, a list of columns or the whole file, and it tells apart trimming both ends from trimming trailing spaces only. A column that is not named keeps every space it holds in the line, because in a fixed-width file the padding can be part of the data, for example a code that is compared with its padding. Leading zeros and numbers written with commas or dots stay exactly as they are; nothing is turned into a number.

What happens to accented letters, Cyrillic and emoji?

Each takes one position, the way a character does, whatever bytes it needs in a file. Columns after a name with accents therefore stay where the spec puts them. If your spec says its positions are bytes and the text holds only plain ASCII, the two counts agree and the file is converted. If the spec says bytes and some line holds a non-ASCII character, there are two readings, so you get a refusal that names the column, not a guess.

Does it help Claude Sonnet?

On the cases that need a refusal. We gave twenty-four fixed-width files with their specs to Sonnet and Haiku, each with and without the file. Without it, Sonnet cut columns well but guessed three times where no right answer exists: overlapping columns, byte positions that split a non-ASCII letter, and a gap the spec does not name. That is 21 right; with the file, 24. Haiku went from 20 to 23. Implied decimals are inserted when the spec says how many.

What if a line is shorter or longer than the spec?

You get one line starting with CANNOT CONVERT and naming the problem, unless the spec gives a rule: records may be short, in which case missing columns are empty, or a trailing part is named as filler, in which case it is ignored. A gap between columns that holds characters and is not named, overlapping columns and a tab in a line are refused the same way, because each would need a rule nobody gave.

Share

Read this page as Markdown: /skills/fixed-width-to-csv.md.

  • CSV Repair: Fix the Form, Keep Every Cell

    Data & Analysis

    SKILL.md · v1.0.0 · 8.3 KB

    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.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • HTML Table to CSV: Merged Cells and Entities Done Right

    Data & Analysis

    SKILL.md · v1.0.0 · 8.5 KB

    Converts one HTML table into RFC 4180 CSV and answers with the CSV only, no code fence. The header is the first row, every cell keeps the text a browser shows after entities are decoded (&, €, —, a no-break space), links, bold and other inline markup vanish and their text stays, a line-break tag becomes a space, and numbers such as 1,250 stay text in quotes. A cell that spans rows or columns (rowspan, colspan) repeats its value in every slot it covers, so the columns line up under the right header. Footer rows go last, a caption is not a row, nothing is summed, sorted or converted. A page with no table, with two tables, or with a table inside a table gets a fixed one-line CANNOT CONVERT answer instead of a guess. Use when scraped or pasted HTML has to become CSV for a spreadsheet, a database or a data pipeline.

    $0.02once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • CSV to JSON Rows: Every Cell Stays Text

    Data & Analysis

    SKILL.md · v1.0.0 · 8.6 KB

    Converts CSV into a JSON array with one object per row, keyed by the header, and answers with the JSON only, no code fence. Every value stays a string exactly as the cell reads, so 007, 1,250, 1.10, TRUE, null, dates, spaces around a name and a value that starts with an equals sign are never turned into numbers, booleans or null, and an empty cell is an empty string. Only a column the task names as integer, number or boolean is converted. Quotes are removed, doubled quotes become one quote, line breaks inside a quoted cell become backslash n. Semicolon and tab files, a byte order mark, CRLF rows and a trailing blank line are handled. A short or long row, a duplicate header name, an unclosed quote, a typed cell that does not fit its type and text that holds no table get a fixed one-line CANNOT CONVERT answer instead of invented or null values. Use when an agent must load a CSV export into code, an API or a database, or when asked to turn CSV into JSON.

    $0.03once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026