goodboy008/labelize/fix-zpl-render

Claude Code and agent skill by goodboy008/labelize

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Diagnose and fix ZPL rendering differences by auto-learning from official Zebra documentation. Use when: rendered label doesn't match expected output, pixel diff is too high, barcode looks wrong, text positioning is off, graphic elements are misplaced, golden test fails, rendering bug, wrong render, visual mismatch, diff threshold exceeded.

Install

npx vskill@latest install goodboy008/labelize/fix-zpl-render

SKILL.md

Fix ZPL Rendering — Auto-Learn from Official Docs

Purpose

Systematically diagnose rendering mismatches in labelize by:

  1. Identifying which ZPL command(s) cause the visual difference
  2. Fetching the official Zebra spec for those commands
  3. Comparing spec behavior with labelize implementation
  4. Applying the fix

Critical Rule — Fix Rendering Code, Never Tests

DO NOT modify diff tests, golden test infrastructure, reference images, tolerance thresholds (to hide regressions), or test comparison logic to make diffs pass. The goal is to improve rendering accuracy, not to weaken the test harness.

DO fix the root cause in rendering code and logic:

  • Parsers: src/parsers/
  • Elements: src/elements/
  • Barcode encoders: src/barcodes/
  • Renderer / drawing: src/drawers/
  • Font handling: src/assets/

Threshold updates in docs/DIFF_THRESHOLDS.md are only allowed after a rendering fix genuinely lowers the diff percentage — set the new tolerance slightly above the new measured diff, never raise it to paper over a regression.

When to Use

  • A golden test exceeds its diff threshold
  • Visual inspection shows wrong barcode, text position, or graphic
  • A new ZPL label renders incorrectly
  • Need to reduce diff percentage for a specific label

Procedure

Phase 1: Identify the Problem
  1. Get the label source — Read the ZPL file from testdata/labels/<name>.zpl or testdata/unit/<name>.zpl
  2. Check current diff — Look up the label in docs/DIFF_THRESHOLDS.md for the current diff percentage and known cause
  3. Run the golden test for the specific label:

``bash cargo test --test e2e -- <label_name> --nocapture ``

  1. Inspect the diff image — Check testdata/diffs/<name>.png to see which pixels differ (red = mismatch)
  2. Parse the ZPL — Read through the .zpl file and list every ZPL command used
Phase 2: Learn from Official Docs
  1. For each suspect command, fetch the official Zebra documentation:

`` https://docs.zebra.com/us/en/printers/software/zpl-pg/c-zpl-zpl-commands/r-zpl-<slug>.html ``

Use the #tool:fetch_webpage tool. Common command slugs:

CommandSlugCategory
^AaFont/text
^BCbcCode 128 barcode
^BQbqQR Code
^B7b7PDF417
^BOb0Aztec
^BXbxDataMatrix
^BDbdMaxiCode
^BYbyBarcode defaults
^FBfbField block (multiline)
^FOfoField origin
^FTftField typeset
^FWfwField orientation
^GBgbGraphic box
^GDgdDiagonal line
^GFgfGraphic field
^CFcfDefault font
^CIciCharacter set
^LHlhLabel home
^POpoPrint orientation
^PWpwPrint width
  1. Extract from the doc:
  • Exact parameter order, types, and default values
  • Parameter interaction rules (e.g., "if omitted, uses value set by ^BY")
  • Coordinate system details (top-left vs baseline, dot units)
  • Any special behavior notes
  1. For field interactions, also fetch:

`` https://docs.zebra.com/us/en/printers/software/zpl-pg/r-zpl-interactions-field-interactions.html ``

Phase 3: Compare with Implementation
  1. Find the parser code — Search in src/parsers/zpl_parser.rs for the command prefix
  2. Find the element struct — Check src/elements/<relevant_element>.rs
  3. Find the renderer code — Check src/drawers/renderer.rs for how the element is drawn
  4. For barcodes — Also check src/barcodes/<barcode_type>.rs for encoding logic
  1. Compare systematically:
AspectOfficial SpecLabelize CodeMatch?
Parameter order......✓/✗
Default values......✓/✗
Coordinate origin......✓/✗
Unit interpretation......✓/✗
Interaction with ^BY/^FW/etc......✓/✗
Phase 4: Fix and Verify
  1. Implement the fix — Edit the parser, element, renderer, or barcode encoder as needed
  2. Run the specific test:

``bash cargo test --test e2e -- <label_name> --nocapture ``

  1. Run all tests to check for regressions:

``bash cargo test ``

  1. Update threshold — If the diff improved, update docs/DIFF_THRESHOLDS.md with the new percentage

Diagnostic Patterns

Common Root Causes
SymptomLikely CauseWhere to Look
Text shifted vertically^FT baseline vs ^FO top-left confusionrenderer.rs → get_text_top_left_pos
Text too wide/narrowFont width ratio wrongelements/font.rs → width calculation
Barcode too wide^BY module width default wrongzpl_parser.rs → ^BY parsing
Barcode wrong encodingBarcode encoder bugbarcodes/<type>.rs
Rotated element in wrong positionRotation pivot point offrenderer.rs → rotation transforms
Graphic box wrong sizeBorder thickness double-countedrenderer.rs → draw_box
Reverse print invertedCompositing logic errorrenderer.rs → reverse print buffer
Missing elementParser doesn't handle commandzpl_parser.rs → command matching
GFA graphic corruptHex/compressed data parsingparsers/zpl_parser.rs → ^GF handler
Known High-Diff Labels and Focus Areas
LabelDiffPrimary IssueFix Focus
ups, ups_surepost25-36%MaxiCode encodingbarcodes/maxicode.rs — needs compliant encoder
fedex18%PDF417 encodingbarcodes/pdf417.rs — data encoding gaps
pnldpd14%GFA + Aztec + Code128Multiple: graphic field parsing, barcode encoding
porterbuddy14%GFA + QRGraphic field Z/LZ4 decompression, QR sizing

References

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
52
Repository forks
24
7-day trend score
20

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/goodboy008/labelize/fix-zpl-render/badge)](https://verified-skill.com/skills/goodboy008/labelize/fix-zpl-render)

Something wrong with this skill or its page? Tell us.