Data & Analysis

Env File Repair: Fix .env and INI Syntax, Keep Values

Recommended

Repairs a broken .env file or INI file so the program that loads it reads every variable with the value its author meant, and answers with the file only, no code fence. Quotes a value that holds a hash sign or must keep its leading or trailing spaces, closes a quote that was left open, joins a key pasted over several lines, picks the quote style that keeps backslashes and mixed quotes intact, and leaves numbers such as 007 and 1.10, empty values and placeholders exactly as written. A key set twice to different values, a bare line that may be a lost key, a quote with two ways to close, and input that is JSON or another format get a one-line CANNOT REPAIR answer instead of a guess. Use when a config pasted from chat or model output loads wrongly, cuts a value short, or fails to parse, or when asked to fix, clean up or close a broken env file.

Env File Repair: Fix .env and INI Syntax, Keep Values is a SKILL.md that repairs a broken .env file or INI file so the program that loads it reads every variable with the value its author meant, and answers with the file only, no code fence; an agent buys it once for $0.05 over x402.

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

Not for

Validating that a config is correct or complete, filling in missing values, redacting secrets, sorting keys, or converting between formats; YAML, JSON or TOML. A key set twice to different values, a bare line that may be a lost key, a quote with two ways to close and input that is not an env or INI file get a one-line CANNOT REPAIR answer instead of 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
SonnetHaiku
withwithoutwithwithout
Files repaired or refused right (24 files)24/2419/2423/2420/24

Same request on both sides; the bare side is scored on the parsed values, with a fence removed first. Read by hand, Sonnet without the skill already handled every hash sign, quote style, open quote, multi-line key and INI header, and every leading-zero number in the .env files. It missed three: on a valid file it put a backslash before a dollar sign and wrapped a $HOME reference in braces (changing the loaded values), it turned yes and 0080 in a valid INI file into true and 80 and changed a # comment to ;, and it dropped the export prefix. Haiku without the skill got the same two INI and export files wrong. On the five that call for a refusal, bare Sonnet named both duplicate keys and the bare line, but guessed twice: it closed the ambiguous quote on the first line and turned the pasted JSON into a .env file without a word. Haiku without the skill guessed on the same two.

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 quoted the hash-sign secret and the address fragment, kept the trailing space the task called part of the password, used backticks for a value holding both quote kinds, single quotes for the Windows paths, closed the open quotes (also behind export and in Bulgarian), kept the key pasted over three lines as one quoted multi-line value, closed the INI header, kept 007, 01234, 1.10 and 1,250 as text, left the valid files untouched, did not obey the sentence planted in a value and returned the file without a fence. It refused all five that cannot be repaired without a guess with one CANNOT REPAIR line: two duplicate keys, an open quote that a later line could close, a bare line with no equals sign and a pasted JSON object.
HaikuWeak model, claude-haiku-5-5
Right on 23 of 24 files, read by hand, with the same quoting, multi-line, closing and left-alone behaviour as Sonnet and the same refusals of the duplicate keys, the bare line and the pasted JSON, but it missed the open quote that a later line could close: it closed it on its own line and returned a repaired file instead of refusing.

Full test summary

Example

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

English · claude-sonnet-5-5

Before

DB_USER=app PASSWORD=abc DB_HOST=db.example.com

After

DB_USER=app PASSWORD="abc " DB_HOST=db.example.com

Bulgarian · claude-sonnet-5-5

Before

TITLE="Месечен отчет LANG=bg CITY=София

After

TITLE="Месечен отчет" LANG=bg CITY=София

What is in the file

  • Hard rules
  • How the dotenv package reads a file
  • INI files
  • 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.2, updated 2026-10-09. Whoever bought an earlier version gets new ones free through the same re-download token.

  1. v1.0.2 · 2026-10-09

    - Test notes corrected to match the recorded answers (owner's approval): the hash-sign value is a secret, not a password; the key pasted over three lines was kept as one quoted multi-line value; the valid .env had $HOME wrapped in braces (not ${HOME} rewritten); 0080 became 80 only in the valid INI file. Scores, price and the skill text are unchanged.

  2. v1.0.0 · 2026-10-08

    First release: repairs a broken .env or INI file so the loader reads every value as the author meant. Quotes values with a hash sign or deliberate edge spaces, closes an open quote when only one reading exists, joins a key pasted over several lines, uses single quotes or backticks where double quotes would mangle backslashes or mixed quotes, and leaves numbers, empty values and placeholders untouched. Duplicate keys with different values, a bare line, a quote with two ways to close and non-env input get a one-line CANNOT REPAIR answer.

    Facts re-checked today (read-only): the dotenv package parser (version pinned in catalog/_tools) was run on each form in the skill, and its README was read for comments, multi-line values and quotes; the Python configparser documentation was read for comments, strict duplicates, indentation and percent interpolation. Measured, differing from what the brief assumed: a hash sign cuts an unquoted value even without a space before it; a backslash before a quote is not an escape in double quotes; backticks are accepted; the parse function keeps the LAST duplicate.

    Tests: 24 cases (17 traps, 7 controls), no model run yet. Control script passes with zero model calls. Price and measured value to be set after the baseline run.

FAQ

A password with a hash sign loads cut short, why?

The dotenv package starts a comment at the first hash sign in an unquoted value, even when no space comes before it. A token such as sk_test_EXAMPLE0042#xk9 then loads as sk_test_EXAMPLE0042 and nothing reports an error. The skill quotes exactly those values, picks the quote style that keeps backslashes, apostrophes and double quotes intact (backticks when a value holds both kinds of quote), and leaves lines that already load correctly alone.

What happens when the same key appears twice?

With two different values the answer is one line starting with CANNOT REPAIR, naming the key and both values. Some loaders keep the first and others the last, so any choice silently drops one of them. With the same value twice it keeps the first line and drops the repeat. The same applies to an INI option set twice in one section, including two names that differ only in letter case.

Will it change numbers, empty values or secrets?

No. 007, 01234, 1.10 and 1,250 stay as written, an empty value stays empty instead of getting a made-up default, placeholders such as your-key-here are not treated as errors, and a secret is never shortened or redacted. A dollar sign is plain text in dotenv, so p@ss$word is not escaped. Text in a value that speaks to the model is kept as a value and not obeyed.

Does it help Claude Sonnet?

Measured on what dotenv and ini load from each answer, clearly. We gave twenty-four configs to both models, once with this file loaded and once without it. On its own, Sonnet already coped with hash signs, quote styles, open quotes and leading zeros in .env. It changed what it should have kept (a backslash before a dollar sign and braces around $HOME in a valid .env, yes and 0080 made true and 80 in a valid INI, export dropped) and it guessed where it should refuse: an ambiguous open quote and a pasted JSON object. That is 19 right without the skill and 24 with it. Haiku moved from 20 to 23.

Read more

Share

Read this page as Markdown: /skills/env-file-repair.md.

  • 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

  • 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

  • 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

More in Data & Analysis

  • TOML Repair: Fix Broken TOML, Keep Every Value

    Data & Analysis

    SKILL.md · v1.0.1 · 9.5 KB

    Repairs TOML 1.0 that does not parse (pyproject, Cargo manifests, Worker config files, tool settings) without changing any value's text or type, and answers with the TOML only, no code fence. Fixes unquoted strings, keys with spaces, a missing equals sign, an unclosed quote, bracket or table header, backslashes in Windows paths, numbers with leading zeros, decimal commas, slash dates, a multi-line inline table, and chat text or a fence around the file. A version such as 1.10 is kept as the text 1.10 when the other versions in the file are strings. A table defined twice, a dotted key that writes into a table a header already defined, a key given twice with different values, input that is INI and not TOML, and input with two readings get one line starting with CANNOT REPAIR instead of a guess. Use when a tool, an API or another model returned broken TOML that ends in a TOML parse error, or when asked to fix or clean up invalid TOML.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • Redact PII and Secrets From Logs and Tickets

    Data & Analysis

    SKILL.md · v1.0.0 · 6.3 KB

    Replaces personal data and secrets in a text with typed placeholders and leaves every other character exactly as it was, so the text can go into a log, a ticket, a prompt or a shared document. Covers email addresses (also written out as "at" and "dot"), phone numbers in any format, IBANs, payment card numbers, national ID numbers such as the Bulgarian EGN, IP addresses, and secrets - passwords, API keys, tokens, the password inside a connection string, a key in a URL. Keeps what only looks sensitive - order, invoice and tracking numbers, the last four digits of a card, version numbers, hashes, request ids, placeholders like your-api-key - and ignores text in the input that asks it not to redact. Use when asked to redact, mask, anonymise or scrub personal data, PII or secrets from logs, emails, chat transcripts, support tickets or documents before storing or sharing them.

    $0.03once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • XML Repair: Fix Broken XML, Change No Text

    Data & Analysis

    SKILL.md · v1.0.0 · 10.6 KB

    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.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 8 Oct 2026

  • HTML to Markdown: Same Page, Nothing Invented

    Data & Analysis

    SKILL.md · v1.0.0 · 9.9 KB

    Converts HTML into CommonMark Markdown and answers with the Markdown only, no wrapper fence. Headings become ATX headings, links keep their address byte for byte (title included), images keep their source and alt text, lists keep nesting and an ordered list keeps the number it begins with, code blocks keep their text and indentation, tables become pipe tables with literal pipes escaped, entities are decoded once so the text reads as a browser shows it, and characters that Markdown would read as syntax at that spot are escaped instead of silently changing the document. Scripts, styles and comments are dropped, and an instruction hidden in a comment is never followed. Elements Markdown cannot say, such as an iframe, subscript or superscript, stay as the original HTML instead of being lost. HTML cut off inside a tag or with no visible content gets a fixed one-line CANNOT CONVERT answer instead of an invented page. Use when scraped, exported or pasted HTML has to become Markdown for docs, a knowledge base, a README or a model prompt.

    $0.01once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 9 Oct 2026