An AI agent skill that validates barcodes on label proofs. Give it a PDF, AI, PSD, or image file — it decodes every barcode, classifies them (FNSKU, UPC-A, EAN-13, etc.), validates format and check digits, looks up product info, and returns structured JSON with a pass/fail verdict.
Built for AI agents. Works as a CLI too.
barcode-validator ships a SKILL.md for AI agent discovery via skills.sh.
npx skills add julioccorderoc/barcode-validatorThe scripts/validate.sh wrapper adds --json automatically:
./scripts/validate.sh label-proof.pdf
./scripts/validate.sh label-proof.pdf --expected X001ABC1234Agents get structured JSON on stdout — parse the output, check exit codes, done. See SKILL.md for the full agent contract: triggers, examples, output schema, and error handling.
Requires Python 3.13+ and uv.
git clone https://github.com/julioccorderoc/barcode-validator.git
cd barcode-validator
uv syncuv add barcode-validatorDecode-only — extract and validate all barcodes:
barcode-validator label-proof.pdf --jsonComparison mode — check against expected values:
barcode-validator label-proof.pdf --expected X001ABC1234 --expected 0850031591271 --jsonSave results to file (--output implies --json):
barcode-validator label-proof.pdf --output results.jsonHuman-readable output — omit --json for a summary on stderr:
barcode-validator label-proof.pdfMultiple files:
barcode-validator proof1.pdf proof2.pdf --jsonOffline mode — disable product lookup:
barcode-validator label-proof.pdf --json --no-lookupBy default, barcode-validator queries free public APIs (Open Food Facts, UPCitemdb) to enrich results with product names and descriptions. Lookup is informational only — it never affects the pass/fail verdict. Use --no-lookup to disable all network calls.
{
"file": "label-proof.pdf",
"passed": true,
"mode": "decode",
"barcodes": [
{
"value": "X001ABC1234",
"type": "FNSKU",
"symbology": "Code128",
"page": 1,
"valid_format": true,
"valid_checkdigit": null,
"matches_expected": null,
"lookup": null
}
],
"expected_not_found": [],
"summary": "1 barcode(s) found. All validations passed."
}| Field | Type | Description |
|---|---|---|
passed |
boolean | Overall verdict |
mode |
string | "decode" or "comparison" |
barcodes[].type |
string | FNSKU, UPC_A, EAN_13, EAN_8, UPC_E, ISBN_13, ASIN, CODE128, CODE39, UNKNOWN |
barcodes[].valid_format |
boolean | Format matches expected pattern |
barcodes[].valid_checkdigit |
boolean/null | Check digit valid (null if type has none) |
barcodes[].matches_expected |
boolean/null | Matches expected value (null in decode mode) |
barcodes[].lookup |
object/null | Product lookup result (null when --no-lookup) |
PDF, AI (Adobe Illustrator), PSD, PNG, JPG/JPEG, TIFF, BMP.
EPS is not supported.
| Type | Pattern | Validation |
|---|---|---|
| FNSKU | X00 + 7 alphanumeric | Regex format |
| UPC-A | 12 digits | MOD-10 check digit |
| UPC-E | 8 digits | Check digit |
| EAN-13 | 13 digits | MOD-10 check digit |
| EAN-8 | 8 digits | Check digit |
| ISBN-13 | 13 digits, 978/979 prefix | Check digit |
| ASIN | 10 alphanumeric, B0 prefix | Regex format |
| CODE128 | Variable alphanumeric | Symbology check |
| CODE39 | Variable alphanumeric | Symbology check |
| Code | Meaning |
|---|---|
| 0 | Validation passed |
| 1 | Validation failed (bad check digit, missing expected, format) |
| 2 | Error (unsupported file, file not found, processing failure) |
from barcode_validator import validate_label
result = validate_label("label-proof.pdf", expected=["X001ABC1234"])
print(result.passed) # True/False
print(result.to_json()) # Full JSON outputRequires Python 3.13+ and uv.
git clone https://github.com/julioccorderoc/barcode-validator.git
cd barcode-validator
uv sync
uv run pytestbarcode-validator/
├── src/barcode_validator/ # Source code
├── tests/ # pytest test suite
├── scripts/ # Shell wrappers (agent invocation)
├── spec/ # Architecture Decision Records
├── docs/ # PRD, roadmap, research
├── SKILL.md # AI agent skill definition
└── pyproject.toml # Package configuration