Data & Analysis

Markdown Table Repair: Fix the Table, Keep Every Cell

Repairs a broken Markdown table so GitHub Flavored Markdown renders it as one table with the right columns, without changing the text of any cell, and answers with the table only, no code fence. Adds a missing or malformed alignment row and keeps the alignment colons it finds, adds the missing leading and trailing pipes, escapes a literal pipe inside a cell as backslash-pipe (also inside inline code), pads a short row with empty cells without moving a cell, and turns a tab-separated or HTML table into a Markdown table. Bold, links, code, emoji, numbers such as 007 and 1.10, backslashes and double spaces inside a cell stay exactly as written. A row with more cells than the header, an alignment row that cannot be matched to its columns, a pipe that cannot be told from a border and text with no table get a fixed one-line CANNOT REPAIR answer instead of a guess that moves data between columns. Use when a README, wiki page or another model's answer shows a table as plain text with pipes, or when asked to fix, clean up or convert a table to Markdown.

Markdown Table Repair: Fix the Table, Keep Every Cell is a SKILL.md that repairs a broken Markdown table so GitHub Flavored Markdown renders it as one table with the right columns, without changing the text of any cell, and answers with the table only, no code fence; an agent buys it once for $0.05 over x402.

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

Not for

Checking numbers, sorting rows, merging columns, changing alignment or translating cells; spreadsheets; CSV (use csv-repair). Longer rows, unmatched delimiter rows with colons, ambiguous pipes and text with no table get a CANNOT REPAIR line. A table not rendering or a tab-separated to Markdown table job is in scope. Follows the GitHub Flavored Markdown tables extension.

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
Tables repaired right (21 tables)21/2117/2120/2117/21

Same request on both sides; the bare side is scored on the table in any phrasing, fence removed first, and a clear refusal in any words is accepted where the skill refuses. Read by hand, Sonnet without the skill did the 17 plain repairs alone: missing alignment row, pipes in code and HTML cells, numbers and spaces untouched, tabs, short rows, the planted order. It missed the four places where the honest answer is a refusal: it invented a column for a row with one cell too many (English and Bulgarian), guessed a third alignment for two colons over three columns, and built a table out of a sentence. Haiku without the skill missed the same four, merging the extra cell into its neighbour, adding an empty header, guessing the alignment. Haiku with the skill still added an empty fourth cell to a tab-separated line.

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 21 setups, read by hand: it added the missing alignment row, escaped the pipe inside inline code and inside an HTML cell, kept 007, 1.10, 1,250, the double spaces and the backslashes in a path, turned tab-separated text into a table, padded short rows at the end, ignored a planted cell that told it to reply OK, and answered the fixed CANNOT REPAIR line for a row with one cell too many (English and Bulgarian), for an alignment row with two colons over three columns, and for a sentence that only mentions a pipe.
HaikuWeak model, claude-haiku-5-5
Right on 20 of 21 by the skill's own checks, but it missed one detail on the tab-separated text: it turned the short last line into a table row with a fourth, empty cell, so that row is wider than the header. The cell text was right and every other setup matched, including the refusals for the long row, the unmatched alignment row and the sentence with a pipe.

Full test summary

Example

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

English · claude-sonnet-5-5

Before

| call | note | | --- | --- | | `a|b` | ok | | `x` | fine |

After

| call | note | | --- | --- | | `a\|b` | ok | | `x` | fine |

Bulgarian · claude-sonnet-5-5

Before

| продукт | цена | | --- | --- | | Хляб | 2 | | Мляко | прясно | 3 |

After

CANNOT REPAIR: row 2 has 3 cells, the header has 2

German · claude-sonnet-5-5

Before

Straße | Ort | Nr Müllerweg | Köln | 12 Große Gasse | Düsseldorf | 7

After

| Straße | Ort | Nr | | --- | --- | --- | | Müllerweg | Köln | 12 | | Große Gasse | Düsseldorf | 7 |

Spanish · claude-sonnet-5-5

Before

| Nº | Nombre | Ciudad | | --- | :-: | --- | | 1 | José | Málaga | | 2 | Lucía | |

After

| Nº | Nombre | Ciudad | | --- | :-: | --- | | 1 | José | Málaga | | 2 | Lucía | |

What is in the file

  • Hard rules
  • What the renderer needs
  • The output form
  • Repairs
  • When to refuse
  • Work in this order
  • Short examples

Also as a pay-per-call API

$0.003 per call. No model runs: the answer is deterministic.

POST https://api.aiskills402.com/v1/run/markdown-table-repair

One payment buys one call on one input. If the input cannot be handled, the answer is a refusal that starts with "CANNOT …" and says why; that refusal is a result, and it is paid like any other.

Free example and input schema. The SKILL.md file is still sold separately, once, for people who want the rules themselves. The protocol is in the docs.

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: repairs a broken Markdown table so GitHub Flavored Markdown renders it as one table with the right columns, without changing the text of any cell. Adds a missing or malformed alignment row and keeps alignment colons, adds missing pipes, escapes a literal pipe (also inside inline code) when it is clear which cell it belongs to, pads a short row at the end, turns tab-separated and HTML tables into Markdown tables. A longer row, a delimiter row with colons that does not match the header, an ambiguous pipe and text with no table get a fixed one-line CANNOT REPAIR answer.

    Rules checked on 2026-10-08 against the GitHub Flavored Markdown specification, tables extension (read-only fetch): header plus delimiter row of equal cell count, optional edge pipes, trimmed spaces, escaped pipes also inside code and bold, short rows padded and long rows cut by the renderer, table ends at the first empty line. Our own decisions: refusal on a longer row, the clear-pipe rule, completing a short colon-free delimiter row.

    Test set: 21 cases (15 traps, 6 controls); control.mjs makes no model call and passes. No model measurement yet; the price below is the starting price (class B), to be set after the baseline.

FAQ

Why does a row with one cell too many get a refusal?

GitHub Flavored Markdown drops a surplus cell without any warning, and an unescaped pipe in plain text looks exactly like a border. The surplus value might be part of the product name, a note or the price, and each choice leaves a different number under a different heading. So the skill names the offending row in a CANNOT REPAIR line and a person decides. The same line answers a delimiter row whose colons cannot be matched to the header cells, and a paragraph that merely mentions a pipe, because a renderer would build a table from nothing.

Does it touch my numbers, links and code?

No cell text is rewritten. Zeros before a number, a trailing zero after a decimal point, bold text, links, inline code and emoji stay as typed, a backslash stays a backslash and a double space between two words stays too. Only the frame changes: the pipes at the edges, the alignment row, and empty cells at the end of a short row. A single edit to cell text is allowed, a backslash in front of a literal pipe inside inline code, and only when that gives the row exactly the header width. Anything else that looks wrong in a cell is left for a person to judge.

What about tab-separated text and HTML tables?

Both become a Markdown table: the first line or the header cells form the header row, each tab or cell is a border, the tags are dropped and the text is kept. A pipe inside such a cell is escaped, because the cell is already delimited by the tab or the tag and there is no doubt where it belongs. An HTML cell with a line break in it is refused, because a Markdown cell has no line breaks.

Does it help Claude Sonnet?

Where a guess is the wrong answer, yes. Bare Sonnet scored 17 of 21 tables; with the skill it scored all 21. The plain repairs it did alone: alignment row, pipe inside code, 007 and 1.10 kept, tabs, a cell giving orders. It missed four: a row with one cell too many (it invented a column, in English and Bulgarian), two colons over three columns (it guessed a third) and a sentence that only mentions a pipe (it built a table). Haiku went from 17 to 20 of 21, but one tab-separated line got an empty fourth cell.

Read more

Share

Read this page as Markdown: /skills/markdown-table-repair.md.

  • CSV Repair: Fix Broken CSV, 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

  • JSON Repair: Fix Broken JSON, Keep Every Value

    Data & Analysis

    SKILL.md · v1.0.1 · 6.9 KB

    Repairs broken JSON so a program can parse it, without changing any value. Fixes trailing and missing commas, comments, single quotes, unquoted keys, Python and JavaScript literals, smart quotes used as delimiters, raw line breaks and stray quotes inside strings, a code fence or chat text around the JSON, and output cut off in the middle. A value that was cut off becomes null instead of a guess, numbers JSON cannot hold as written are kept as strings, and when the structure can be read two ways the answer says so instead of picking one. Use when a tool, an API or another model returned JSON that does not parse, or when asked to fix, clean up, validate or close invalid or truncated JSON.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 7 Oct 2026

  • YAML Repair: Fix Broken YAML, Keep Every Value

    Data & Analysis

    SKILL.md · v1.0.1 · 8.4 KB

    Repairs broken YAML and Markdown front matter so a program can parse it, without changing any value's text or type, and answers with the YAML only, no code fence. Fixes tabs used as indentation, indentation that fits no parent, a missing closing quote or bracket, values that need quotes (a colon inside, a leading star or at sign), and output cut off in the middle, where the cut value is kept as cut and never completed. Yes, no, on, off and NO stay strings, 1,250 stays a string, 1.10 and 01234 stay as written. Duplicate keys, input that is not YAML, and input with two readings get a fixed one-line answer instead of a guess. Use when a tool, an API or another model returned YAML or front matter that does not parse, or when asked to fix, clean up or close invalid or truncated YAML.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

More in Data & Analysis

  • JSON to CSV: Flatten Nested Records, Keep Every Value

    Data & Analysis

    SKILL.md · v1.0.0 · 9.4 KB

    Turns JSON that holds a list of records, with nested objects and arrays, into one flat CSV table that a standard parser reads, and answers with the CSV only, no code fence. Nested keys become dotted column names such as address.town, array elements become index columns such as tags.0 and tags.1, or one cell joined with a separator, or one row per element when asked to explode. Numbers are copied as the JSON token (1.10 stays 1.10, 1e5 stays 1e5, -0 stays -0), true and false stay lowercase text, null and a missing key become an empty cell, a string such as 007 or 1,250 stays exactly as written. Columns follow the order in which keys first appear, so a key that shows up only in the last record still gets its column. A field that is a string in one record and an object in another, a dotted key that collides with a nested path, a list holding something other than records and JSON that is cut off get a fixed one-line CANNOT FLATTEN answer instead of a guess. Use when asked to convert, export, flatten or tabulate JSON or an API response as CSV for a sheet, a database import or a report.

    $0.03once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • JSON Lines Repair: One Record Per Line

    Data & Analysis

    SKILL.md · v1.0.0 · 8.0 KB

    Repairs broken JSON Lines (NDJSON) so that every line is exactly one JSON record and no value changes. Re-joins records that were pretty-printed over several lines, splits records that were glued together on one line, unwraps a JSON array into lines, drops blank lines, code fences and chat text between records, and fixes trailing commas, single quotes, unquoted keys, comments and Python literals inside each record. Numbers are copied as written, never re-serialised. A last record that was cut off, a record with a repeated key, and a leading-zero number that could be a string or a number are refused with a fixed CANNOT REPAIR line instead of being completed or guessed. Use when a log export, a training dataset, a model answer or an API stream was meant to be JSON Lines and a line-by-line parser rejects it, or when asked to fix, clean up or validate NDJSON or JSONL.

    $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

  • JSON Schema From Examples: No Over-Constraining

    Data & Analysis

    SKILL.md · v1.0.0 · 9.4 KB

    Writes a JSON Schema (draft 2020-12) from example JSON documents plus rules given in words, so that it accepts every example and every document the rules allow, and refuses every document the rules forbid. Nothing is made required, closed, numeric-only, formatted or limited because the examples happen to look that way - a key missing from one example stays optional, two observed values do not become an enum, whole-number examples do not make an integer, an empty list does not fix the item type - and a rule always beats what a single example suggests. Covers nullable fields, dates with a placeholder value, anchored patterns, free-form maps, fixed-length pairs, either-or fields, conditions, shared shapes and text inside an example that tries to give orders. Answer is the bare schema, no fence. Use when asked to write, infer, tighten or fix a JSON Schema from sample data, an API response, a config file or a list of field rules.

    $0.02once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026