agentleFS
vectaosporleyvectaosporley/failstop/skills/probe-before-parse/SKILL.md

probe-before-parse

Skill0 starsChanged 4 months agoMITView on GitHub

Read the real shape of data before writing a parser for it. Trigger before writing any code that reads JSON, a log, an API response, a config file, or any structured data whose format you have not just inspected. Also trigger when about to quote a field name or a count from a data source. Prevents the failure mode where a parser is written against an assumed schema and returns plausible-but-wrong results.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before writing a parser:

    line 21
  2. Distinctive:

    Write the parser against that, not against memory.

    line 26
  3. Distinctive:

    If you are about to state a count, a rate, or a status that a tool produced: confirm the field you are reading is the field you think it is.

    line 40
  4. Very specific:

    If you find yourself writing data["result"]["items"] without having seen that structure in this session, stop.

    line 46

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Probe before you parse

The failure this prevents was measured, twice in one session:

  • A payload was nested one level deeper than assumed. The function returned the wrapper's keys and looked correct.
  • A log's success field was not named what the surrounding code implied. A parser written by analogy would have reported 0 successes out of 448 instead of 446.

The rule

Look at the actual data before you write the code that reads it. One real record beats any assumption about the format.

How

Before writing a parser:

  1. Print or read one real record — the actual bytes, the actual keys, the actual nesting.
  2. Note the exact field names. Not what they should be called — what they are called.
  3. Note the shape: is it a list of dicts? a dict of dicts? nested how deep?
  4. Write the parser against that, not against memory.
# JSON: what are the real top-level keys?
python3 -c "import json; d=json.load(open('file.json')); print(type(d).__name__, list(d)[:8])"

# JSONL: what does one line actually contain?
head -1 file.jsonl | python3 -c "import json,sys; print(list(json.loads(sys.stdin.read())))"

# An API/tool response: capture it once, inspect, then parse.

Before quoting a number

If you are about to state a count, a rate, or a status that a tool produced: confirm the field you are reading is the field you think it is. "exito" is not "ok". A wrapper's keys are not the data's keys.

The tell

If you find yourself writing data["result"]["items"] without having seen that structure in this session, stop. You are parsing from memory. Probe first.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.