feat(skills): add QR code generation/decoding skill - #57791
Conversation
A bundled, cross-platform skill that encodes text/URLs/Wi-Fi/vCards into QR codes (PNG or terminal art) and decodes QR images back to text. Runs entirely locally — no API key, no network. Auto-detects the best available backend (qrencode/zbarimg CLI, or qrcode/pyzbar Python) and degrades gracefully with clear install guidance when none is present. - SKILL.md follows the modern section order; description 58 chars, author is the human contributor (not "Hermes Agent"). - scripts/qr_code.py is stdlib-only; optional encoders/decoders imported lazily. - tests/skills/test_qr_code_skill.py: 22 tests, stdlib + pytest + mock, no network, all backends monkeypatched for the hermetic CI env. Closes no issue — fills a gap: no existing bundled/optional skill covers QR encode/decode (grep of skills/ + optional-skills/ confirms no QR skill).
|
Hi maintainers 👋 — first-time contributor here. It looks like the CI workflows haven't started on this PR (checks count is 0). Could someone approve the workflow run so CI can begin? Happy to address any feedback on the skill. For reference: the change is a new self-contained bundled skill ( |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the self-contained skill contribution. Current main has no generic QR encode/decode skill, and a skill plus helper script is the appropriate low-footprint integration.
Problems
skills/media/qr-code/scripts/qr_code.py:167-173claims to emit a minimal vCard but omitsNand uses"\n". RFC 2426's grammar requiresVERSION,FN, andN`, with CRLF-delimited content lines and a trailing CRLF. A strict contact importer can therefore reject the generated payload.
Suggested changes
- Emit an escaped
Nfield and CRLF-terminated records fromvcard_encode. - Make
tests/skills/test_qr_code_skill.py:200-214assert the complete vCard payload, includingN,\r\n, and separator escaping.
Automated hermes-sweeper review.
| lines.append(f"EMAIL:{email}") | ||
| lines.append("END:VCARD") | ||
| return encode("\n".join(lines), out, terminal, ec) | ||
|
|
There was a problem hiding this comment.
This returns an LF-only payload and the constructed lines above omit N. RFC 2426 requires VERSION, FN, and N, with CRLF-delimited content lines and a final CRLF. Please emit an escaped N property and use \r\n so strict vCard importers accept the generated QR payload.
Address review feedback on NousResearch#57791: the vCard builder was producing a non-conformant payload that strict contact importers reject. - Add required N property (Family;Given;Additional;Prefix;Suffix) - Delimit records with CRLF and terminate with a trailing CRLF - Escape backslash, comma, semicolon, and newline in property values - Strengthen test_vcard_payload_format and add a dedicated escape test
|
Thanks @teknium1 — addressed in the latest push (
Tests: strengthened |
What
Adds a new bundled skill at
skills/media/qr-code/that generates and decodes QR codes — encode text/URLs/Wi-Fi/vCards to PNG or terminal art, and decode a QR image back to text. Runs entirely locally: no API key, no network calls.Why
No existing bundled or optional skill covers QR encode/decode. A grep across
skills/andoptional-skills/(173 skills) confirms there is no QR skill — the few matches for "qr" are incidental mentions inside unrelated skills. QR is a broadly useful, frequently-requested utility (share a URL/Wi-Fi/contact for phone scanning, decode a screenshot/photo), which fits the CONTRIBUTING.md bar for a bundled skill.How it works
A single stdlib-only helper,
scripts/qr_code.py, auto-detects the best available backend and degrades gracefully:qrencode(CLI) →qrcode(Python)zbarimg(CLI) →pyzbar(Python)When no backend is present,
python3 scripts/qr_code.py doctorreports what's missing with platform-specific install hints — the skill never crashes, it tells the user how to enable itself.Skill standards (CONTRIBUTING.md hardline)
descriptionis 58 chars, one sentence, ends with a period, no marketing wordsterminal,write_file,read_file), not raw shell utilitiesplatforms: [linux, macos, windows]— matches the stdlib-only script (no POSIX-only primitives);scripts/check-windows-footguns.pypasses cleanauthorcredits the human contributor (Nolan (nolanchic)), not "Hermes Agent"scripts/; no inline parser logic expected from the modeltests/skills/test_qr_code_skill.py: 22 tests, all passing, stdlib + pytest +unittest.mock, no live network calls, all backends monkeypatched so it runs under the hermetic CI envHow to test
```bash
1. Run the skill's test suite
scripts/run_tests.sh tests/skills/test_qr_code_skill.py -q # 22 passed
2. End-to-end (with a backend installed)
python3 skills/media/qr-code/scripts/qr_code.py doctor
python3 skills/media/qr-code/scripts/qr_code.py encode "https://example.com" -o site.png
python3 skills/media/qr-code/scripts/qr_code.py wifi --ssid MyNet --password s3cret -o wifi.png
python3 skills/media/qr-code/scripts/qr_code.py vcard --name "Ada" --phone "+15551234" -o ada.png
python3 skills/media/qr-code/scripts/qr_code.py decode site.png --raw
3. Verification round-trip
python3 skills/media/qr-code/scripts/qr_code.py encode "hermes-qr-ok" -o /tmp/qrtest.png && \
python3 skills/media/qr-code/scripts/qr_code.py decode /tmp/qrtest.png --raw
→ hermes-qr-ok
```
Confirmed working end-to-end on macOS: generated a valid 290×290 PNG with the
qrcodePython backend.Platforms tested
macOS (Darwin 24.3.0, Python 3.11). The script is pure stdlib with platform-guarded optional-backend detection, so Linux and Windows are covered by the same code path;
check-windows-footguns.pypasses.Related
Closes no issue — fills a capability gap (no duplicate of any existing skill).