BEAM

Seedlight BEAM: our framework for launching, automating and growing eCommerce platforms →

← All articles
AI EngineeringSzymon Żynda9 min read

Claude Code for eCommerce: cleaning a catalog CSV step by step

A messy catalog CSV export can be cleaned in a few passes: split variants, validate EAN/GTIN codes, normalize units and colors, repair encoding, generate slugs, flag duplicates and gaps. Here is the full process and how to brief it, on a copy of the data and with a diff review before you save.

You clean a messy catalog CSV export with Claude Code in a few passes: split variants into separate rows, verify EAN/GTIN check digits, normalize units and colors, repair broken encoding and quotes, generate slugs, then flag duplicates and gaps in the fields your channels require. Claude Code is an AI assistant that works on your files in the terminal, so it operates on the real file rather than in a chat window, which we cover in more depth in our guide to Claude Code in eCommerce. One rule holds throughout: work on a copy of the data and review every difference before you save anything. Here is the full process, step by step, and how to brief it.

CATALOG CSV · MESSY EXPORT TO CLEAN ROWSRAW EXPORTS,M,L in one cellEAN checksum?42cm / 0,42 mbroken encodingquotes, separatorsduplicates, gapsCLAUDE CODEsplit variantsvalidate GTINnormalize unitsfix encodinggenerate slugsflag dupes + gapsworks on the file, not a chatCLEAN CATALOGone row per variantvalid check digitsone unit formatclean UTF-8unique slugsflagged for reviewwork on a copy · review the diff before you save · no secrets in the file

Key takeaways

  • Claude Code cleans a catalog CSV in a few passes: it splits variants into rows, checks EAN/GTIN check digits, normalizes units and colors, repairs encoding, generates slugs, and flags duplicates and gaps.
  • You do not need to code. You describe the task in plain language: the target format, the rules, and one example of a messy row with its expected output. Claude Code runs the rest on the real file.
  • The one non-negotiable safety rule: work on a copy, keep the catalog under version control, review the diff before you save, and never put secrets or personal data in the files.
  • Claude Code flags and proposes; the decision stays with you. It will not invent a valid GTIN or a missing attribute, and that is correct, because those values come from a real source.

What Claude Code actually does with a catalog, and what it does not

The difference between Claude Code and a chat window comes down to one thing: a chat returns text you have to copy and paste yourself, while Claude Code reads your file, proposes changes, and after your approval writes them back to the file. It runs locally, on the data you give it, and performs repetitive operations across thousands of rows as patiently as across ten. It is not magic or an oracle, though: it does not know your assortment better than you do, it does not know that "ecru" and "cream" are the same color for you until you tell it, and it will not guess which column a sales channel actually requires. Treat it like a very meticulous assistant that executes clearly stated rules, not a consultant who will invent what your catalog should look like.

Cleaning a catalog is only one use for tools like this in day-to-day operations. Other workflows and skills worth keeping on hand are collected in our AI Library. Here we focus on one concrete task, because a messy export from a distributor or an old store is a problem that comes back for almost anyone migrating a catalog or listing an assortment in a new channel.

Rule number one: work on a copy

Never clean the original export. Make a copy and work on that, and ideally keep the catalog under version control (even a simple repository), so every change can be undone and compared. Do not put secrets into the files you share with the tool: API keys, passwords, tokens, or customer personal data. Claude Code reads exactly what you give it, so a clean product catalog is one thing, and a file with sensitive data is an entirely different decision.

How to brief it: input and expected output

The quality of the cleanup depends not on how "smart" the tool is, but on how precisely you describe the task. Do not ask it to "tidy up this file", because you will get someone else's idea of tidy. Instead describe three things: what you have on input (which columns, in what state), what the output should look like (target format, column names, separator, encoding), and the transformation rules (color dictionary, unit format, how to build SKUs and slugs). The most effective move is to show one example: take one messy row exactly as it is today and write next to it how it should look after cleaning. That example says more than a paragraph of description.

A briefing example in practice, described in words rather than a command: you have a row "Linen shirt | sizes: S,M,L | color: ecru", and you expect three separate rows, one per size, with the same color reduced to a single agreed name, each with its own variant SKU and its own slug, while keeping the link to the parent product. You add one more sentence worth repeating on every task: "show me the differences and flag anything you are unsure about instead of guessing". That single sentence turns a risky automation into a controlled process.

The cleaning process, step by step

The steps below follow roughly the order in which it is worth doing them: from row structure, through data validity, to the fields channels require. Run them in passes and check the differences after each one, rather than firing everything at once.

Split variants into separate rows

Exports often keep sizes and colors in a single cell, or in one row with a list of variants. You ask for a split into one row per actually sold variant, propagating shared fields (name, brand, parent description), assigning a variant SKU by your rule, and keeping the parent-child link. This is the most important step, because the correct number of rows determines everything downstream.

Validate EAN/GTIN codes (check digit)

An EAN-13 code (one form of GTIN) has its last digit computed from the preceding twelve using a weighted check-digit method. Claude Code recomputes that digit and flags codes that fail the check, have the wrong length, or repeat across products. The key boundary: the tool should flag bad codes, not "fix" them by appending a digit. A valid GTIN is a specific value from GS1 or the manufacturer, not a number to guess, so you verify the flagged codes and fill them from a real source.

Normalize units and colors

A single column can hold "42 cm", "42cm", and "0.42 m" side by side, and a color might be written as "ecru", "écru", and "cream" all at once. You provide a dictionary: the target unit format and a mapping of color names onto a controlled list. Claude Code reduces the values to one format according to that dictionary. You check the mappings, because this is where a costly mistake hides easily: "ecru" is not "white", and merging two colors into one too hastily can lose a real variant.

Repair encoding and quotes

Characters like "Å‚" or "Ä…" are a classic symptom of bad encoding (a file saved in one standard and read in another). Add to that "smart" quotes that break the CSV structure, plus unescaped separators and quotes inside fields. Claude Code re-encodes the file to UTF-8, repairs the mojibake, and cleans up quoting so that fields containing commas or quotes do not shift the columns. After this step you check one thing: that the number of rows and columns has not changed, because a quoting error can quietly merge two rows into one.

Generate slugs

A slug is part of the product URL, so it has to be clean and unique. You ask it to generate slugs from names: transliterate accented characters, lowercase, hyphens instead of spaces, remove special characters, and enforce uniqueness (appending a distinguishing suffix on collisions). You check that there are no collisions and that the slug has not dropped a meaningful part of the name that distinguishes variants.

Detect duplicates and gaps

Claude Code walks the catalog and flags duplicate SKUs, EANs, and names, along with empty fields that are required. It matters that it does this in a separate report column rather than deleting records silently. Whether a duplicate is an error or an intentional repeat, and whether the gaps can be filled, is a decision you make while looking at the flags.

Fill fields required by channels

Every channel (Allegro, Google, a marketplace) has its own list of attributes required for publishing. Claude Code maps your columns onto the channel requirements, flags what is missing, and proposes values where they can be derived from data you already have. Do not let it invent values that cannot be derived, such as a GTIN or a technical spec. Gaps of that kind you fill from a real source, and the tool should only point them out reliably.

Cheat sheet: problem, action, check

The whole process collects into one table. The right-hand column is the most important, because it is what keeps the automation from turning one mess into another.

Problem in the CSVWhat Claude Code doesWhat to check on its side
Variants in a single cell or rowSplits into one row per variant, propagates shared fields, assigns a variant SKUThat the variant count matches and nothing was lost in the split
EAN/GTIN codesRecomputes the check digit, flags invalid, wrong-length, and duplicate codesThat it flags rather than appends digits; verify flagged codes by hand
Units and colorsReduces to one format using the dictionary you provideThat the mappings are right (ecru is not white) and no two variants got merged
Encoding and quotesRepairs mojibake, encodes to UTF-8, cleans up quoting and separatorsThat the number of rows and columns is unchanged after the repair
SlugsGenerates from names, transliterates characters, enforces uniquenessNo collisions, and that the slug did not drop a meaningful part of the name
Duplicates and gapsFlags duplicate SKUs/EANs and empty required fields in a report columnThat it flags rather than deletes silently; you decide what to remove
Channel-required fieldsMaps columns, flags gaps, proposes values from existing dataThat it does not invent values (e.g. GTIN); fill gaps from a real source

The rule across the whole table: Claude Code flags and proposes, the decision to save stays with you.

Before you overwrite the catalog: review the diff, not the result

Save only after reviewing the difference. Before you overwrite the catalog, look at the difference between the before and after (the diff): how many rows were added, which fields changed, what got flagged for a decision. Do not judge by the final file alone, because it looks tidy even when something vanished. Save when the diff looks exactly as you expected. That is five minutes that saves you from quietly breaking a thousand listings.

From a one-off cleanup to standing automation

A one-off tidy-up of an export is a good start, but if the same file comes back every week from a distributor in the same state, repeating the process by hand is waste. The same rules (variant splitting, code validation, color dictionary, channel field mapping) can be wrapped into a repeatable workflow that processes each new export by rules you set once, with the same diff review before saving. That is exactly the work we take on at Seedlight in the AI Automation stage: turning a one-off cleanup into a process that runs itself and leaves the human the decisions rather than the drudgery. How we build such processes agentically we covered separately in the piece on agentic engineering.

A clean catalog is not the goal in itself, only the condition for products to be listable, findable, and sellable in every channel at all. Claude Code shortens the road from a messy export to a finished file from hours of manual fiddling to a few controlled passes. The whole craft is in the discipline: work on a copy, describe the rules instead of relying on the tool to guess, and review the differences before you save. The rest is just repeatability.

FAQ

Do you need to code to clean a catalog with Claude Code?

No. You describe the task in plain language: the target format, the rules, and an example of a messy row with its expected output, and Claude Code runs the operations on the file. It helps to understand your catalog structure and which fields your sales channels require.

Will Claude Code fix invalid EAN codes on its own?

It should not, and that is the point. A valid GTIN is a specific value from GS1 or the manufacturer. Claude Code recomputes the check digit and flags codes that are invalid, the wrong length, or duplicated, but it will not append a missing digit. You fill that from a real source.

Is this safe for my data?

Yes, if you follow the rules: work on a copy, keep the catalog under version control, review the diff before saving, and never put secrets or customer personal data into the files. The tool reads exactly what you give it.

How many catalog items can be cleaned at once?

The limit is how you organize the work rather than the raw row count. Work in batches, check the diff after each pass, and once the process is proven, turn it into a repeatable workflow instead of cleaning everything in one move.

Journal

Szymon Żynda

Co-founder of Seedlight · eCommerce platforms, AI, SEO and GEO

More by this author

Newsletter

The Journal, straight to your inbox

New articles and lessons from real builds, every now and then. No spam, unsubscribe with one click.