Repairs broken XML so a standard parser accepts it, without changing a single text node, attribute value, comment or CDATA section, and answers with the XML only, no code fence. Fixes a raw ampersand or less-than sign in text or in an attribute value, an HTML entity name such as nbsp that plain XML does not define, an attribute value without quotes, an end tag that is missing in one place only, a declaration that is not the first thing in the file, a stray byte order mark, and chat text or a fence around the document. Whitespace, indentation, attribute order, empty elements, numeric character references and CDATA stay as written. Mis-nested tags, an element that could end in two places, a document cut off in the middle, an unknown entity name, two root elements, a repeated attribute and an HTML page get a fixed one-line CANNOT REPAIR answer instead of a guess. Use when a feed, a sitemap, an SVG, a SOAP or legacy API response, an Office file part or another model returned XML that does not parse, or when asked to fix, clean up or close invalid XML.
XML Repair: Fix It, Change No Text is a tested SKILL.md that repairs broken XML so a standard parser accepts it, without changing a single text node, attribute value, comment or CDATA section, and answers with the XML only, no code fence; an agent buys it once for $0.05 over x402.
Not for
Anything beyond fixing malformed XML: validating against a schema or a DTD; XSLT, XPath or conversion to JSON; guessing text that was cut off; reformatting XML that already parses; HTML pages, which are refused. With two readings (overlapping tags, two roots, an unknown entity, a repeated attribute) you get one CANNOT REPAIR line naming the place, not a guess.
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 |
| with | without | with | without |
|---|
| Documents handled right (24 documents) |
| Documents handled right (24 documents) | 24/24 | 17/24 | 24/24 | 18/24 |
|---|
Same request on both sides; the bare side is scored on content, fence removed first. Read by hand, Sonnet without the skill did every plain repair and closed the two unclosed items as siblings without touching the text, which we accept. It missed the cases where the right answer is to stop: it re-nested overlapping tags, completed a cut-off title and feed, wrote the unknown entity as literal text, turned an HTML page into XHTML, wrapped two roots in an invented element and dropped one of two repeated attributes. It also rewrote the quotes and end tag of an already-valid SVG. Haiku without the skill showed the same six misses; its HTML conversion also moved elements. With the skill both models refused those seven cases with the one line and left valid files unchanged.
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 documents, read by hand: it escaped a raw ampersand in text and in a link value, mapped nbsp to a numeric reference without a second escape, quoted bare attribute values, closed the one missing end tag, moved a misplaced declaration to the first byte and kept the comment, answered with bare XML instead of the fenced chat reply, left a planted comment and a sentence that talks to the AI as plain text, and returned the six already-valid files untouched. It gave the one-line CANNOT REPAIR answer for overlapping tags, a cut-off feed, an unknown entity name, an HTML page, two roots, a repeated attribute and the items with no end tags.
- HaikuWeak model, claude-haiku-5-5
- Right on all 24 documents by the skill's own checks, read by hand. Every repair kept the text, the whitespace and the CDATA as written, the declaration was moved and not added, and the seven risky documents (overlap, cut-off, unknown entity, HTML page, two roots, repeated attribute, items without end tags) each got the fixed refusal line instead of a repair.
Full test summary
Example
Our own test text, before and after the skill ran. Excerpts only.
English · claude-sonnet-5-5
Before
<note>
<p>Say <b>hello <i>there</b> friend</i></p>
</note>
After
CANNOT REPAIR: the tags b and i overlap, two ways to nest them
Bulgarian · claude-sonnet-5-5
Before
<каталог>
<продукт код="007">Чай & мед — 1,250 лв.</продукт>
</каталог>
After
<каталог>
<продукт код="007">Чай & мед — 1,250 лв.</продукт>
</каталог>
What is in the file
- What well-formed means
- Hard rules
- Repairs
- When to refuse
- Work in this order
- Short examples
Languages
Any language. Tried in: English, Bulgarian.
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.
v1.0.0 · 2026-10-08
First release: repairs broken XML so a standard parser accepts it, without changing any text node, attribute value, comment, processing instruction or CDATA section. Escapes raw ampersands and less-than signs (in text and in attribute values), maps undefined HTML entity names to numeric references, quotes bare attribute values, closes an element that is missing its end tag in exactly one place, moves a misplaced declaration to the first byte, drops stray characters and chat text around the document. Whitespace, empty-element form, valid entities and CDATA stay as written. Mis-nested tags, ambiguous missing end tags, cut-off documents, unknown entities, two roots, repeated attributes and HTML pages get a fixed one-line CANNOT REPAIR answer.
Grammar facts re-checked on 2026-10-08 by a read-only fetch of the W3C Recommendation "Extensible Markup Language (XML) 1.0 (Fifth Edition)": one root and proper nesting (section 2.1), escaping of the ampersand and less-than sign and CDATA (sections 2.4 and 2.7), the element type match, unique attribute and legal character constraints (sections 3.1, 4.1), the declaration production (section 2.8), the byte order mark (section 4.3.3) and the entity declared constraint (section 4.1).
Price to be set after the baseline run (start $0.05).
FAQ
Will it re-indent, trim or tidy the XML?
No. Whitespace inside text is data, so a node that starts and ends with spaces keeps both, indentation stays, attribute order stays, and an empty element written with an end tag is not turned into a self-closing one. Valid entities and numeric references are left as written, and a CDATA section stays a CDATA section. Only the places that break the XML 1.0 rules are touched. Comments, processing instructions and the document type line survive untouched, so a stylesheet link or a generator note is still there afterwards.
What does it do with a raw ampersand or an nbsp?
A raw ampersand in text or in an attribute value becomes the entity for an ampersand, and a raw less-than sign becomes the entity for less-than. An HTML entity name that plain XML does not define, such as nbsp or copy, is written as the numeric reference of the same character. An ampersand that already starts a valid reference is not escaped a second time, so text is never double-escaped. A name it cannot map with certainty is refused.
When does it refuse instead of repairing?
When two readings give different documents: tags that overlap, items with no end tags that could be nested or siblings, a document cut off inside a title or a value, two root elements with no wrapper named, the same attribute twice, an unknown entity name, or an HTML page. A program can detect the refusal because the whole answer is one line beginning with the words CANNOT REPAIR and a short note on where the problem sits. A cut-off element is never completed, because a finished guess is new data.
Does it help Claude Sonnet?
It does: bare Sonnet handled 17 of our 24 broken documents, and all 24 once the skill was loaded. It already knew the plain repairs (ampersands, nbsp, bare attribute values, one missing end tag, a misplaced declaration) and closed two unclosed items as siblings without touching the text. It missed the cases where the right answer is to stop: it re-nested overlapping tags, completed a cut-off feed, turned an HTML page into XHTML, wrapped two roots in an invented element and dropped one of two repeated attributes. Haiku went from 18 to 24.