Lv.1 0 XP

PostToolUse Normalization — Consistent Data Across Heterogeneous Sources

Core 6 min +25 XP
💡
THE ANALOGY

An international airport's baggage system. Bags arrive in different shapes, sizes, and with different tags from dozens of airlines. The system normalizes everything to a standard barcode before routing — so every downstream process works the same way regardless of which airline sent the bag.

⚠️ EXAM TRAP — The Wrong Answer People Choose

Expecting Claude to handle data format inconsistencies gracefully in its reasoning. Claude can adapt, but inconsistent formats degrade accuracy and require Claude to make assumptions. PostToolUse normalization eliminates this problem at the source.

KEY POINTS
1 PostToolUse hooks run after tool execution, before Claude sees the result — the correct place for normalization.
2 Common normalization targets: timestamps (Unix → ISO 8601), status codes (numeric → string), currency (cents → dollars), inconsistent field names.
3 Normalization is transparent to Claude — it receives clean, consistent data without knowing it was transformed.
4 Define a canonical schema first, then write normalizers to convert from each source format to canonical.
5 Test normalization with null values, missing fields, and unexpected formats — edge cases will occur in production.