Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

SKU Normalizer

commerce.sku_normalize

ProductionBounded custom (Class B)Deterministicstrictinstantv1.0.0
No network

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

Note
Rewrite a product code into one canonical form using an enumerated, published rule set applied in a fixed order.

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

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

normalization

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call1 credit

File handling

Accepts file_refProduces file_refMax input1 MB

How we handle your data

Sensitive output possible
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.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
skustringNoOne product code to normalize; omit it when skus is the batch source.
skusarrayNoFrom 1 through 5,000 product codes in caller order; omit it when sku is the single source.
rulesobjectNoClosed normalization policy; omit it to apply every documented default.

Output schema

FieldTypeRequiredDescription
skustringNoNormalized product code.
originalstringNoOriginal caller-supplied product code.
changedbooleanNoWhether the single code changed.
stepsarrayNoFrom 0 through 9 transformation stages that changed the code.
resultsarrayYesFrom 1 through 5,000 normalized results in caller order, each a closed original, sku, changed flag and steps.
rulesobjectYesClosed resolved normalization policy with every default filled in.
_metaobjectYesClosed batch receipt with whether batch mode was used, count and changedCount.

API contract

POST /v1/execute
curl
curl -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 "}}'
Integrations
TypeScript SDK
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

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
SKU_INVALID400NoThe request payload failed this skill's input validation.
SKU_TOO_LONG429NoA size, quota, rate, or time limit was exceeded.
SKU_DISALLOWED_CHARACTER400NoThe request payload failed this skill's input validation.
SKU_RULES_INVALID400NoThe request payload failed this skill's input validation.
SKU_EMPTY_RESULT412NoThe input is valid but cannot be processed as-is.

Other limits

LimitValue
Recommended inline bytes32 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)

Request bodyjson
{
  "skillKey": "commerce.sku_normalize",
  "input": {
    "sku": "  café _ noir__250g "
  }
}

Examples

A supplier code arrives padded, accented and inconsistently separated

Inputjson
{
  "sku": "  café _ noir__250g "
}
Expected outputjson
{
  "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

Inputjson
{
  "skus": [
    "shoe-7-red",
    "SHOE-42-BLUE",
    "shoe-1234-green"
  ],
  "rules": {
    "padSegments": [
      {
        "width": 4,
        "padChar": "0",
        "index": 1
      }
    ]
  }
}
Expected outputjson
{
  "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
  }
}
  • 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

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.

Tags

skunormalizationcatalogcommerce