Data & Analysis

Env File Repair: Fix the Form, Keep Every Value

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 the Form, Keep Every Value is a tested 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.0 · 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, INI header and leading-zero number. It missed three: on a valid file it put a backslash before a dollar sign and rewrote a ${HOME} reference (changing the loaded values), it turned an INI file with yes and 0080 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 password 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), joined the key pasted over four lines, 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, joining, 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.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 .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. It slipped on valid files it should have left alone (a backslash before a dollar sign, a ${HOME} reference rewritten, yes and 0080 turned into true and 80, 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.

Share

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

  • YAML Repair: Fix It, Keep Every Value

    Data & Analysis

    SKILL.md · v1.0.0 · 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 It, 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 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