Conversation
Reverse-engineers a Shopify store's PDP template structure from a connected reference product. Identifies visible sections on the rendered page, maps each one to its Shopify source (standard field, specific metafield, or external theme/app content), classifies dynamic vs static, and defines the body_html assembly pattern for write-back. The Phase 1 Python script builds a deterministic evidence table by substring-matching every product field value against the rendered page, including recursive flattening of JSON metafields, joining of list metafields, and HTML stripping of rich_text metafields. The LLM uses the evidence plus a screenshot and rendered markdown to produce a structured template that validates against the declared JSON Schema. Validated end-to-end with Opus 4.7 against three real store archetypes (metafield-first, body_html-heavy, theme-component). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New skill: map-pdp-structure. Reverse-engineers a Shopify store's PDP structure from a connected reference product and produces a structured content template. Downstream PDP skills (rewrite-pdp-copy, write-product-descriptions, audit-pdp) consume this template to know where to read from and write to in Shopify.
One-time-per-store setup skill. Architecture doc calls it the highest-stakes piece of the Run experience; authored with that in mind.
What's in it
SKILL.md— goal-led brief for the model, self-contained for a fresh session.skillshelf.yaml— metadata (category: catalog-operations, platforms: shopify, level: intermediate).references/build_evidence_table.py— stdlib-only Phase 1 script. Chunks body_html on block elements, normalizes metafield values per type (JSON leaves, list items, rich_text strip, reference flagging), substring-matches every field value against the rendered page, and emits evidence + static/dynamic candidates.references/output-schema.yaml— JSON Schema (draft 2020-12) enforcing the template shape with conditional requirements (metafield sources need namespace.key + type; external sources need source_detail; heading wrappers need heading text).references/example-output.md— a worked example using the synthetic GreatOutdoors Co. cast per CLAUDE.md's no-real-brands rule.End-to-end validation
Ran against three real stores covering the three PDP archetypes (metafield-first, body_html-heavy, theme-component) using Opus 4.7. All three produced schema-valid templates. Real-store data stayed outside the repo (scratch only, never committed).
Follow-up (platform-side, not in this PR)
The site repo companion PR wires up the execution config, data-key entry, and uses new execution-schema fields (
format: structured,schema: skill,data_key,shopify_productinput types, optionalread_themesscope) that the current Zod schema insite/src/data/skill-meta.tsdoesn't yet accept. Schema extension is tracked as pre-requisite platform work.Test plan
python3 references/build_evidence_table.py --product-data <json> --rendered-pages <md> --output out.jsonruns against a sample product JSON + Jina markdown without errorreferences/output-schema.yamlparses as valid JSON Schema draft 2020-12references/example-output.md's embedded JSON validates againstreferences/output-schema.yaml🤖 Generated with Claude Code