# Env File Repair: Fix the Form, Keep Every Value

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.

- Page: https://aiskills402.com/skills/env-file-repair
- Category: Data & Analysis (https://aiskills402.com/categories/data)
- Price: $0.05 once, USD-priced, paid in USDC on Base over x402. Price as loaded on this page. The 402 response your agent receives is authoritative.
- Version: 1.0.0
- Card (JSON): https://api.aiskills402.com/v1/skills/env-file-repair

## Use it when

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.

## 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.

- Strong model (claude-sonnet-5-5 (Claude Code alias "sonnet")): 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.
- Weak model (claude-haiku-5-5 (Claude Code alias "haiku")): 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.

Note: Twenty-four small config files written by us (17 with a defect, 7 valid files that must stay as they are): hash signs, quote styles, trailing spaces, open quotes, a key over several lines, INI headers, numbers with leading zeros, a planted order inside a value, a pasted fence, and five that cannot be repaired without a guess. Each answer is scored by code: the file is parsed with the dotenv package (or the ini package for INI cases) and the whole result must equal the intended variables and values, so any valid way of writing the same values passes; comment lines, export prefixes and the absence of a code fence are checked on top; a refusal must be one line starting CANNOT REPAIR:. Facts re-checked on 2026-10-08: the dotenv README and parser behaviour (hash, quotes, backticks, multi-line, last duplicate wins), the Python configparser documentation. Owner-measured and not re-checked: the policy to keep deliberate trailing spaces, backticks for mixed quotes and single quotes for Windows paths (parser-measured, not in the README); closing an open quote at the end of its line when no later line holds it is the skill own rule. The first run gave the models no way to refuse, so the five refusal setups were given a task sentence that allows a CANNOT REPAIR reply and re-run with both models on both sides; the numbers cover all 24. No check was widened. One run per model and file.

### With and without the skill

Tested 2026-10-08.

- Files repaired or refused right (24 files): Sonnet 24/24 with, 19/24 without; Haiku 23/24 with, 20/24 without.

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.

Full summary: https://aiskills402.com/skills/env-file-repair/tests

## Example

### 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

## How to buy

Agent (HTTP):

1. GET https://api.aiskills402.com/v1/skills/env-file-repair/file without a payment header. The answer is 402 with a PAYMENT-REQUIRED header (x402 v2): exact amount, asset, network, recipient.
2. Sign `accepts[0]` with an x402 client (for example @x402/core + @x402/evm).
3. Repeat the GET with the signature in the PAYMENT-SIGNATURE header. The answer is 200 with the file, its sha256 and a re-download token.

Agent (MCP): https://mcp.aiskills402.com/mcp — free tools search_skills, get_skill, redownload_skill. Buying itself is over HTTP.

Full flow: https://aiskills402.com/docs

## The file

- Version: 1.0.0
- Size: 10.4 KB (10608 bytes)
- SHA-256: 47f8a324556fa80f572fce6c345dd517947952b19c5030d3283a221ba1aa2beb
- Updated: 2026-10-08
- New versions are free through your re-download token.

## Versions

### 1.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.

## License

Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing. Holder: Georgi Kalchev, aiskills402.com. Terms: https://aiskills402.com/docs#license

## 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.

## Related skills

- [YAML Repair: Fix It, Keep Every Value](https://aiskills402.com/skills/yaml-repair.md): $0.05 once
- [JSON Repair: Fix It, Keep Every Value](https://aiskills402.com/skills/json-repair.md): $0.05 once
- [CSV Repair: Fix the Form, Keep Every Cell](https://aiskills402.com/skills/csv-repair.md): $0.05 once

## Measurement limits

- Models other than the two named above were not run.
- Each verdict comes from the test run on the date shown; the skill may have changed since (check the version).
- Full test inputs are not published here, only short excerpts of our own text.
- Results on your own texts, languages and domains can differ.

Offer note: Paid in USDC (USD-pegged) over x402 by an AI agent; one-time.
