Get the FREE Ultimate OpenClaw Setup Guide →

generate-qr-code-natively

Scanned
npx machina-cli add skill besoeasy/open-skills/generate-qr-code-natively --openclaw
Files (1)
SKILL.md
2.7 KB

Generate QR Code Natively

Create QR codes fully offline on the local machine (no third-party QR API calls).

When to use

  • User asks to generate a QR code from text, URL, wallet address, or payload
  • Privacy-sensitive workflows where data should stay local
  • Fast automation pipelines that should not depend on external services

Required tools / APIs

  • No external API required
  • Bash CLI option: qrencode
  • Node.js option: qrcode package

Install options:

# Ubuntu/Debian
sudo apt-get update && sudo apt-get install -y qrencode

# Node.js
npm install qrcode

Skills

generate_qr_with_bash

Generate PNG and terminal QR directly from shell.

# Encode text into PNG
DATA="https://example.com/report?id=123"
qrencode -o qrcode.png -s 8 -m 2 "$DATA"

# Print QR in terminal (UTF-8 block mode)
qrencode -t UTF8 "$DATA"

# SVG output
qrencode -t SVG -o qrcode.svg "$DATA"

generate_qr_with_nodejs

import QRCode from 'qrcode';

const data = process.argv[2] || 'https://example.com';

async function main() {
  await QRCode.toFile('qrcode.png', data, {
    errorCorrectionLevel: 'M',
    margin: 2,
    width: 512
  });

  const svg = await QRCode.toString(data, { type: 'svg', margin: 2 });
  await import('node:fs/promises').then(fs => fs.writeFile('qrcode.svg', svg));

  const terminal = await QRCode.toString(data, { type: 'terminal' });
  console.log(terminal);
  console.log('Saved: qrcode.png, qrcode.svg');
}

main().catch(err => {
  console.error('QR generation failed:', err.message);
  process.exit(1);
});

Run:

node generate-qr.js "https://example.com/invoice/abc"

Agent prompt

You are generating QR codes locally without calling external QR APIs.
Use Bash (qrencode) for quick CLI generation or Node.js (qrcode package) for programmatic control.
Return:
1) command/code used,
2) output filenames (png/svg),
3) brief validation note (e.g., "scan test recommended").
If dependency is missing, provide the install command and retry.

Best practices

  • Keep payload concise for better scan reliability
  • Use at least error correction level M for general use
  • Export PNG for compatibility and SVG for scalable print/web usage
  • Validate with a scanner after generation

Troubleshooting

  • qrencode: command not found → install qrencode via package manager
  • Node import error → ensure npm install qrcode completed
  • Dense/unclear QR image → increase image size/box size and reduce payload length

See also

Source

git clone https://github.com/besoeasy/open-skills/blob/main/skills/generate-qr-code-natively/SKILL.mdView on GitHub

Overview

Generate QR codes locally on your machine without external API calls. It offers a Bash option with qrencode and a Node.js option with the qrcode package, covering PNG, SVG, and terminal outputs. Fully offline by design, it suits privacy-sensitive workflows and automated pipelines.

How This Skill Works

qrencode in Bash outputs PNG, terminal, or SVG QR codes from a text payload. In Node.js, the qrcode package is used via toFile for PNG and toString for SVG or terminal output. All generation happens locally, without remote service calls or network dependency.

When to Use It

  • User asks to generate a QR code from text, URL, wallet address, or payload
  • Privacy-sensitive workflows where data should stay local
  • Fast automation pipelines that should not depend on external services
  • Need PNG for compatibility and SVG for scalable printing or web use
  • Prefer a terminal-based QR display for quick verification

Quick Start

  1. Step 1: Install tools (Ubuntu: sudo apt-get install -y qrencode; Node.js: npm install qrcode)
  2. Step 2: Generate a QR using Bash: qrencode -o qrcode.png -s 8 -m 2 'https://example.com'
  3. Step 3: Validate by scanning the output with a QR scanner and review PNG/SVG/terminal render

Best Practices

  • Keep payload concise for better scan reliability
  • Use at least error correction level M for general use
  • Export PNG for compatibility
  • Export SVG for scalable print/web usage
  • Validate with a scanner after generation

Example Use Cases

  • Generate a QR for an invoice URL like https://example.com/invoice/abc to share payment details with customers
  • Create a report link QR (https://example.com/report?id=123) for offline distribution
  • Encode a crypto wallet address into a QR for easy transfers
  • Print an offline inventory label QR with a product URL or ID
  • Produce a printable SVG QR for event tickets or access codes

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers