Community画像github.com

pxl-pixel-art

Use when drawing/designing/iterating pixel art or game assets (sprites, icons, tiles, scenes, sheets, GIF anims) as code. Compact .px.js DSL → PNG/sheet/GIF + live paint viewer. Prefer over photo-to-pixel or pure image-gen when assets must be editable, reproducible, and sheet-ready.

pxl-pixel-art とは?

pxl-pixel-art is a Claude Code agent skill that use when drawing/designing/iterating pixel art or game assets (sprites, icons, tiles, scenes, sheets, GIF anims) as code. Compact .px.js DSL → PNG/sheet/GIF + live paint viewer. Prefer over photo-to-pixel or pure image-gen when assets must be editable, reproducible, and sheet-ready.

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ihateusingai-beep/pixel-learning-game-skill-pack/tree/HEAD/pxl-pixel-art

Installed? Explore more 画像 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

pxl: pixel art as code (Hermes)

Write a compact .px.js file → PNG sprites/scenes, TexturePacker-style sheets+JSON, anim strips+GIF, upscaled grid previews, optional live browser paint-replay.

Not the pixel-art skill (photo → retro converter). This skill authors original pixel art from code.

Paths (locked)

PXL_ROOT="$HOME/.hermes/skills/creative/pxl-pixel-art"
PXL="node $PXL_ROOT/bin/pxl.js"
# requires Node ≥ 22.18 (no npm install needed in this checkout)

Examples live in $PXL_ROOT/examples/. Full API: references/reference.md. Terraria-style lights: references/lighting.md (load only when needed).

When to Use

  • SEN / game UI needs sprites, icons, tiles, characters, props, scenes
  • User wants editable, diffable, reproducible pixel art (not one-shot image gen)
  • Need sprite sheet + JSON, multi-frame GIF, or palette-swap variants
  • User wants to watch the agent paint (serve live viewer)

Don't use for: photo→pixel conversion (pixel-art), photoreal/Ghibli images (generate-image-assets / MiniMax), complex 3D.

Workflow (tight loop)

  1. Write art.px.js in the user project (not skill tree). Start from Template below, templates/circular-badge.px.js, or $PXL_ROOT/examples/.
  2. Silhouette first: readable mx grid + mono feature (eye bar, V-fin, skull sockets) before glow/poly soup. Unreadable blob → wipe and redraw grid, don't stack more ops.
  3. Build only targets while iterating:
    $PXL build art.px.js --only name1,name2 --out <project>/out
  4. Inspect (cheap first — always):
    $PXL ascii art.px.js <name> → palette keys + x/y rulers.
    Then out/_preview/<name>.png (upscaled, checkerboard=transparent, grid every px, darker every 8).
    Do not rely on vision for pixel fixes; ascii is SSOT for geometry. Vision 401 / unavailable → ascii + MEDIA delivery only.
  5. Patch one op → rebuild → re-check. Never full-file rewrite for a 2px fix.
  6. Final delivery build: full $PXL build art.px.js --out <project>/out without --scale so default large _preview ships. Then MEDIA: the preview paths (Telegram).
  7. Optional live watch: background $PXL serve art.px.js --port 4321 → URL to user.

Family / cohesion (multi-sprite sets): when shipping player+enemies+UI as one pack, load gamedev-asset-pipeline (Enable/順序) — lock palette roles, view, outline, native size; approve one seed silhouette; batch with swap/shared ramps; QA at game scale on real bg before re-embed. pxl remains the authoring tool; pipeline owns brief+gates.

Full AI multi-action sets: agent-sprite-forge (option, Enable first) — master still → i2v → package.
Iso / 8-dir / camera-true walk: spritecast (option, Enable first) — 3D-guide→redraw→fit.
Ken art law (2026-11-18): SEN 卡/選圖/PECS = pxl only;SEN HTML 要動(行路/8向/iso)= optional spritecast;私人 iso = SpriteCast 主推. pxl remains default for editable static + side-view STG sheets.

Done when: assets under out/sprites|scenes|anims/, silhouette readable in ascii, sheet/GIF present if requested, MEDIA delivered. Support files: templates/circular-badge.px.js · references/session-gundam-badges.md · references/sen-chibi-chars.md · references/reference.md · references/lighting.md

Errors include file:line:col + asset/layer/op path + “did you mean…”. One broken asset does not block others.

CLI

$PXL build <art.px.js> [--out DIR] [--only a,b] [--scale N] [--no-preview]
$PXL serve <art.px.js> [--port 4321] [--out DIR | --no-out] [--no-preview]
$PXL ascii <art.px.js> <name>
$PXL list  <art.px.js>

Art files: .js or .ts ($PXL_ROOT/types/pxl.d.ts for editor completion). Default --out = <art dir>/out.

Template

pal({ k: "#1b1630", g: "#8ccf63", G: "#4c8a44", t: "#2a5560", w: "#fff6e0", r: "#e2585e", R: "#a63a4c" })
ramps("ktGg", "kRr")                   // dark -> light; drives shade()/light()

// Symmetric: write left half, mirror, outline.
sprite("slime", { mx: true, outline: "k" }, `
  ....ggg
  ..ggGGg
  .ggGwGg
  gggkwgg
  gggkkgg
  tgggggg
  .tttttt`)
sprite("slime_red", { base: "slime", swap: { g: "r", G: "R" } })

sprite("_eye", "wk\nkk")               // "_" = part, not exported
sprite("chest", { w: 16, h: 12, outline: "k" },
  rect(0, 3, 16, 9, "R"), rect(0, 0, 16, 4, "r"), stamp("_eye", 7, 4), shade([0, 9, 16, 3]))

scene("meadow", { w: 160, h: 96, bg: "w" },
  layer("ground", { y: 64 }, rect(0, 0, 160, 32, "G"), noise(0, 0, 160, 32, "g", 0.1, 3)),
  layer("props", stamp("slime", 40, 54), stamp("slime_red", 70, 54, { flip: "x" })),
  layer("shadow", { shade: true }, poly([38, 64, 88, 64, 92, 67, 34, 67], "k")))

sheet("chars", ["slime*", "chest"], { pad: 1 })

Essentials

TopicRule
Colors1-char keys via pal; "#hex" ok; . skip; _ erase. Default pico8 (0-f). use("sweetie16"|"db16"|"endesga32"|"gray8")
Item ordergrids → ops → (c)=>{…} → layers; then mirror→swap→flip→rot→outline(+1px each side)→crop
Shapespx rect box line hline vline circ ring ellipse poly fill wire text
Tonedither grad noise shade light recolor; layer flags shade:/light: + density
Regions[cx,cy,r] · [x,y,w,h] · polygon · (x,y)=>bool · clip(region, …items)
Reusestamp tile pattern tilemap scatter; globs/group; rflip rswap seed reseed
Animanim(name, opts, …) frames as patches; or frames:N + c.phase; stamp anim into scenes
Glowglow("keys", { r, strength, bands, ramp, where }) only as a direct item of sprite/scene/anim body, after what it lights. Never inside layer, clip, or frame(...)
Lightingonly if needed → load references/lighting.md (lamp, lighting, solid/wall/unlit)
Glow+basesprite("lit", { base: "raw" }, glow(...)) — keep unlit base separate; don't self-base the same name
Ascii ?Off-palette pixels (glow/shade/light blend). Expected after glow; judge silhouette on the non-? structure or on unlit base

Habits (token + quality)

  • Symmetric → mx + outline. Never hand-mirror or hand-outline.
  • Variants → base + swap. Details → _parts + stamp. Families → group or for loop.
  • Big areas → primitives / grad / pattern / tilemap. Never giant hand grids.
  • Organic texture → 2–3 tiny brush parts + scatter with on/clip.
  • No filler noise on walls/floors/plaster (reads as random dots). Marks need a named cause (planks, brick courses, rain streaks, rust under brackets). noise only for granular materials (gravel/sand/asphalt), sparse.
  • 2–4 shades per material; mnemonic keys (g/G).
  • Iterate with --only; full build for final sheet/export.

Hermes delivery

  • After build, show user previews with MEDIA:/abs/path/to/out/_preview/<name>.png (Telegram).
  • Prefer project-local art.px.js + out/ next to the game/HTML, not inside the skill dir.
  • For SEN games: export 1x PNG sprites; upscale in CSS/image-rendering: pixelated, don't bake huge scale into source unless asked.
  • Single-file Pages SPA (hk-explorer 類): tiny sprites → base64 data:image/png 嵌 CHAR_PX in HTML(免外置 fetch 斷圖);可另存 assets/*.png 方便 diff。Rebuild 後必須同步更新 base64,唔好只 copy PNG。
  • Single-file Canvas STG (doomsday-save-future 類): PLAN often locks one atlas + inline base64 + no fetch. Flow: project art.px.js → sheet(...) → out/<sheet>.png+.json → embed via single-file-canvas-game scripts/reembed-sheet.py (accepts /* ---- 貼圖圖集 or /* ---- SPRITE SHEET). Minimal pack = ships A/B/C + boss + bullets + ui_focus/ui_bomb. 做哂美化 also needs thrust/boom/stars/stage props + JS VFX. 美化新的敵人: nose-down grunt/dive/elite (mx+outline+glow); player ships stay nose-up. Wire by flags not new kinds. Palette cyan/pink/white on black. After art change: rebuild and re-b64 (gitignore out/ OK).
  • SEN HTML STG quiz (sanfa-guard 類): DOM targets + canvas juice, not full atlas required. Pack: 3 theme enemy_* + boss_full/crack/break + fx_bullet|boom|shield. Embed const ENEMY_SPR/BOSS_SPR/FX_SPR = {…data:image/png;base64…} in index.html; wire <img class="ship-spr"> + image-rendering:pixelated. Boss frame follows HP (full→crack→break). Ken preference this track: pxl first, skip MiniMax/photoreal unless asked. Canonical: ~/workspace/vs code/education/value_education/sanfa-guard/art.px.js · see education-game-dev → references/sen-stg-quiz-sanfa-guard.md.

Chibi character recipe (SEN pick-card + grid actor)

Known-good: ~/workspace/vs code/education/computer/hk-explorer-coding/art.px.js (明仔/樂樂). Detail: references/sen-chibi-chars.md.

  1. Full-width grid (14–16 cols) when props are asymmetric (backpack one side, side bun). Do not mx if bag/hair breaks mirror — mx doubles the bag.
  2. Silhouette body only first → outline: "k" on name_base.
  3. Face AFTER outline via sprite("name", { base: "name_base" }, px…) — eyes/smile on post-outline coords (ascii rulers). Drawing eyes in the outlined grid makes 1px gaps collapse under outline fill.
  4. Eye pair pattern that survives outline: k w .. w k on one row; smile mm on next. Never put face gaps as space chars in grid strings (space = skip → row shortens/pads wrong). Use explicit ..
  5. Signature feature per char (hat color / hair buns / bag) so cards stay distinct at ~140px CSS upscale.
  6. Optional *_card = stamp char + soft ellipse shadow; actor can reuse same PNG.
  7. Wire: image-rendering: pixelated on .art img / .actor img; keep CSS bob/win/stuck on the actor wrapper (not the PNG).

Anim pulse pattern (glow-safe)

glow is illegal inside frame(). Put one glow on the shared anim body; animate with ring/light/px patches:

anim("pulse", { outline: "k", fps: 8, w: 40, h: 40 },
  circ(20, 20, 19, "n"), ring(20, 20, 18, "p"), stamp("icon", 7, 6),
  glow("pPq", { r: 3, strength: 0.4, bands: 2 }),  // once, shared
  frame(),
  frame(ring(20, 20, 17, "P"), light([20, 20, 11], 1, 0.3)),
  frame(ring(20, 20, 17, "q"), light([20, 20, 13], 2, 0.5)),
  frame(ring(20, 20, 17, "P"), light([20, 20, 11], 1, 0.35)),
)

Circular badge recipe

  1. Icon sprite: mx: true, outline: "k" grid, 14–28px tall, one signature feature.
  2. Badge: w/h: 40, circ disc + ring accent + optional tick lines + stamp(icon).
  3. Optional glow on badge body after stamp.
  4. sheet("…", [icons…, badges…], { pad: 2 }).
  5. Known-good project: ~/workspace/gundam-pxl-badge/gundam_badges.px.js (Unicorn/Freedom/Crossbone). See references/session-gundam-badges.md.

Common Pitfalls

  1. Confusing with pixel-art skill — that converts photos; this authors .px.js.
  2. glow() inside frame / layer / clip — hard error: glow goes directly in a sprite or scene…. Move glow to body; pulse via ring/light.
  3. Poly/op soup before silhouette — heads become unreadable blobs. Draw grid/mx silhouette first; add glow last.
  4. --scale N on delivery rebuild — overwrites _preview smaller (e.g. 84×84). Final user-facing build: no --scale (default @16x previews).
  5. --only final build — leaves stale siblings in out/. Full build before shipping a set.
  6. Duplicate sprite name / self-base — define name_base then sprite("name", { base: "name_base" }, …). Never declare sprite("ming",…) twice (grid + base rebuild) — hard error already defined.
  7. Hand-drawing both halves / outlines — use mx + outline only when fully symmetric.
  8. mx on backpack / one-side props — mirror clones the bag on both hips. Asymmetric chars → full grid, no mx.
  9. Eyes before outline — 1px eye gap gets outline-filled into a blob (skwkwks). Body+outline first; face px on base overlay after.
  10. Space in grid rows for “gaps” — space is skip; row length collapses. Eye/face gaps must be . and every row same width (verify with a length check before build).
  11. stamp-only sprite without w,h or grid — error no size. Give { w, h } or a grid string.
  12. Vision on every pixel fix — ascii first; deliver MEDIA previews for human eye.
  13. Writing into skill examples/ — art stays in user project; skill tree = engine only.
  14. Filler noise on flat walls — ban; structure/weathering only.
  15. Forgetting --out — set explicit project out/.
  16. Loading lighting.md always — only when lamps/sky light requested.
  17. Updated PNG but stale HTML base64 — SEN single-file embed must re-b64 after every final build.
  18. Spaces inside ramps("…") — ramp strings are palette-key sequences; a space is read as unknown key ' ' and hard-fails the build. Write ramps("knNmdCcw") not ramps("knNmdCc w").

Verification Checklist

  • $PXL list art.px.js shows expected sprites/scenes/sheets
  • $PXL build art.px.js --only … exits 0
  • out/sprites|scenes/*.png exist at intended size (file / read dims)
  • out/_preview/*.png reviewed (or ascii clean)
  • If sheet(...): out/<sheet>.png + .json present
  • If anim: strip/GIF present; frames aligned
  • User-visible delivery via MEDIA paths when on Telegram

One-shot smoke

PXL_ROOT="$HOME/.hermes/skills/creative/pxl-pixel-art"
node "$PXL_ROOT/bin/pxl.js" build "$PXL_ROOT/examples/basics.px.js" --only slime,heart --out /tmp/pxl-smoke
open /tmp/pxl-smoke/_preview/slime.png   # or MEDIA: that path

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

関連スキル