json-data-wrangling
Skill4 starsChanged 5 days agoMITView on GitHub
Flatten and normalize nested JSON exports (Firebase, API responses, event logs, NoSQL dumps) into tabular form — flattening nested objects with key-path column names, exploding arrays vs joining, type coercion, inconsistent/missing keys, schema inference across records, converting to CSV/Excel-ready tables or dataframes. Use when turning a nested JSON/dict export into a spreadsheet, CSV, or dataframe for analysis.
In this repository76 other files it gives its agents.
- AGENTS.mdAGENTS.md
- accounting-bookkeepingSkill
- agent-context-persistenceSkill
- asoSkill
- brainstorm-argumentationSkill
- brainstorm-debateSkill
- brainstorm-lensesSkill
- causal-inferenceSkill
- context-disciplineSkill
- creative-briefSkill
- customer-support-opsSkill
- data-quality-checksSkill
- design-fundamentalsSkill
- ecommerce-operationsSkill
- event-taxonomySkill
- exec-coding-standardsSkill
- exec-cppSkill
- exec-csharpSkill
- exec-deliverableSkill
- exec-github-actionsSkill
- exec-goSkill
- exec-jvmSkill
- exec-phpSkill
- exec-pythonSkill
- exec-rubySkill
- exec-rustSkill
- exec-self-testingSkill
- exec-swiftSkill
- exec-typescriptSkill
- executor-fallbackSkill
- exec-visualizationSkill
- fast-pathSkill
- final-reviewSkill
- financial-auditSkill
- hr-recruitingSkill
- influencer-strategySkill
- interview-ask-backSkill
- interview-elicitationSkill
- jev-assistSkill
- legal-contract-basicsSkill
- localization-copySkill
- manufacturing-ops-planningSkill
- marketing-attributionSkill
- media-planningSkill
- okr-planningSkill
- pack-game-analyticsSkill
- parallel-executionSkill
- performance-marketingSkill
- personal-financeSkill
- plan-architectureSkill
- plan-backlogSkill
- plan-research-firstSkill
- preflightSkill
- profile-contentSkill
- profile-designSkill
- profile-pilotSkill
- profile-planSkill
- real-estate-analysisSkill
- review-conformanceSkill
- review-dualSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Before flattening anything, name the unit of analysis.
- Distinctive: line 12
Every later choice (explode vs join, aggregation) follows from it.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.
Files
JSON Data Wrangling (nested export → table)
The core decision: one row per WHAT?
Before flattening anything, name the unit of analysis. A nested export mixes grains (user → orders → items); "flatten it" is meaningless until you choose the row grain. Every later choice (explode vs join, aggregation) follows from it.
Flattening rules
- Nested objects → dotted key-path columns:
user.address.city. Keep the full path; truncating to leaf names (city) collides silently when two branches share a leaf. - Arrays of scalars → either join into one cell (
"a;b;c", lossy but single-grain) or explode to rows (grain change — say so). Never mix both in one table. - Arrays of objects → separate child table with a foreign key back to the parent id, or explode with duplicated parent columns. Duplicated parent values mean parent-level aggregates must dedupe first — the classic double-counting trap.
- Dict-as-collection (Firebase pattern:
{"-Nx3f…": {...}, "-Nx4a…": {...}}) — the keys ARE ids, not fields: promote the key into anidcolumn, then flatten the values.
Schema inference across records
Records rarely share a schema. Scan ALL records (or a large sample) for the union of key paths before writing headers — inferring columns from the first record drops fields that appear later. Report per-column fill rate; a column present in 3% of rows is a schema question, not a data point.
Type coercion
- Distinguish missing key vs explicit
nullvs empty string — they mean different things in the source system; collapsing them silently loses information (flag which you merged). - Timestamps: detect epoch seconds vs milliseconds (13 digits ≈ ms) and normalize to one timezone-labeled format; mixed units in one column is the most common silent corruption.
- Numbers arriving as strings ("1,234", "12%"): coerce with a locale rule stated up front; count coercion failures rather than zero-filling them.
Excel/CSV output hygiene
- Escape/quote delimiters and newlines inside values; UTF-8 with BOM if Excel is the consumer.
- Long numeric ids (Firebase push ids are fine, but 16+ digit numerics) must be written as text — Excel silently rounds them past 15 digits.
- One sheet/file per grain; a "flattened" table that mixes parent and child grains is wrong even when it opens cleanly.
Failure modes — what wrong looks like
- Row counts change unexplainedly after flattening: an explode happened without being chosen.
- Aggregates double-count after an explode (parent columns duplicated across child rows).
- Columns missing because the first record lacked them.
- Ids corrupted by spreadsheet numeric coercion; epoch ms read as epoch s (dates in 56399 AD).
nullvs missing silently merged, then read as "user answered nothing".
Reviewer checklist
- Row grain stated; explode vs join decisions listed with their grain effects
- Column set derived from the union of records, with per-column fill rates
- Missing vs null vs empty distinguished or their merge explicitly declared
- Timestamps normalized with unit and timezone stated; coercion failures counted
- Long ids protected from spreadsheet numeric mangling
- Output row count reconciled against source record count (with the explode math shown)
Provenance: standard data-wrangling practice (tidy data, JSON normalization as in
pandas json_normalize); no external sources cited — derived from common tooling behavior.
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
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.

