SKU Normalizer
commerce.sku_normalize
Overview
You send a product code in sku — or up to 5000 of them in skus — and the rules your catalogue follows, and we return the normalised code plus a list of the steps that actually changed it. The rules are enumerated, not a script: casing, trimming, which characters are allowed and what happens to the rest, collapsing runs of dashes and spaces to one separator, left-padding a numbered segment to a fixed width, and a fixed prefix or suffix. The order is published and fixed, because normalising is not commutative and you need the same answer every time. This is not a URL slug: a SKU stays uppercase by default, keeps its separators, and must round-trip against your warehouse.
The same product arrives as "café noir 250g", "CAFE_NOIR_250G" and "cafe--noir-250g", and every team writes its own cleanup that disagrees slightly with the others. One published rule set, applied in one published order, ends that: the same code and the same rules always give the same answer, and you can see which step changed it.
Reliability
Fully deterministic: the same code under the same rules always gives the same answer, and the order is fixed at trim, Unicode NFKC, strip diacritics, case, allowed-character policy, collapse separators, segment padding, prefix, suffix — nine stages, with prefix and suffix reported separately. The order is part of the answer, and one place inside it decides whether a code is repaired or refused: the allowed-character policy runs before the separator collapse, so under onDisallowed REJECT a character the set does not permit fails the call even when collapseSeparators would have turned it into the separator a moment later. A space is such a character under every allowedCharacters value. Normalising an already-normalised code changes nothing, with one honest exception: prefix and suffix are added on every call, so a code that carries them is not stable under a second pass with the same rules. A property this skill does not implement is refused, not ignored: an unknown top-level property is a broken request and comes back as the platform's TOOL_INPUT_INVALID, while an unknown property inside rules — or a value outside one of the rules' closed sets — is this skill's own SKU_RULES_INVALID. Failures, and what to do about each. SKU_INVALID — trigger: the code is an empty string, holds a control character, or skus is empty, longer than 5000 entries, or holds something that is not a string; retryable: no, the same request always fails; next: fix or drop the entry we name by position, or split a batch over 5000 codes. SKU_TOO_LONG — trigger: a code is longer than 128 characters before normalisation; retryable: no; next: shorten the code, since we will not truncate an identifier for you. A code past the 1 MiB request ceiling is a payload problem instead, and comes back as a validation error. SKU_DISALLOWED_CHARACTER — trigger: you set rules.onDisallowed to REJECT and the code holds a character rules.allowedCharacters does not permit, which includes a space and includes any non-ASCII letter that survived NFKC and the diacritic strip; retryable: no; next: use REMOVE or REPLACE if you want the code cleaned, or correct the character at the position we report. SKU_RULES_INVALID — trigger: the rules contradict themselves — a separator that is not one character or not permitted by allowedCharacters, REPLACE with ALNUM which offers nothing to replace with, more than 8 padSegments, two padSegments on the same index, an index outside 0 to 128 or a width outside 1 to 128, or a padChar that is not one permitted character — or the rules name something we do not implement: an unknown property, or a case, allowedCharacters or onDisallowed value outside its set; retryable: no; next: fix the rule we name and resend. A rule that breaks a published length rather than contradicting another rule — a prefix or suffix past 16 characters — is a malformed request and comes back as the platform's validation error instead. SKU_EMPTY_RESULT — trigger: normalisation consumed the whole code, which happens when every character was a separator or outside the allowed set; retryable: no; next: widen rules.allowedCharacters, or send a code that carries at least one letter or digit.
Context footprint
The answer is the codes and a short step list — nothing else is returned. A 5000-code batch answers in a few hundred kilobytes. Two ceilings bound a request and both are reachable: 5000 codes, and 1 MiB of request. Even 5000 codes at the full 128 characters is about 640 KB, so the batch ceiling is the one you meet; past 1 MiB the request is refused as a payload rather than answered as a batch. A successful call costs 1 execution credit.
When to use it
When codes reach you from more than one source and you need one canonical spelling before you compare, store or ship them.
When you want a URL-safe slug from a title, when the code must be validated against a supplier scheme, or when you need to find the product the code refers to.
Scope
Non-goals
- Does not produce a URL slug — text.slugify is the skill for that, and its lowercase, transliterated output is a declared non-goal here
- Does not look a code up in, or write it to, any catalogue or warehouse
- Does not invent or allocate codes, and does not check that one exists
- Does not evaluate a caller-supplied pattern, formula or script
- Does not tell you whether two normalised codes are the same product
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response may contain submitted or transformed content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| sku | string | No | One product code to normalize; omit it when skus is the batch source. |
| skus | array | No | From 1 through 5,000 product codes in caller order; omit it when sku is the single source. |
| rules | object | No | Closed normalization policy; omit it to apply every documented default. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| sku | string | No | Normalized product code. |
| original | string | No | Original caller-supplied product code. |
| changed | boolean | No | Whether the single code changed. |
| steps | array | No | From 0 through 9 transformation stages that changed the code. |
| results | array | Yes | From 1 through 5,000 normalized results in caller order, each a closed original, sku, changed flag and steps. |
| rules | object | Yes | Closed resolved normalization policy with every default filled in. |
| _meta | object | Yes | Closed batch receipt with whether batch mode was used, count and changedCount. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"commerce.sku_normalize","input":{"sku":" café _ noir__250g "}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("commerce.sku_normalize", {"sku":" café _ noir__250g "});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| SKU_INVALID | 400 | No | The request payload failed this skill's input validation. |
| SKU_TOO_LONG | 429 | No | A size, quota, rate, or time limit was exceeded. |
| SKU_DISALLOWED_CHARACTER | 400 | No | The request payload failed this skill's input validation. |
| SKU_RULES_INVALID | 400 | No | The request payload failed this skill's input validation. |
| SKU_EMPTY_RESULT | 412 | No | The input is valid but cannot be processed as-is. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not produce a URL slug — text.slugify is the skill for that, and its lowercase, transliterated output is a declared non-goal here
- Does not look a code up in, or write it to, any catalogue or warehouse
- Does not invent or allocate codes, and does not check that one exists
- Does not evaluate a caller-supplied pattern, formula or script
- Does not tell you whether two normalised codes are the same product
- Building a URL or a file name from a product title
- Deciding whether a code is valid against a supplier's own scheme
- Matching a code to a product record, which needs your catalogue
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "commerce.sku_normalize",
"input": {
"sku": " café _ noir__250g "
}
}Examples
A supplier code arrives padded, accented and inconsistently separated
{
"sku": " café _ noir__250g "
}{
"rules": {
"case": "UPPER",
"trim": true,
"collapseSeparators": true,
"separator": "-",
"allowedCharacters": "ALNUM_DASH",
"onDisallowed": "REMOVE",
"stripDiacritics": true,
"padSegments": [],
"prefix": "",
"suffix": ""
},
"changed": true,
"_meta": {
"batch": false,
"count": 1,
"changedCount": 1
},
"results": [
{
"sku": "CAFE-NOIR-250G",
"original": " café _ noir__250g ",
"changed": true,
"steps": [
"TRIM",
"STRIP_DIACRITICS",
"CASE",
"DISALLOWED_CHARACTERS",
"COLLAPSE_SEPARATORS"
]
}
],
"original": " café _ noir__250g ",
"sku": "CAFE-NOIR-250G",
"steps": [
"TRIM",
"STRIP_DIACRITICS",
"CASE",
"DISALLOWED_CHARACTERS",
"COLLAPSE_SEPARATORS"
]
}Three warehouse codes in one call, with the numeric segment padded to four digits
{
"skus": [
"shoe-7-red",
"SHOE-42-BLUE",
"shoe-1234-green"
],
"rules": {
"padSegments": [
{
"width": 4,
"padChar": "0",
"index": 1
}
]
}
}{
"rules": {
"case": "UPPER",
"trim": true,
"collapseSeparators": true,
"separator": "-",
"allowedCharacters": "ALNUM_DASH",
"onDisallowed": "REMOVE",
"stripDiacritics": true,
"padSegments": [
{
"index": 1,
"width": 4,
"padChar": "0"
}
],
"prefix": "",
"suffix": ""
},
"results": [
{
"sku": "SHOE-0007-RED",
"original": "shoe-7-red",
"changed": true,
"steps": [
"CASE",
"PAD_SEGMENTS"
]
},
{
"sku": "SHOE-0042-BLUE",
"original": "SHOE-42-BLUE",
"changed": true,
"steps": [
"PAD_SEGMENTS"
]
},
{
"sku": "SHOE-1234-GREEN",
"original": "shoe-1234-green",
"changed": true,
"steps": [
"CASE"
]
}
],
"_meta": {
"batch": true,
"count": 3,
"changedCount": 3
}
}Recommended use cases
- Clean supplier codes on import so they match the ones already in your catalogue
- Give every team one agreed spelling of a code before it reaches the warehouse
- Normalise a spreadsheet of codes in one call and see which ones actually changed
Avoid for
- Building a URL or a file name from a product title
- Deciding whether a code is valid against a supplier's own scheme
- Matching a code to a product record, which needs your catalogue
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.