metafield-normalize

metafield-normalize is a command for Claude Code from jameywarren/shopify-claude-quickstart. It costs 16 tokens per session (507 once invoked), scanned A, original, MIT.

A command for finding and standardizing inconsistent metafield values across a product catalogue. It first audits the values, proposes mappings, and requires confirmation before changing data.

In plain words
What is it for?
Use it to count distinct values, review proposed canonical replacements, save snapshots and audit files, and normalize approved metafield data.
Why use it?
It prevents blind bulk edits and makes inconsistent entries visible before they are changed.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/jameywarren/shopify-claude-quickstart/metafield-normalize
Clone the repo
git clone --depth 1 https://github.com/jameywarren/shopify-claude-quickstart

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for metafield-normalize

README.md
[![agentmods](https://agentmods.dev/badge/commands/jameywarren/shopify-claude-quickstart/metafield-normalize.svg)](https://agentmods.dev/commands/jameywarren/shopify-claude-quickstart/metafield-normalize)
Your own site
<a href="https://agentmods.dev/commands/jameywarren/shopify-claude-quickstart/metafield-normalize"><img src="https://agentmods.dev/badge/commands/jameywarren/shopify-claude-quickstart/metafield-normalize.svg" alt="Measured on agentmods" height="20"></a>
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 507 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00016 $0.00507
Opus 5 $0.00008 $0.00253
Sonnet 5 $0.00003 $0.00101
Haiku 4.5 $0.00002 $0.00051

Measured 5d ago against content hash 4964cfc99824, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

metafield-normalize scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/metafield-normalize.md · 72 lines

What it actually says

Normalize the metafield $ARGUMENTS across all products. Work in four explicit phases. Do not skip ahead.


Phase 1 — Audit (read-only)

Query all products that have this metafield set. Collect every distinct value with its count.

Output as a markdown table:

Current value Count
Fly Fishing 412
fly fishing 87
Fly Fish 23
fishing 11

Save to store-data/audits/metafield-{namespace}-{key}-values.md.

Stop here. Do not proceed to Phase 2 until I confirm.


Phase 2 — Canonical mapping

Propose a canonical value list. Map every current value to its canonical form. Show as a table:

Current value → Canonical
Fly Fishing Fly Fishing
fly fishing Fly Fishing
Fly Fish Fly Fishing
fishing Fly Fishing

Flag any values you're unsure about for my review. I may override any mapping.

Save the proposed mapping to store-data/audits/metafield-{namespace}-{key}-mapping.md.

Stop here. Do not proceed to Phase 3 until I confirm the mapping.


Phase 3 — Export current state

Before touching anything, export all current metafield values to a snapshot file.

Query all products with this metafield and write a CSV: handle,product_id,current_value.

Save to store-data/exports/metafield-{namespace}-{key}-before-{YYYY-MM-DD}.csv.

This is the rollback source. Confirm the export completed before Phase 4.


Phase 4 — Apply (mutations, batches of 50)

Only after I say "apply":

  • Process products in batches of 50
  • For each batch: run productUpdate mutations with --allow-mutations
  • Report progress after each batch: Batch N/M complete — X products updated, Y errors
  • On any error: stop, report the error in full, wait for instruction before continuing
  • After all batches: output a summary with total updated, total skipped (already canonical), total errors

Do not start Phase 4 without explicit "apply" confirmation from me.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 72 lines · 16 tokens per session scan A 4964cfc99824

Subscribe to this mod's changes

metafield-normalize is a command published in the GitHub repository jameywarren/shopify-claude-quickstart (2 stars, last pushed 4mo ago), licensed MIT. It adds 16 tokens to every session and 507 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.