ctr-json-normalizer
Normalize the final JSON output of a single-session CTR product-card click diagnosis. Use after the diagnosis draft is complete and before replying, whenever the report must contain exactly the agreed query, clicked item, unclicked items, five fixed dimensions, structured suggestions, and limitations.
Latest: v0.1.0
Initial release of ctr-json-normalizer Skill.
- Normalizes and validates JSON output for CTR product-card click diagnosis.
- Ensures the report contains exactly the required fields: query, clicked item, unclicked items, five fixed dimensions, structured suggestions, and limitations.
- Designed as the final step after diagnosis drafting, before responding.
- Automatic error handling: script returns "error" if the output does not meet requirements.
- Does not fetch images, infer causes, or generate new business suggestions.
CTR JSON Normalizer
Run this Skill once as the final step of every CTR diagnosis. It formats and validates a completed diagnosis; it does not fetch images, compare products, infer causes, or write new business suggestions.
Input
Pass one JSON object through stdin:
{
"session": { "query": "", "clicked_item_id": "", "items": [] },
"report": { }
}
report may be a JSON object or a JSON string. session.items must be the original card list, with item_id, position, and clicked where available.
Run
python3 scripts/normalize_ctr_report.py <<'JSON'
{ "session": { "query": "...", "clicked_item_id": "...", "items": [] }, "report": {} }
JSON
Required Workflow
- Finish all comparison and image-fact collection first.
- Build the diagnosis draft as JSON, using evidence already collected.
- Run
scripts/normalize_ctr_report.pywith the original session and the draft. - If it returns
error, fix the draft JSON and run it again. - Return the script stdout verbatim. Do not wrap it in Markdown or append explanatory text.
The script fixes only the report envelope: root fields, candidate item coverage, dimension order, allowed status values, suggestion field shape, and limitations. A missing dimension becomes unknown with no suggestion; no factual claim is invented.
