🐾 desktop-pet

Turn any image into a living desktop companion — a Claude Code skill.

繁體中文說明

Drop in a picture — your cat, a doodle, a game character — and Claude analyzes it, cuts out the subject, writes it a personality, and launches it as a transparent always-on-top pet that wanders around your desktop and talks to you.

✨ Features

  • 🖼️ Any image → pet — AI background removal (rembg / u2net), auto crop & scale
  • 🧠 AI-written personality — Claude names your pet and writes its dialogue from what it sees in the image
  • 🚶 Lives on your desktop — transparent overlay, always on top, click-through everywhere except the pet itself
  • 🍽️ Feed it — right-click → Feed; food drops from above, it walks over and munches it in three bites
  • 🖐️ Pet it — stroke it with your mouse and it wiggles happily with hearts
  • 📣 It calls for you — speech bubbles + synthesized voice (bark / meow / chirp / squeak, zero audio assets)
  • 🎯 Summon itCtrl+Click anywhere on the desktop and it runs over (hotkey fallback: Ctrl+Alt+P)
  • 🫳 Pick it up — drag it around and drop it; it falls back to the ground with gravity
  • 😴 A mind of its own — wanders around, gets lonely and calls you, falls asleep when ignored
  • 🐾 Multiple pets — every pet is just a folder (sprite.png + config.json); run as many as you like

📋 Requirements

OS Windows 10 / 11 (developed & tested on Windows)
Node.js 18+
Python 3.9+ — only needed to create pets (background removal)
Claude Code for the image → pet generation flow

🚀 Install

git clone https://github.com/yuchi-chang/desktop-petlet.git "$env:USERPROFILE\.claude\skills\desktop-pet"

Then in Claude Code just say:

make a desktop pet from this image C:\path\to\my-cat.jpg

Claude handles the rest — first use auto-installs dependencies (npm install for the engine, pip install rembg onnxruntime pillow; the u2net model ~170MB downloads on the first background removal).

Try the bundled sample

Double-click start-pet.bat and Mimichan the mischievous little ghost (pictured above) floats to life — she lives to scare you but is utterly un-frightening. Her lines are in Traditional Chinese; edit pets/mimichan/config.json to localize them.

Prefer a dragon? start-pet.bat nono launches Nono, an English-speaking baby dragon. start-pet.bat <name> launches any pet in pets/.

🕹️ Interactions

Interaction How
Pet / stroke Move your mouse gently back and forth over it
Feed Right-click on it → 🍽️ Feed
Make it call you Right-click → 📣 Call owner
Summon Ctrl + Click anywhere on the desktop (or Ctrl+Alt+P)
Pick up & toss Hold left button and drag; release to drop
Sleep / Quit Right-click menu

⚙️ How it works

image ──▶ scripts/prepare_sprite.py ──▶ pets/<slug>/sprite.png
              (rembg + crop + resize)          + config.json  (Claude writes name & dialogue)
                                                     │
                                     engine/ (Electron)  ◀── start-pet.bat
  • engine/ — an Electron fullscreen transparent overlay. setIgnoreMouseEvents(true, {forward: true}) keeps the window click-through while still receiving mouse-move, so the pet enables interaction only while your cursor is over it. Global Ctrl+Click summon uses uiohook-napi; voices are synthesized with WebAudio; walking/eating/sleeping are procedural squash-and-stretch animations driven by a small state machine.
  • pets/<slug>/ — one folder per pet: the cut-out sprite plus a config.json with name, scale, facing, food emoji, call sound and phrase sets (greet / call / lonely / arrive / feedStart / feedDone / petted / sleep / wake). Edit it with any text editor — no rebuild needed.
  • SKILL.md — the workflow Claude Code follows when you hand it an image.

🩺 Troubleshooting

  • Ctrl+Click doesn't summonuiohook-napi failed to load (check the console); use Ctrl+Alt+P, or re-run npm install in engine/
  • Bad cutout quality — use an image with a clear subject and clean background
  • Close a pet — right-click → 👋 Quit, or kill its electron.exe process
  • Debug mode — set PET_DEBUG=1 before launching: opens DevTools, logs state transitions, exposes window.__pet

📄 License

MIT