Pet Reskin - Gerador de Skins para Mascote Web
techdou/pet-reskin
Gera completos de skins animadas para desktop pets baseado em descrição textual
Ver no GitHubSkill de Agent que gera automaticamente um conjunto completo de sprites e configuração para mascotes web (canvas-pet). Converte descrição textual em 8-16 imagens PNG transparentes, assets auxiliares e atualiza segura a configuração do projeto.
Instalação
npx convez-ai techdou/pet-reskin1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Criar novas personagens animadas para mascote web
- Reskinnar projetos canvas-pet existentes com novos personagens
- Gerar sprites múltiplos com frames customizados para animações
Veredito

Ferramenta especializada para automação de geração de assets de desktop pets, útil para quem trabalha com canvas-pet. Requer setup técnico (Python, API key) e é voltada para uso em projetos web específicos, não para ilustrações genéricas.
README
A tradução para o português deste README ainda está na fila.
pet-reskin | 桌宠换装
中文
Agent Skill,为 canvas-pet / 多 skin 网页桌宠生成并安装完整角色皮肤套。
触发场景
- 给桌宠生成完整精灵图套件(基础 8 帧 / 扩展 16 帧 / 自定义)
- 替换或安装桌宠皮肤
- 支持两种项目架构(单 skin
pet.config.js、多 skinpet.jsskins 数组) - 支持两种生图 provider(Gemini、image2-api 的 gpt-image-2)
不适用于:单张吉祥物图、Logo、头像、纯提示词插画。
下方英文为完整文档。
English
pet-reskin is an Agent Skill for generating and installing a complete canvas-pet character skin.
It converts a character description into:
- 8 required transparent PNG sprites
- an optional
cloud.pnghelper asset manifest.json- copied assets under
<canvas-pet>/assets/pet/ - safe
pet.config.jsupdates forframes,quotes, andbaseSize
The skill follows the Agent Skills pattern: a small SKILL.md for routing and core workflow, deterministic scripts for repeatable operations, and reference files for detailed guidance.
When to use
Use this for a full canvas-pet/web desktop-pet reskin.
Do not use it for a single illustration, logo, mascot avatar, generic animation explanation, or prompt-only image task.
Requirements
- Python 3.8+
- Pillow
GEMINI_API_KEYorGOOGLE_API_KEY- A target project with
pet.config.js
Install Python dependency:
pip install -r requirements.txt
Set API key:
# macOS/Linux
export GEMINI_API_KEY="your-key"
# Windows PowerShell
$env:GEMINI_API_KEY="your-key"
# Windows CMD
set GEMINI_API_KEY=your-key
Optional model override:
export GEMINI_IMAGE_MODEL="gemini-3-pro-image"
Directory structure
pet-reskin/
├── SKILL.md
├── README.md
├── CHANGELOG.md
├── REVIEW.md
├── requirements.txt
├── assets/
│ └── example-plan.json
├── references/
│ ├── character-prompt-guide.md
│ ├── canvas-pet-contract.md
│ └── image-prompt-style-guide.md
├── scripts/
│ ├── check_env.py
│ ├── generate_sprites.py
│ ├── apply_config.py
│ ├── validate_output.py
│ └── pet_reskin.py
└── tests/
├── fixtures/
│ └── sample-pet.config.js
├── test_apply_config.py
└── test_validate_output.py
Quickstart
Create a plan:
{
"character": "小橘猫「栗子」",
"description": "圆滚滚的橘色虎斑猫,大而圆的绿眼睛,短粗四肢,尾巴向上翘起,肚皮和嘴部为白色,鼻头粉色,头顶一撮呆毛",
"style": "现代扁平矢量插画,柔和的深棕色描边,配色温暖明亮",
"baseSize": 88,
"generateCloud": false,
"quotes": ["今天也要好好吃饭。", "别催,在想了。"],
"reuse_idol": false,
"reuse_existing": false
}
Run the one-command pipeline:
python scripts/pet_reskin.py \
--plan plan.json \
--target /path/to/canvas-pet \
--out ./sprites
If you also want the optional cloud helper asset:
python scripts/pet_reskin.py \
--plan plan.json \
--target /path/to/canvas-pet \
--out ./sprites \
--with-cloud
This runs:
- environment check
- image generation
- sprite validation
- safe config installation
- final target validation
Manual steps
python scripts/check_env.py --target /path/to/canvas-pet
python scripts/generate_sprites.py --skill-plan plan.json --out ./sprites
python scripts/validate_output.py --manifest ./sprites/manifest.json --sprites ./sprites
python scripts/apply_config.py --manifest ./sprites/manifest.json --sprites ./sprites --target /path/to/canvas-pet
python scripts/validate_output.py --manifest ./sprites/manifest.json --sprites ./sprites --target /path/to/canvas-pet --report ./sprites/validation-report.json
Dry run
Validate routing and plan shape without calling Gemini:
python scripts/pet_reskin.py --plan plan.json --target /path/to/canvas-pet --out ./sprites --dry-run
Repair one sprite
python scripts/generate_sprites.py --skill-plan plan.json --out ./sprites --only walkRight
Repair mode skips installation because it creates a partial manifest. Inspect the PNG first, then run a full generation/install when satisfied.
Safety behavior
By default, installation is strict:
- Missing any of the 8 required frame keys fails.
- Missing PNG files fail.
- Ambiguous
pet.config.jsreplacements fail. pet.config.jsis backed up aspet.config.js.bak.--dry-runshows the operation without writing files.cloudis optional and preserved if it already exists in the target config and cloud generation was skipped.
Partial installation requires explicit opt-in:
python scripts/apply_config.py --manifest ./sprites/manifest.json --sprites ./sprites --target /path/to/canvas-pet --allow-partial
Prompt design
The generation script uses a modern structured prompt strategy for GPT Image 2, Nano Banana, and similar current image models:
- idol prompt: creates a single master reference image for the character.
- sprite prompts: each required frame reuses the idol as a reference so the appearance stays consistent.
- cloud prompt: only used when cloud generation is requested.
Prompt optimization highlights:
- sectioned prompts instead of one long sentence:
Task / Subject / Style / Composition / Output constraints - reference-frame prompts use
Reference image usage / Pose / Style / Composition / Output constraints - stronger identity locking: color palette, head size, body ratio, eye shape, outline thickness, clothing/accessories, signature features
- consistent framing: square canvas, full body, centered, fully inside the canvas, consistent scale across frames
- sprite-friendly composition: one subject, clean silhouette, no background clutter, no cast shadow
- chroma-key safety: solid
#78C878background and instruction to avoid similar character colors
See references/image-prompt-style-guide.md for the prompt pattern.
Testing
Run unit tests:
python -m unittest discover -s tests -v
These tests do not call Gemini. They validate config replacement, strict partial protection, cloud-optional behavior, and output validation behavior.
Troubleshooting
GEMINI_API_KEY missing
Set the environment variable before running generation. check_env.py reports this before API calls. Run check_env.py --probe (or let pet_reskin.py do it) to also verify the key is accepted by the API, so auth failures surface before any image is generated.
Some sprites failed
The manifest records failures, missingFrames, and missingRequiredFrames. Strict mode refuses installation. Improve the plan description, rerun, or repair a single frame with --only. Strict checks only fire on full runs; repair mode (--only) intentionally skips them so partial manifests can be inspected.
Green halo / residue around the character
Chroma keying uses a smooth alpha gradient (not a hard cutoff) plus a despill pass, so anti-aliased edges fade cleanly. If the character itself is green-ish, the script detects the color collision automatically after generating the idol and stops before wasting the 8 sprite calls — set "keyColor" in plan.json to a contrasting color the character does not use (e.g. #FF00FF magenta for green characters) and rerun.
pet.config.js cannot be replaced
The script expects flat frames, quotes, and numeric baseSize fields. It now uses balanced-brace scanning (not regex) to locate the frames and quotes blocks, so string values containing } or ] no longer break replacement. If the target config uses a different structure, update the config manually or adapt apply_config.py after reading references/canvas-pet-contract.md.
License
MIT.