@pebbly/aseprite-ai-artist 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/CHANGELOG.md +170 -0
  2. package/LICENSE +21 -0
  3. package/README.md +169 -0
  4. package/agents/animation-director.md +65 -0
  5. package/agents/palette-smith.md +57 -0
  6. package/agents/pixel-critic.md +69 -0
  7. package/agents/rig-builder.md +46 -0
  8. package/bin/aseprite-ai-artist +6 -0
  9. package/bin/aseprite-ai-artist.mjs +44 -0
  10. package/dist/bridge/bridge.d.ts +52 -0
  11. package/dist/bridge/bridge.js +230 -0
  12. package/dist/bridge/bridge.js.map +1 -0
  13. package/dist/bridge/client.d.ts +54 -0
  14. package/dist/bridge/client.js +214 -0
  15. package/dist/bridge/client.js.map +1 -0
  16. package/dist/cli.d.ts +10 -0
  17. package/dist/cli.js +272 -0
  18. package/dist/cli.js.map +1 -0
  19. package/dist/extension.d.ts +21 -0
  20. package/dist/extension.js +65 -0
  21. package/dist/extension.js.map +1 -0
  22. package/dist/install.d.ts +35 -0
  23. package/dist/install.js +185 -0
  24. package/dist/install.js.map +1 -0
  25. package/dist/lib/color.d.ts +66 -0
  26. package/dist/lib/color.js +170 -0
  27. package/dist/lib/color.js.map +1 -0
  28. package/dist/lib/protocol.d.ts +78 -0
  29. package/dist/lib/protocol.js +72 -0
  30. package/dist/lib/protocol.js.map +1 -0
  31. package/dist/lib/render.d.ts +62 -0
  32. package/dist/lib/render.js +134 -0
  33. package/dist/lib/render.js.map +1 -0
  34. package/dist/lib/skills.d.ts +43 -0
  35. package/dist/lib/skills.js +112 -0
  36. package/dist/lib/skills.js.map +1 -0
  37. package/dist/lib/version.d.ts +4 -0
  38. package/dist/lib/version.js +25 -0
  39. package/dist/lib/version.js.map +1 -0
  40. package/dist/server.d.ts +15 -0
  41. package/dist/server.js +144 -0
  42. package/dist/server.js.map +1 -0
  43. package/dist/tools/assets.d.ts +3 -0
  44. package/dist/tools/assets.js +181 -0
  45. package/dist/tools/assets.js.map +1 -0
  46. package/dist/tools/craft.d.ts +12 -0
  47. package/dist/tools/craft.js +143 -0
  48. package/dist/tools/craft.js.map +1 -0
  49. package/dist/tools/draw.d.ts +3 -0
  50. package/dist/tools/draw.js +256 -0
  51. package/dist/tools/draw.js.map +1 -0
  52. package/dist/tools/escape.d.ts +12 -0
  53. package/dist/tools/escape.js +49 -0
  54. package/dist/tools/escape.js.map +1 -0
  55. package/dist/tools/kit.d.ts +29 -0
  56. package/dist/tools/kit.js +85 -0
  57. package/dist/tools/kit.js.map +1 -0
  58. package/dist/tools/look.d.ts +7 -0
  59. package/dist/tools/look.js +215 -0
  60. package/dist/tools/look.js.map +1 -0
  61. package/dist/tools/palette.d.ts +3 -0
  62. package/dist/tools/palette.js +232 -0
  63. package/dist/tools/palette.js.map +1 -0
  64. package/dist/tools/session.d.ts +3 -0
  65. package/dist/tools/session.js +231 -0
  66. package/dist/tools/session.js.map +1 -0
  67. package/dist/tools/structure.d.ts +3 -0
  68. package/dist/tools/structure.js +218 -0
  69. package/dist/tools/structure.js.map +1 -0
  70. package/examples/mcp-configs/claude-code.json +9 -0
  71. package/examples/mcp-configs/codex.toml +13 -0
  72. package/examples/mcp-configs/cursor.json +9 -0
  73. package/examples/mcp-configs/gemini-cli.json +9 -0
  74. package/examples/mcp-configs/vscode.json +10 -0
  75. package/extension/ai-artist.lua +3291 -0
  76. package/extension/package.json +14 -0
  77. package/hooks/hooks.json +25 -0
  78. package/hooks/look-nudge.mjs +46 -0
  79. package/hooks/session-status.mjs +47 -0
  80. package/knowledge/palettes.json +60 -0
  81. package/package.json +69 -0
  82. package/rules/00-core-principles.md +57 -0
  83. package/rules/01-palette-and-color.md +51 -0
  84. package/rules/02-shading-and-light.md +56 -0
  85. package/rules/03-silhouette-and-form.md +60 -0
  86. package/rules/04-outlines-and-edges.md +46 -0
  87. package/rules/05-animation.md +62 -0
  88. package/rules/06-layers-and-rigging.md +52 -0
  89. package/rules/07-review-checklist.md +51 -0
  90. package/rules/README.md +16 -0
  91. package/skills/README.md +29 -0
  92. package/skills/pixel-animate/SKILL.md +91 -0
  93. package/skills/pixel-brief/SKILL.md +61 -0
  94. package/skills/pixel-draw/SKILL.md +93 -0
  95. package/skills/pixel-export/SKILL.md +80 -0
  96. package/skills/pixel-fix/SKILL.md +91 -0
  97. package/skills/pixel-new/SKILL.md +70 -0
  98. package/skills/pixel-palette/SKILL.md +80 -0
  99. package/skills/pixel-review/SKILL.md +81 -0
  100. package/skills/pixel-rig/SKILL.md +76 -0
  101. package/skills/pixel-shade/SKILL.md +77 -0
  102. package/skills/pixel-tileset/SKILL.md +104 -0
  103. package/templates/AGENTS.section.md +33 -0
@@ -0,0 +1,51 @@
1
+ # Review checklist
2
+
3
+ Run this before telling anyone a sprite is finished. `validate` covers the
4
+ mechanical half; the rest needs you to actually look.
5
+
6
+ ## Mechanical — run `validate`
7
+
8
+ - [ ] No off-palette colours
9
+ - [ ] No semi-transparent pixels
10
+ - [ ] No isolated single pixels
11
+ - [ ] Animation frames are tagged
12
+ - [ ] Frame timing is not uniform across a whole cycle
13
+ - [ ] Sprite has been saved
14
+
15
+ ## By eye — run `look` op `preview`
16
+
17
+ - [ ] **Silhouette reads.** Recognisable as one flat shape.
18
+ - [ ] **Value contrast carries it.** Still readable desaturated.
19
+ - [ ] **Light is consistent.** One direction, everywhere.
20
+ - [ ] **Ramps are ramps.** Shading hue-shifts; nothing is just "darker".
21
+ - [ ] **Lines are clean.** Even runs, no doubled pixels, no accidental jaggies.
22
+ - [ ] **Outline style is consistent.** One choice, applied throughout.
23
+ - [ ] **No banding.** No long parallel stripes of adjacent ramp steps.
24
+ - [ ] **Detail is where it matters.** The face, the weapon — not the boots.
25
+
26
+ ## By eye — run `look` op `ascii` when something looks subtly off
27
+
28
+ The text grid is where you find the pixel that is one row too low, the run of
29
+ 3 in a line of 2s, the stray colour that survived a snap.
30
+
31
+ ## For animation — run `look` op `filmstrip`
32
+
33
+ - [ ] Volume is consistent frame to frame
34
+ - [ ] Height is consistent (except deliberate squash)
35
+ - [ ] The cycle loops cleanly
36
+ - [ ] Contact poses hold longer than pass poses
37
+ - [ ] There is anticipation before any strong action
38
+
39
+ ## Before handing over
40
+
41
+ - [ ] Tags named the way the engine expects (`idle`, `walk`, `attack`)
42
+ - [ ] Exported at the size and layout the user asked for
43
+ - [ ] Spritesheet has its JSON atlas if the engine needs one
44
+ - [ ] Working `.aseprite` saved, not just the export
45
+
46
+ ## Reporting
47
+
48
+ Say what you checked and what you found, not "done". If something is a
49
+ compromise — a colour that had to move a long way, a pose you could not fit in
50
+ the pixel budget — say that too. A user can fix a stated compromise; they cannot
51
+ fix one you hid.
@@ -0,0 +1,16 @@
1
+ # Rules
2
+
3
+ The pixel-art craft this project encodes. One source of truth, consumed three
4
+ ways:
5
+
6
+ - **Claude Code** reads these files directly from the plugin.
7
+ - **Every other MCP client** reads them as `rules://` resources served by the
8
+ MCP server, so Codex, Gemini CLI and Cursor get the same discipline.
9
+ - **The tools themselves** implement the mechanical parts — palette snapping,
10
+ hue-shifted shading, the validation checks — so an agent that never reads a
11
+ word of this still cannot casually break the palette.
12
+
13
+ Read `rules://index` for the list, or start at `00-core-principles.md`.
14
+
15
+ Changing a rule here changes behaviour everywhere. Skills reference rules by
16
+ name rather than restating them, so a rule has exactly one place to be wrong.
@@ -0,0 +1,29 @@
1
+ # Skills
2
+
3
+ Workflows an agent follows, in the order that catches mistakes while they are
4
+ still cheap. Each one is a procedure, not a description.
5
+
6
+ They are served three ways from this one directory:
7
+
8
+ - **Claude Code** loads them as plugin skills (`/aseprite-ai-artist:pixel-draw`).
9
+ - **Any MCP client** reads them as `skill://` resources and can invoke them as
10
+ MCP prompts — so Codex, Gemini CLI and Cursor get the same workflows.
11
+ - **The server instructions** list them, so an agent knows they exist without
12
+ being told.
13
+
14
+ | Skill | Use when |
15
+ |-------|----------|
16
+ | `pixel-brief` | The request is open-ended and needs decisions before drawing |
17
+ | `pixel-new` | Starting a fresh document |
18
+ | `pixel-palette` | Choosing, building or repairing colours |
19
+ | `pixel-draw` | The main drawing work |
20
+ | `pixel-shade` | Flat art needs volume |
21
+ | `pixel-rig` | A character needs to be animatable |
22
+ | `pixel-animate` | Building a cycle |
23
+ | `pixel-tileset` | Level art and anything that repeats |
24
+ | `pixel-review` | Before saying anything is finished |
25
+ | `pixel-fix` | Editing art that already exists |
26
+ | `pixel-export` | Handing files to a game engine |
27
+
28
+ Skills reference `rules://` rather than restating craft, so a rule has exactly
29
+ one place to be wrong.
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: pixel-animate
3
+ title: Animate a cycle
4
+ description: Build an idle, walk, run or attack cycle from key poses, set timing that reads as motion rather than a metronome, tag it, and review it as a filmstrip. Use when a rigged sprite needs to move.
5
+ ---
6
+
7
+ # Animate a cycle
8
+
9
+ ## Before you start
10
+
11
+ The sprite must be rigged onto named layers — see `pixel-rig`. Animating a
12
+ flattened sprite means redrawing every frame by hand.
13
+
14
+ ## Procedure
15
+
16
+ ### 1. Plan the key poses
17
+
18
+ Write them out before touching a frame. For a walk:
19
+
20
+ 1. **Contact** — front foot lands, back foot pushing. Widest stance.
21
+ 2. **Down** — weight on the front leg, body **lowest**.
22
+ 3. **Pass** — legs together, body **highest**. The frame everyone forgets, and
23
+ its absence is why a walk looks like sliding.
24
+ 4. **Up** — pushing off, rising.
25
+
26
+ Then mirror for the other leg: 8 frames. A 4-frame walk uses contact and pass
27
+ per leg.
28
+
29
+ Idle: 2–4 frames, a breath — chest rises a pixel, shoulders follow one frame
30
+ later. Attack: anticipation, strike, hold, recover.
31
+
32
+ ### 2. Create the frames
33
+
34
+ ```
35
+ frame op="add" count=7
36
+ ```
37
+
38
+ ### 3. Block the key poses
39
+
40
+ Move limbs by moving cels, not by redrawing:
41
+
42
+ ```
43
+ cel op="copy" layer="arm-near" frame=1 toFrame=3
44
+ cel op="move" layer="arm-near" frame=3 dx=2 dy=-1
45
+ ```
46
+
47
+ Redraw only where a part genuinely changes shape — a foreshortened arm, a
48
+ bending knee.
49
+
50
+ ### 4. Look at the keys before adding in-betweens
51
+
52
+ ```
53
+ look op="filmstrip"
54
+ ```
55
+
56
+ A vision model reads only the first frame of a GIF, so the filmstrip is the
57
+ only way to actually see the motion. Check volume and height consistency here,
58
+ while there are four frames to fix rather than eight.
59
+
60
+ ### 5. Add in-betweens
61
+
62
+ Only once the keys read. Spacing is your easing: poses close together read slow,
63
+ far apart read fast.
64
+
65
+ ### 6. Set timing
66
+
67
+ ```
68
+ frame op="set_duration" durations=[150,100,100,150,150,100,100,150]
69
+ ```
70
+
71
+ Hold contact poses longer than pass poses. Uniform timing reads mechanical no
72
+ matter how good the drawings are. Typical ranges are in `rules://05-animation`.
73
+
74
+ ### 7. Tag it
75
+
76
+ ```
77
+ tag op="create" name="walk" from=1 to=8 direction="forward"
78
+ ```
79
+
80
+ Untagged frames are unusable by a game engine. `validate` treats a multi-frame
81
+ untagged sprite as an error.
82
+
83
+ ### 8. Review
84
+
85
+ `look op="filmstrip"` again, then run through the animation checks in
86
+ `rules://07-review-checklist`: consistent volume, consistent height, clean loop,
87
+ anticipation before strong actions, light that does not move.
88
+
89
+ ## Related
90
+
91
+ `rules://05-animation`, `rules://06-layers-and-rigging`.
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: pixel-brief
3
+ title: Plan a sprite before drawing it
4
+ description: Turn a vague pixel-art request into a written brief — size, palette, view, light, outline style — and confirm it with the user before any pixel is drawn. Use when the request is open-ended ("make me a knight") rather than a specific edit.
5
+ ---
6
+
7
+ # Plan a sprite before drawing it
8
+
9
+ A request like "draw me a knight sprite" contains none of the decisions that
10
+ determine whether the result is usable. Guessing them and drawing anyway wastes
11
+ the user's time and yours. Five questions, one answer, then draw.
12
+
13
+ ## What you need to know
14
+
15
+ | Decision | Why it cannot be deferred | Reasonable default |
16
+ |----------|--------------------------|--------------------|
17
+ | **Canvas size** | Determines how much can be shown at all | 32×32 for a character |
18
+ | **Palette** | Choosing it later means repainting | PICO-8 (16 colours) |
19
+ | **View** | Side-on, top-down and 3⁄4 are different drawings | 3⁄4 |
20
+ | **Light direction** | Must be fixed before any shading | Upper-left |
21
+ | **Outline** | Changes every edge in the sprite | Selective, dark-coloured |
22
+ | **Destination** | A game engine wants tags and a sheet | Ask |
23
+
24
+ ## Procedure
25
+
26
+ 1. **`preflight`.** If not ready, stop and tell the user — nothing below works
27
+ without a live Aseprite.
28
+
29
+ 2. **Read what already exists.** If a sprite is open, `sprite_info` it. The
30
+ user's existing canvas size and palette usually answer half the questions,
31
+ and matching an existing project's style is almost always what they want.
32
+
33
+ 3. **Draft the brief.** Fill the table above from what the user said plus the
34
+ defaults. Do not ask about things you can reasonably infer — "a Game Boy
35
+ style knight" has already told you the palette and the size range.
36
+
37
+ 4. **Put it to the user in one message**, as decisions rather than questions:
38
+
39
+ > 32×32, PICO-8 palette, 3⁄4 view, light from upper-left, selective dark
40
+ > outline. Knight in plate with a sword, facing camera. Say if any of that
41
+ > is wrong — otherwise I'll start.
42
+
43
+ One round trip, not five. If they said nothing about a detail, they probably
44
+ do not care about it.
45
+
46
+ 5. **Ask only what genuinely blocks you.** If the sprite is for a specific game
47
+ and you do not know its tile size, that one is worth asking. Light direction
48
+ is not.
49
+
50
+ 6. **Record the brief** in your working notes and hold to it. Every later
51
+ decision either follows from the brief or is a mistake.
52
+
53
+ ## Then
54
+
55
+ Go to `pixel-new` to create the document, or `pixel-draw` if a suitable sprite
56
+ is already open.
57
+
58
+ ## Related
59
+
60
+ `rules://00-core-principles` for what the sizes buy you.
61
+ `rules://03-silhouette-and-form` for view and proportion.
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: pixel-draw
3
+ title: Draw a sprite
4
+ description: Draw a sprite from silhouette to finished pixels, in the order that catches mistakes while they are still cheap — block in, check the silhouette, shade, outline, verify. Use for the main body of any drawing task.
5
+ ---
6
+
7
+ # Draw a sprite
8
+
9
+ The order matters more than the technique. Detail added before the form is right
10
+ just makes the wrongness harder to see and more expensive to fix.
11
+
12
+ ## Procedure
13
+
14
+ ### 1. Look before you draw
15
+
16
+ `preflight`, then `sprite_info`. You need the real layer names, frame count and
17
+ palette. Do not assume them — a wrong layer name means drawing into the user's
18
+ finished art.
19
+
20
+ ### 2. Block in the silhouette
21
+
22
+ One flat colour, no detail. Target the `base` layer. Everything in one `draw`
23
+ call:
24
+
25
+ ```
26
+ draw layer="base" label="block in knight" ops=[
27
+ { kind:"ellipse", rect:{x:12,y:4,width:8,height:8}, color:"#5f574f", fill:"#5f574f" },
28
+ { kind:"rect", rect:{x:11,y:12,width:10,height:10}, color:"#5f574f", fill:"#5f574f" },
29
+
30
+ ]
31
+ ```
32
+
33
+ Batch aggressively. One call is one undo step for the user; forty calls are
34
+ forty. See `rules://03-silhouette-and-form`.
35
+
36
+ ### 3. Check the silhouette immediately
37
+
38
+ ```
39
+ look op="preview"
40
+ ```
41
+
42
+ Ask yourself the only question that matters here: **is it recognisable as one
43
+ flat shape?** If not, fix it now. Shading a bad silhouette is wasted work.
44
+
45
+ Watch for: symmetry that reads as a statue, tangents where an arm fuses into the
46
+ torso, limbs all the same thickness.
47
+
48
+ ### 4. Separate the materials
49
+
50
+ Replace regions of the blockout with each material's base colour — skin, metal,
51
+ leather, cloth. Still flat. Still one `draw` call.
52
+
53
+ ### 5. Shade
54
+
55
+ See `pixel-shade`. One shadow step, look, one light step, look. Stop there
56
+ unless the sprite is 32px+ and genuinely needs more.
57
+
58
+ ### 6. Outline
59
+
60
+ Pick one style from `rules://04-outlines-and-edges` and apply it consistently.
61
+ Selective outlining — outside only — is usually right. `transform` op `outline`
62
+ does the mechanical part; hand-place where you want it broken.
63
+
64
+ ### 7. Verify precisely
65
+
66
+ ```
67
+ look op="ascii"
68
+ ```
69
+
70
+ The text grid is where you catch the pixel one row too low and the line run of
71
+ 3 in a sequence of 2s. A preview cannot show you those.
72
+
73
+ ### 8. Validate and report
74
+
75
+ ```
76
+ validate
77
+ ```
78
+
79
+ Fix every error. Report warnings you chose not to fix, with the reason.
80
+
81
+ ## Batching rules
82
+
83
+ - Ops run in array order, so paint fills before outlines and outlines before
84
+ highlights.
85
+ - Leave `paletteLock` on. When the result says a colour moved with ΔE > 12, the
86
+ palette has no colour for what you asked — say so rather than turning the lock
87
+ off.
88
+ - Use `label` to describe the intent; it becomes the user's undo entry.
89
+
90
+ ## Related
91
+
92
+ `rules://00-core-principles`, `rules://02-shading-and-light`,
93
+ `rules://03-silhouette-and-form`, `rules://04-outlines-and-edges`.
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: pixel-export
3
+ title: Export game-ready assets
4
+ description: Produce the files an engine actually consumes — spritesheets with atlases, GIFs, scaled PNGs — with the tags and layout the target needs. Use when work is finished and needs to leave Aseprite.
5
+ ---
6
+
7
+ # Export game-ready assets
8
+
9
+ ## Ask what consumes it
10
+
11
+ The target decides the format, and guessing produces files someone has to
12
+ re-export. If you do not know, ask — it is one question.
13
+
14
+ | Target | Wants |
15
+ |--------|-------|
16
+ | Unity | Spritesheet PNG + JSON atlas, `byTag` split |
17
+ | Godot | Spritesheet PNG, or `.aseprite` via an importer plugin |
18
+ | Web / canvas | Spritesheet PNG + JSON |
19
+ | Preview for a human | GIF, or a scaled PNG |
20
+ | Print / social | PNG at 4–8× |
21
+
22
+ ## Before exporting
23
+
24
+ Run `pixel-review`. Exporting broken art just distributes it.
25
+
26
+ Then check specifically:
27
+
28
+ - **Tags exist and are named the way the engine expects** — `idle`, `walk`,
29
+ `attack`. `validate` errors on untagged multi-frame sprites.
30
+ - **The reference layer is deleted or hidden**, and so is the sketch layer.
31
+ - **Frame durations are set.** GIF and most engines read them from the file.
32
+
33
+ ## Exporting
34
+
35
+ **Spritesheet with atlas** — what an engine usually wants:
36
+
37
+ ```
38
+ export op="spritesheet" path="…/knight.png" sheetType="packed" byTag=true padding=1
39
+ ```
40
+
41
+ `padding` prevents texture bleed at non-integer zoom, which shows up as a thin
42
+ line of the neighbouring frame along a sprite's edge. Use 1 unless the engine
43
+ says otherwise.
44
+
45
+ The JSON atlas is written beside the PNG and carries per-frame rectangles and
46
+ per-tag ranges.
47
+
48
+ **Animation preview for a human:**
49
+
50
+ ```
51
+ export op="gif" path="…/walk.gif"
52
+ ```
53
+
54
+ **Scaled PNG** — for a store page or a README:
55
+
56
+ ```
57
+ export op="png" path="…/knight@8x.png" scale=8
58
+ ```
59
+
60
+ Integer scale only. Nearest-neighbour. Any other kind of resize destroys the
61
+ thing you made.
62
+
63
+ ## Save the source
64
+
65
+ Exporting does not save the working document.
66
+
67
+ ```
68
+ sprite_manage op="save"
69
+ ```
70
+
71
+ The `.aseprite` file is the asset. The PNG is a build artifact.
72
+
73
+ ## Report
74
+
75
+ List the files you wrote, their dimensions, the frame count and the tags. That
76
+ is what the person wiring them into the engine needs.
77
+
78
+ ## Related
79
+
80
+ `rules://07-review-checklist`, `rules://05-animation`.
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: pixel-fix
3
+ title: Fix or iterate on existing art
4
+ description: Change a sprite that already exists — the user's own work or your earlier output — without destroying what is already right. Use for edits, touch-ups, style corrections and "make it more X" requests.
5
+ ---
6
+
7
+ # Fix or iterate on existing art
8
+
9
+ Editing someone's work has a failure mode that drawing from scratch does not:
10
+ breaking something that was already correct. The whole procedure is built around
11
+ not doing that.
12
+
13
+ ## Procedure
14
+
15
+ ### 1. Understand what is there before changing it
16
+
17
+ ```
18
+ preflight
19
+ sprite_info
20
+ look op="preview"
21
+ ```
22
+
23
+ For a targeted edit, also `look op="ascii"` on the region. You cannot edit
24
+ pixels precisely from a description.
25
+
26
+ **Never assume layer names, frame counts or the palette.** Drawing into the
27
+ wrong layer is the most common way an agent damages someone's file.
28
+
29
+ ### 2. Say what you are about to change
30
+
31
+ For anything beyond a small touch-up, state the plan in one line and let the
32
+ user stop you. Especially before: changing the palette, resizing the canvas,
33
+ merging layers, or editing a layer you did not create.
34
+
35
+ ### 3. Scope the edit as tightly as you can
36
+
37
+ - A **selection** limits `draw`, `recolor` and `transform` to one area.
38
+ - A **layer** target keeps you out of everything else.
39
+ - A **region** on `recolor` avoids touching the whole cel.
40
+
41
+ Scoping is cheaper than repairing.
42
+
43
+ ### 4. Make the change in one call
44
+
45
+ One `draw` with all its ops, one `recolor`. That is one Ctrl+Z for the user if
46
+ they dislike it. Use `label` to describe the intent — it becomes their undo
47
+ entry.
48
+
49
+ ### 5. Verify what actually changed
50
+
51
+ ```
52
+ look op="diff" fromFrame=… toFrame=…
53
+ ```
54
+
55
+ for animation work, or `look op="ascii"` on the region for a static edit. A
56
+ preview shows you the result; a diff shows you the *change*, including the parts
57
+ you did not intend.
58
+
59
+ ### 6. Validate and report
60
+
61
+ ```
62
+ validate
63
+ ```
64
+
65
+ Report what changed and what you deliberately left alone.
66
+
67
+ ## Interpreting vague requests
68
+
69
+ | Request | Usually means |
70
+ |---------|---------------|
71
+ | "more contrast" | Widen the value range of the ramps, not the hue |
72
+ | "cleaner" | Remove strays, even out line runs, merge near-duplicate colours |
73
+ | "more detail" | Usually wrong at small sizes — ask what should read better |
74
+ | "pop more" | Contrast against the background, or a brighter accent |
75
+ | "less flat" | Shading exists but does not hue-shift, or has no light direction |
76
+ | "off / uncanny" | Run `pixel-review`; name the specific cause |
77
+
78
+ Reflect your reading back before acting on it. "More detail" on a 16×16 sprite
79
+ usually means the sprite needs to be bigger, and that is worth one question.
80
+
81
+ ## What not to do
82
+
83
+ - Do not redraw a sprite from scratch because it is easier than editing it,
84
+ unless the user asked for that.
85
+ - Do not "improve" things nobody mentioned.
86
+ - Do not widen the palette to fit a colour you chose. Say the palette lacks it.
87
+ - Do not flatten, resize or re-index without being asked.
88
+
89
+ ## Related
90
+
91
+ `pixel-review`, `rules://00-core-principles`.
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: pixel-new
3
+ title: Create a sprite document
4
+ description: Create a new Aseprite document with the right canvas size, colour mode, palette and layer structure, so later work does not have to fight the setup. Use when starting fresh rather than editing an existing sprite.
5
+ ---
6
+
7
+ # Create a sprite document
8
+
9
+ Set-up mistakes are expensive to undo: a canvas that is the wrong size means
10
+ redrawing, and a palette chosen after the art means repainting. Get these four
11
+ things right and the rest of the work is drawing.
12
+
13
+ ## Procedure
14
+
15
+ 1. **`preflight`.** Stop if not ready.
16
+
17
+ 2. **Create the canvas.**
18
+
19
+ ```
20
+ sprite_manage op="new" width=32 height=32 colorMode="rgb"
21
+ ```
22
+
23
+ - Use **RGB** unless the user wants hard palette enforcement at the file
24
+ level. Indexed mode makes the palette a hard constraint Aseprite itself
25
+ enforces — good for a strict retro target, awkward for iteration.
26
+ - Size to the game's grid if there is one: a 16×16 tile game wants character
27
+ sprites that are a multiple of 16 in at least one dimension.
28
+ - Leave headroom. A 32×32 canvas for a 28px-tall character gives room for a
29
+ weapon raise or a jump squash without a later canvas resize.
30
+
31
+ 3. **Set the palette before drawing.**
32
+
33
+ ```
34
+ palette op="preset" preset="pico8" replace=true
35
+ ```
36
+
37
+ Or build one: `palette op="ramp" base="#c04030" steps=5` per material. See
38
+ `rules://01-palette-and-color`.
39
+
40
+ 4. **Build the layer structure** in one batch, so it is one undo step:
41
+
42
+ ```
43
+ layer batch=[
44
+ {op:"create", name:"sketch"},
45
+ {op:"create", name:"base"},
46
+ {op:"create", name:"shading"},
47
+ {op:"create", name:"outline"},
48
+ ]
49
+ ```
50
+
51
+ For anything that will be animated, build the full character rig instead —
52
+ see `pixel-rig`. Splitting baked pixels apart later is real work.
53
+
54
+ 5. **Save immediately**, so the user has a file and undo has an anchor:
55
+
56
+ ```
57
+ sprite_manage op="save_as" path="…/knight.aseprite"
58
+ ```
59
+
60
+ Ask where, or put it beside whatever project the user is working in.
61
+
62
+ 6. **Confirm** what you made in one line: size, mode, palette, layers.
63
+
64
+ ## Then
65
+
66
+ `pixel-draw` to block in the art.
67
+
68
+ ## Related
69
+
70
+ `rules://01-palette-and-color`, `rules://06-layers-and-rigging`.
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: pixel-palette
3
+ title: Choose, build and repair a palette
4
+ description: Pick a palette that fits the request, build hue-shifted ramps, or clean up a sprite whose colours have sprawled. Use when the user asks about colour, wants a specific retro look, or when validate reports off-palette colours.
5
+ ---
6
+
7
+ # Choose, build and repair a palette
8
+
9
+ ## Choosing
10
+
11
+ Match the request, in this order of preference:
12
+
13
+ 1. **The user named a palette or a game.** Use it. `palette op="preset"` for a
14
+ bundled one, `op="load"` for a file they have, or
15
+ `reference op="sample_palette"` to pull one out of a screenshot they gave you.
16
+ 2. **The user described an era.** "8-bit" → PICO-8. "Game Boy" → gameboy.
17
+ "NES" → build 12–16 colours by hand as 3–4 hues × 4 values.
18
+ 3. **The sprite is joining an existing project.** `sprite_info` an existing
19
+ asset and match it exactly. Consistency beats a nicer palette.
20
+ 4. **Nothing said.** PICO-8. It is 16 colours, forgiving, and reads well.
21
+
22
+ `palette op="preset"` with no valid preset lists what is bundled and says that
23
+ anything else can be loaded from a file.
24
+
25
+ ## Building ramps
26
+
27
+ A ramp is one material's run of colours. Build them hue-shifted:
28
+
29
+ ```
30
+ palette op="ramp" base="#c04030" steps=5 spread=0.55
31
+ ```
32
+
33
+ Shadows come out cooler, highlights warmer — the thing that separates pixel art
34
+ from a brightness slider. Three to five steps per material is plenty; more is
35
+ decisions you will not use.
36
+
37
+ Reuse steps across materials. Sharing the darkest colour between skin and
38
+ leather ties the sprite together and costs nothing.
39
+
40
+ ## Repairing a sprawled palette
41
+
42
+ Symptom: `validate` reports off-palette colours, or the sprite has ninety
43
+ near-identical browns.
44
+
45
+ 1. **Diagnose:**
46
+
47
+ ```
48
+ palette op="analyze"
49
+ ```
50
+
51
+ This reports off-palette colours in the art, near-duplicate palette entries
52
+ (ΔE < 3 — the same colour to a viewer), unused slots and the lowest-contrast
53
+ pair.
54
+
55
+ 2. **Decide the target palette.** Either the existing one, minus the
56
+ near-duplicates, or a fresh one.
57
+
58
+ 3. **Snap the art onto it:**
59
+
60
+ ```
61
+ recolor op="snap" layer="…"
62
+ ```
63
+
64
+ Perceptual (CIELAB) nearest, applied per distinct colour in one pass. The
65
+ result reports exactly which colour became which and how many pixels moved,
66
+ so you can see whether a merge was wrong before the user does.
67
+
68
+ 4. **Re-check.** `palette op="analyze"` again, then `look op="preview"`. Merging
69
+ two colours that were doing different jobs is the risk here; look for a form
70
+ that has gone flat.
71
+
72
+ ## Contrast
73
+
74
+ Value contrast carries readability, not hue contrast. Check by running
75
+ `recolor op="desaturate"` on a copy — if the shapes stop reading in greyscale,
76
+ the palette's values are too close, and no amount of hue will fix it.
77
+
78
+ ## Related
79
+
80
+ `rules://01-palette-and-color`, `rules://02-shading-and-light`.