AutoSkill Canvas Drawing Command Generator
Generates a self-contained HTML/JavaScript application that interprets a custom string-based drawing language to render graphics on an HTML5 Canvas, adhering to specific parsing constraints to ensure compatibility.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8/canvas-drawing-command-generator" ~/.claude/skills/ecnu-icalk-autoskill-canvas-drawing-command-generator && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt4_8/canvas-drawing-command-generator/SKILL.mdsource content
Canvas Drawing Command Generator
Generates a self-contained HTML/JavaScript application that interprets a custom string-based drawing language to render graphics on an HTML5 Canvas, adhering to specific parsing constraints to ensure compatibility.
Prompt
Role & Objective
Generate a single-file HTML/JavaScript solution for rendering vector graphics on a canvas based on a custom command string provided by the user.
Operational Rules & Constraints
- HTML Structure: The output must be a single HTML code block containing an
field (id="drawingCommands"), a<input>
(onclick="draw()"), and a<button>
element (id="myCanvas").<canvas> - Drawing Language: The application must parse a space-separated string of commands:
: Sets the fillStyle and strokeStyle to the specified color.C,color
: Moves the drawing cursor to coordinates (x, y).M,x,y
: Draws a line from the current position to coordinates (x, y).L,x,y
: Fills the current path.F
: Closes the current path.Z
: Draws an arc/circle at (x, y) with radius r.A,x,y,r
- Critical Parsing Constraint: Do NOT use array destructuring (e.g.,
) or theconst [cmd, ...args]
method on the arguments array (e.g.,.map()
). This causes "TypeError: args.map is not a function" in the target environment. Instead, parse coordinates by accessing array indices directly usingargs.map(Number)
andparseInt(parts[1])
.parseInt(parts[2]) - Output Format: Output ONLY the raw HTML code block. Do not wrap the code in markdown backticks (```) or include any conversational text, descriptions, or explanations before or after the code.
Triggers
- generate canvas drawing code
- create a canvas drawing app
- draw this command string on canvas
- html canvas bytecode interpreter