agentleFS
THEROCKSSSTHEROCKSSS/hermes-skills-portfolio/skills/qr-code-generator/SKILL.md

qr-code-generator

Skill1 starsChanged 3 months agoMITView on GitHub

Use when the user wants a QR code generated for a URL, plain text, WiFi credentials, a vCard contact, or other custom content — triggers include "make a QR code", "generate a QR", or "create a scannable code".

  • Installs packages

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

qr-code-generator

Overview

Generate QR codes as PNG or SVG images. The agent creates QR codes for URLs, plain text, WiFi credentials, vCards, and custom content with customizable size, color, and error correction.

When to Use

  • The user wants a QR code for a URL.
  • The user wants to share WiFi credentials via QR.
  • The user wants a QR code for contact info (vCard).
  • The user says "make a QR code", "generate a QR", or "create a scannable code".

Prerequisites

pip install qrcode[pil]

Basic QR Code

import qrcode

def make_qr(data: str, output: str = "qr.png", size: int = 10, border: int = 4):
    """Generate a QR code PNG from any string data."""
    qr = qrcode.QRCode(
        version=None,  # auto-detect minimum size
        error_correction=qrcode.constants.ERROR_CORRECT_M,
        box_size=size,
        border=border,
    )
    qr.add_data(data)
    qr.make(fit=True)
    img = qr.make_image(fill_color="black", back_color="white")
    img.save(output)
    return output

Custom Colors

def make_colored_qr(data: str, output: str, fill: str = "#1a1a2e", back: str = "#ffffff"):
    qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_H)
    qr.add_data(data)
    qr.make(fit=True)
    img = qr.make_image(fill_color=fill, back_color=back)
    img.save(output)
    return output

SVG Output

import qrcode.svg

def make_svg_qr(data: str, output: str = "qr.svg"):
    factory = qrcode.svg.SvgPathImage
    qr = qrcode.QRCode(image_factory=factory)
    qr.add_data(data)
    qr.make(fit=True)
    img = qr.make_image()
    img.save(output)
    return output

WiFi QR Code

def wifi_qr(ssid: str, password: str, security: str = "WPA", hidden: bool = False, output: str = "wifi.png"):
    """Generate a QR code that auto-configures WiFi on phones."""
    data = f"WIFI:T:{security};S:{ssid};P:{password};H:{'true' if hidden else 'false'};;"
    return make_qr(data, output)

vCard QR Code

def vcard_qr(name: str, phone: str, email: str, org: str = "", output: str = "contact.png"):
    """Generate a QR code with contact info."""
    data = f"BEGIN:VCARD\nVERSION:3.0\nFN:{name}\nTEL:{phone}\nEMAIL:{email}\nORG:{org}\nEND:VCARD"
    return make_qr(data, output)

URL QR Code

def url_qr(url: str, output: str = "url.png"):
    """Generate a QR code for a URL."""
    return make_qr(url, output)

Error Correction Levels

LevelRecoveryUse case
L7%High-density, clean environment
M15%Default, general use
Q25%Some risk of damage
H30%Logos overlay, dirty environments
# High error correction (allows logo overlay in center)
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_H)

With Logo Overlay

from PIL import Image

def qr_with_logo(data: str, logo_path: str, output: str = "qr_logo.png"):
    """Generate a QR code with a logo in the center."""
    qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_H)
    qr.add_data(data)
    qr.make(fit=True)
    qr_img = qr.make_image(fill_color="black", back_color="white").convert("RGBA")

    logo = Image.open(logo_path).convert("RGBA")
    # Scale logo to ~20% of QR size
    qr_size = qr_img.size[0]
    logo_size = int(qr_size * 0.2)
    logo = logo.resize((logo_size, logo_size), Image.LANCZOS)

    pos = ((qr_size - logo_size) // 2, (qr_size - logo_size) // 2)
    qr_img.paste(logo, pos, logo)
    qr_img.save(output)
    return output

Workflow

  1. Determine the content type (URL, text, WiFi, vCard)
  2. Choose format (PNG for images, SVG for print/web)
  3. Pick error correction level (M default, H for logos)
  4. Generate the QR code
  5. Return the file path

Common Pitfalls

  1. Too much data. QR codes have capacity limits — a v1 QR holds 17 alphanumeric chars, v40 holds 4,296. Long URLs produce large, dense codes that are hard to scan; shorten the URL first.
  2. Dark on dark. QR codes need high contrast — dark fill on a dark background won't scan. Always use dark fill on a light background.
  3. Logo too large. A logo covering more than ~30% of the QR code makes it unscannable — keep logos to 20% max and use error correction H.
  4. PNG vs SVG confusion. PNG is for screen/fixed-size print; SVG is scalable. Use SVG for billboards or large-format displays, not screen previews.
  5. Malformed WiFi QR format. The string must be exactly WIFI:T:WPA;S:SSID;P:PASSWORD;; — the trailing double semicolon is required; omitting it breaks the QR.
  6. Unescaped special characters. Semicolons and colons inside WiFi SSIDs/passwords must be escaped as \\: and \\; or the field boundaries break.

Verification Checklist

  • Generated file opens as a valid image (PNG renders, SVG parses without errors)
  • Decoded the QR (phone camera or a decoder library) to confirm the payload round-trips exactly
  • Fill/background contrast is dark-on-light
  • WiFi QR strings end in the required ;; and escape any :/; inside SSID/password
  • Logo overlay (if used) covers ≤20-30% of the code and error correction is set to H
  • Output format (PNG vs SVG) matches the stated use case (screen vs print/large display)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.