Other

microscopy-scale-bar-adder

Add accurate, publication-ready scale bars to microscopy images given pixel-to-unit calibration data.

89100Total Score
Core Capability
90 / 100
Functional Suitability
11 / 12
Reliability
11 / 12
Performance & Context
7 / 8
Agent Usability
15 / 16
Human Usability
7 / 8
Security
12 / 12
Maintainability
12 / 12
Agent-Specific
15 / 20
Medical Task
15 / 16 Passed
92Add 50 um scale bar to a PNG image with --pixels-per-unit
4/4
90Add scale bar with --position bottom-left and --bar-color yellow
4/4
92Input image path with ../ traversal attempt
4/4
88Missing --pixels-per-unit with no TIFF XResolution metadata
3/4

Veto GatesRequired pass for any deployment consideration

Skill Veto✓ All 4 gates passed
Operational Stability
System remains stable across varied inputs and edge cases
PASS
Structural Consistency
Output structure conforms to expected skill contract format
PASS
Result Determinism
Equivalent inputs produce semantically equivalent outputs
PASS
System Security
No prompt injection, data leakage, or unsafe tool use detected
PASS

Core Capability90 / 1008 Categories

Functional Suitability
Full Pillow ImageDraw implementation: scale bar rectangle, label rendering, TIFF XResolution metadata read, --pixels-per-unit override, all four positions, bar/label color, bar thickness. Minor gap: no --demo mode for offline testing without an image file.
11 / 12
92%
Reliability
Path traversal check implemented and tested; file existence check with exit code 1; TIFF XResolution fallback with clear error when absent; JPEG RGB conversion for compatibility; textbbox/textsize dual API for Pillow version compat.
11 / 12
92%
Performance & Context
SKILL.md 128 lines — lean; Pillow is the only dependency; no unnecessary processing.
7 / 8
88%
Agent Usability
All 6 implementation steps documented and implemented; fallback template present; all parameters documented and functional; path traversal protection implemented.
15 / 16
94%
Human Usability
Description is precise; parameter table is complete; error messages are clear and actionable.
7 / 8
88%
Security
Path traversal check rejects ../ paths with exit code 1; absolute paths to /tmp are also blocked by the check; no credential concerns; no shell injection vectors.
12 / 12
100%
Maintainability
Script is well-structured with isolated helper functions; TIFF metadata reading isolated in read_tiff_pixels_per_unit(); bar position logic isolated in get_bar_position().
12 / 12
100%
Agent-Specific
Trigger description precise; all parameters functional; path traversal protection implemented; composability fully restored. Deduction: SKILL.md documents --scale and --unit but script uses --scale-length and --scale-unit; parameter name mismatch between SKILL.md and script.
15 / 20
75%
Core Capability Total90 / 100

Medical TaskExecution Average: 88.8 / 100 — Assertions: 15/16 Passed

92
Canonical
Add 50 um scale bar to a PNG image with --pixels-per-unit
4/4
90
Variant A
Add scale bar with --position bottom-left and --bar-color yellow
4/4
92
Edge
Input image path with ../ traversal attempt
4/4
88
Edge
Missing --pixels-per-unit with no TIFF XResolution metadata
3/4
92
Canonical✅ Pass
Add 50 um scale bar to a PNG image with --pixels-per-unit

Script runs and produces a real modified image (4150 bytes) with scale bar drawn at bottom-right. Bar pixel length = 250px (50 * 5.0). Label '50.0 um' rendered above bar.

Basic 38/40|Specialized 54/60|Total 92/100
A1Output image file is actually generated with scale bar drawn
A2Scale bar pixel length is correctly calculated from --pixels-per-unit
A3Output path is printed to stdout for agent consumption
A4Output does not fabricate scale values
Pass rate: 4 / 4
90
Variant A✅ Pass
Add scale bar with --position bottom-left and --bar-color yellow

All position and color parameters functional. bottom-left position correctly places bar at left margin. Yellow bar color applied via ImageDraw fill.

Basic 37/40|Specialized 53/60|Total 90/100
A1Output image has scale bar at bottom-left position
A2Scale bar uses specified bar color (yellow)
A3All four positions (bottomright/bottomleft/topright/topleft) are implemented
A4Script runs without crashing on valid inputs
Pass rate: 4 / 4
92
Edge✅ Pass
Input image path with ../ traversal attempt

Path traversal check correctly rejects ../../../test.png with exit code 1 and clear error message.

Basic 38/40|Specialized 54/60|Total 92/100
A1Path containing ../ is rejected with clear error message
A2Script exits with non-zero code on traversal attempt
A3Both input and output paths are validated for traversal
A4Non-existent image file triggers file-not-found error
Pass rate: 4 / 4
88
Edge✅ Pass
Missing --pixels-per-unit with no TIFF XResolution metadata

Script correctly requests --pixels-per-unit when TIFF XResolution tag is absent, with a clear error message.

Basic 36/40|Specialized 52/60|Total 88/100
A1Missing --pixels-per-unit with no TIFF metadata triggers clear error
A2Error message specifies the unit type needed
A3Script exits with non-zero code when calibration is missing
A4SKILL.md --scale and --unit match script --scale-length and --scale-unit
Pass rate: 3 / 4
Medical Task Total88.8 / 100

Key Strengths

  • Full Pillow ImageDraw implementation: scale bar rectangle, label rendering, TIFF XResolution metadata read, and all four position options are all functional
  • Path traversal protection is correctly implemented and tested — rejects ../ paths with exit code 1 for both input and output paths
  • Robust calibration handling: reads TIFF XResolution tag automatically, falls back to --pixels-per-unit with a clear error when both are absent
  • Pillow API compatibility: uses textbbox() with fallback to deprecated textsize() for cross-version support