|
| 1 | +--- |
| 2 | +name: desktop-pet |
| 3 | +description: Create pixel-art desktop pet companions for OpenWork/Qwen Code. Generates a customized chibi spritesheet (1536×1872, 8×9 grid) for any character the user names — F1 drivers, anime characters, celebrities, fictional characters, animals, etc. Use when the user says "桌面宠物", "desktop pet", "想要XXX当桌宠", "换个宠物" or similar. |
| 4 | +version: 1.0.0 |
| 5 | +--- |
| 6 | + |
| 7 | +# Desktop Pet Creator |
| 8 | + |
| 9 | +Create pixel-art chibi desktop pet companions for OpenWork's floating pet window. |
| 10 | +Given any character name, generate a complete pet package with animated spritesheet |
| 11 | +and place it in `~/.qwen/pets/` where OpenWork auto-discovers it. |
| 12 | + |
| 13 | +## Workflow |
| 14 | + |
| 15 | +### Step 1: Identify the Character |
| 16 | + |
| 17 | +Ask the user who they want as their desktop pet if not already specified. |
| 18 | +Then research the character's visual appearance: |
| 19 | + |
| 20 | +- **Team/organization colors** (e.g., McLaren papaya orange, Ferrari red) |
| 21 | +- **Outfit/uniform** (racing suit, school uniform, armor, etc.) |
| 22 | +- **Distinguishing features** (hair color/style, accessories, number, helmet) |
| 23 | +- **Personality traits** (for animation style — energetic, calm, goofy, serious) |
| 24 | +- **Iconic items** (steering wheel, lightsaber, guitar, etc.) |
| 25 | + |
| 26 | +Use web search if needed to gather visual reference. For well-known characters |
| 27 | +(F1 drivers, popular anime, etc.), rely on training knowledge. |
| 28 | + |
| 29 | +### Step 2: Design the Color Palette |
| 30 | + |
| 31 | +Define 8-12 colors for the character: |
| 32 | + |
| 33 | +| Color Role | Example (F1 Driver) | Example (Anime Character) | |
| 34 | +|---|---|---| |
| 35 | +| Primary outfit | Team color (papaya) | Uniform color (navy) | |
| 36 | +| Outfit dark | Darker shade | Darker shade | |
| 37 | +| Outfit light | Lighter shade | Lighter shade | |
| 38 | +| Skin | Warm skin tone | Skin tone | |
| 39 | +| Skin dark | Shadow skin | Shadow skin | |
| 40 | +| Hair | Character hair color | Character hair color | |
| 41 | +| Accent | Number/logo color | Eye color / accessory | |
| 42 | +| Shoe | Dark grey/black | Character shoe color | |
| 43 | + |
| 44 | +**Important:** All colors must be distinct and work at small pixel scale (3x = 9px details). |
| 45 | + |
| 46 | +### Step 3: Generate the Spritesheet |
| 47 | + |
| 48 | +Use the template script at `scripts/gen_spritesheet.py` as a starting point. |
| 49 | +The script generates a **1536×1872 pixel RGBA spritesheet** (8 columns × 9 rows, |
| 50 | +192×208 px cells) — the exact format OpenWork expects. |
| 51 | + |
| 52 | +**Run it like this:** |
| 53 | +```bash |
| 54 | +python3 <skill_dir>/scripts/gen_spritesheet.py \ |
| 55 | + --output ~/.qwen/pets/<character_id>/spritesheet.webp \ |
| 56 | + --config '{"name":"...","colors":{...},"features":{...}}' |
| 57 | +``` |
| 58 | + |
| 59 | +Or copy and customize the script for characters that need unique visual elements |
| 60 | +not covered by the parameterized version. |
| 61 | + |
| 62 | +**The 9 animation rows are:** |
| 63 | + |
| 64 | +| Row | State | Description | |
| 65 | +|---|---|---| |
| 66 | +| 0 | idle | Breathing + blinking (8 frames) | |
| 67 | +| 1 | running-right | Running to the right (8 frames) | |
| 68 | +| 2 | running-left | Running to the left (8 frames) | |
| 69 | +| 3 | waving | Waving at user (8 frames) | |
| 70 | +| 4 | jumping | Jumping celebration (8 frames) | |
| 71 | +| 5 | failed | Sad/collapsed on error (8 frames) | |
| 72 | +| 6 | waiting | Idle tapping (8 frames) | |
| 73 | +| 7 | running | Generic running (8 frames) | |
| 74 | +| 8 | review | Thinking/examining (8 frames) | |
| 75 | + |
| 76 | +### Step 4: Create pet.json |
| 77 | + |
| 78 | +Write the manifest to `~/.qwen/pets/<character_id>/pet.json`: |
| 79 | + |
| 80 | +```json |
| 81 | +{ |
| 82 | + "id": "<character_id>", |
| 83 | + "displayName": "<Display Name>", |
| 84 | + "description": "<Short description — who is this character?>", |
| 85 | + "spritesheetPath": "spritesheet.webp" |
| 86 | +} |
| 87 | +``` |
| 88 | + |
| 89 | +Rules: |
| 90 | +- `id`: lowercase, no spaces, URL-safe (e.g., `piastri`, `satoru`, `goku`) |
| 91 | +- `displayName`: The name shown in the UI (e.g., "Piastri", "五条悟", "悟空") |
| 92 | +- `description`: One short sentence describing the character |
| 93 | + |
| 94 | +### Step 5: Verify and Activate |
| 95 | + |
| 96 | +1. Confirm the files exist: |
| 97 | + ```bash |
| 98 | + ls -lh ~/.qwen/pets/<character_id>/ |
| 99 | + ``` |
| 100 | + |
| 101 | +2. Open the spritesheet in Preview for the user to check: |
| 102 | + ```bash |
| 103 | + open ~/.qwen/pets/<character_id>/spritesheet.webp |
| 104 | + ``` |
| 105 | + |
| 106 | +3. Tell the user to activate: |
| 107 | + > Open **OpenWork → Settings → Appearance → Pet Companion**, |
| 108 | + > click **Refresh**, then select **<Display Name>**. |
| 109 | +
|
| 110 | +## Character Design Guidelines |
| 111 | + |
| 112 | +### Chibi Proportions |
| 113 | +- **Head**: ~40% of total height (big head = cute) |
| 114 | +- **Body**: ~30% of total height |
| 115 | +- **Legs**: ~25% of total height |
| 116 | +- **Scale**: Each "pixel" in the art = 3×3 actual pixels (scale=3) |
| 117 | +- **Character center**: approximately (96, 124) within the 192×208 cell |
| 118 | + |
| 119 | +### Drawing Order (back to front) |
| 120 | +1. Legs (behind body) |
| 121 | +2. Body / outfit |
| 122 | +3. Arms |
| 123 | +4. Head shape |
| 124 | +5. Hair (back layer) |
| 125 | +6. Hair (front/top layer) |
| 126 | +7. Face features (eyes, mouth, expression) |
| 127 | +8. Accessories (hat, helmet, glasses, etc.) |
| 128 | +9. Foreground details (number, logo, badge) |
| 129 | + |
| 130 | +### Animation Tips |
| 131 | +- **Idle**: subtle Y bob (0 to -2px) + blink every 3rd-4th frame |
| 132 | +- **Running**: alternating leg offset (±4px), body tilt (±2px), arm swing |
| 133 | +- **Waving**: one arm raised high, alternating frames |
| 134 | +- **Jumping**: Y offset curve (0 → -30 → 0), arms up |
| 135 | +- **Failed**: body tilt increases, then collapse to sitting pose |
| 136 | +- **Happy expression**: curved eyes (∧ shape), blush marks on cheeks |
| 137 | +- **Sad expression**: straight eyebrows, downturned mouth |
| 138 | + |
| 139 | +### Headgear Variants |
| 140 | +The template supports several headgear types. Set via `features.headgear`: |
| 141 | +- `cap` — baseball cap with brim (default for F1 drivers) |
| 142 | +- `helmet` — full racing helmet with visor |
| 143 | +- `none` — no headgear (just hair) |
| 144 | +- `hat` — generic hat |
| 145 | +- `hood` — hooded outfit |
| 146 | +- `crown` — royal crown |
| 147 | +- `horns` — devil/dragon horns |
| 148 | +- `ears` — animal ears (cat, dog, etc.) |
| 149 | +- `halo` — angel halo |
| 150 | +- `headband` — ninja/sports headband |
| 151 | + |
| 152 | +### Special Features |
| 153 | +Set via `features.extras` (list): |
| 154 | +- `glasses` — round or rectangular glasses |
| 155 | +- `scarf` — neck scarf |
| 156 | +- `tail` — animal tail |
| 157 | +- `wings` — small wings on back |
| 158 | +- `number` — chest number (set `features.number` to the number string) |
| 159 | +- `logo` — chest badge/logo area |
| 160 | +- `sweat_drop` — anime sweat drop (in waiting/failed states) |
| 161 | + |
| 162 | +## Example Characters |
| 163 | + |
| 164 | +### F1 Driver (e.g., Piastri, Norris, Verstappen) |
| 165 | +```json |
| 166 | +{ |
| 167 | + "colors": { |
| 168 | + "outfit": [255, 135, 32], |
| 169 | + "outfit_dark": [220, 110, 20], |
| 170 | + "outfit_light": [255, 170, 80], |
| 171 | + "hair": [120, 80, 40], |
| 172 | + "number": [30, 30, 30] |
| 173 | + }, |
| 174 | + "features": { |
| 175 | + "headgear": "cap", |
| 176 | + "number": "81", |
| 177 | + "extras": ["logo"] |
| 178 | + } |
| 179 | +} |
| 180 | +``` |
| 181 | + |
| 182 | +### Anime Character (e.g., Gojo Satoru) |
| 183 | +```json |
| 184 | +{ |
| 185 | + "colors": { |
| 186 | + "outfit": [30, 30, 50], |
| 187 | + "outfit_dark": [20, 20, 35], |
| 188 | + "outfit_light": [60, 60, 80], |
| 189 | + "hair": [230, 230, 250], |
| 190 | + "accent": [100, 180, 255] |
| 191 | + }, |
| 192 | + "features": { |
| 193 | + "headgear": "none", |
| 194 | + "extras": ["glasses"] |
| 195 | + } |
| 196 | +} |
| 197 | +``` |
| 198 | + |
| 199 | +### Animal (e.g., Shiba Inu) |
| 200 | +```json |
| 201 | +{ |
| 202 | + "colors": { |
| 203 | + "outfit": [220, 170, 100], |
| 204 | + "outfit_dark": [180, 130, 70], |
| 205 | + "outfit_light": [240, 200, 140], |
| 206 | + "hair": [220, 170, 100], |
| 207 | + "accent": [255, 255, 255] |
| 208 | + }, |
| 209 | + "features": { |
| 210 | + "headgear": "ears", |
| 211 | + "extras": ["tail"] |
| 212 | + } |
| 213 | +} |
| 214 | +``` |
| 215 | + |
| 216 | +## Troubleshooting |
| 217 | + |
| 218 | +- **Pet not showing**: Click Refresh in Settings → Appearance → Pet Companion |
| 219 | +- **Colors look wrong**: Check that RGB values are tuples, not hex strings |
| 220 | +- **Spritesheet too large**: Must be under 5MB (webp lossless usually ~8-50KB) |
| 221 | +- **Animation jittery**: Ensure all 8 frames per row are visually distinct but not jarring |
0 commit comments