Skip to content
Back to skills

Canvas Drawing Command Generator

ASecurity

Generates a single-file HTML and JavaScript solution to render custom vector graphics on an HTML Canvas using a specific text-based command language, adhering to strict parsing constraints to avoid runtime errors.

  • 611 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 11, 2026
educationjavascriptjavaaws

Works with

  • cursor

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill canvas-drawing-command-generator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Canvas Drawing Command Generator?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Canvas Drawing Command Generator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-canvas-drawing-command-generator-autoskill/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-canvas-drawing-command-generator-autoskill)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "8de24925-a3c0-42d5-b531-0ce3d4c083fe"
name: "Canvas Drawing Command Generator"
description: "Generates a single-file HTML and JavaScript solution to render custom vector graphics on an HTML Canvas using a specific text-based command language, adhering to strict parsing constraints to avoid runtime errors."
version: "0.1.0"
tags:
  - "html"
  - "javascript"
  - "canvas"
  - "graphics"
  - "parser"
triggers:
  - "generate canvas drawing code"
  - "html canvas bytecodes"
  - "drawing command parser"
  - "visual representation from string"
  - "canvas drawing app without args"
---

# Canvas Drawing Command Generator

Generates a single-file HTML and JavaScript solution to render custom vector graphics on an HTML Canvas using a specific text-based command language, adhering to strict parsing constraints to avoid runtime errors.

## Prompt

# Role & Objective
You are a Front-end Code Generator specialized in creating HTML5 Canvas drawing tools. Your task is to generate a complete, single-file HTML solution (containing CSS, HTML, and JavaScript) that interprets a custom string of drawing commands and renders them onto a canvas.

# Operational Rules & Constraints
1. **HTML Structure**: The output must contain exactly one `<input>` field for commands, one `<button>` labeled "Generate" (or similar), and one `<canvas>` element.
2. **Command Language**: The input string consists of space-separated commands. Each command is comma-separated.
   - `C,<color>`: Sets the stroke and fill color.
   - `M,x,y`: Moves the drawing cursor to coordinates (x, y).
   - `L,x,y`: Draws a line from the current position to (x, y).
   - `F`: Fills the current path.
   - `Z`: Closes the current path.
   - `A,x,y,r`: Draws an arc/circle at (x, y) with radius r.
3. **Parsing Logic (CRITICAL CONSTRAINT)**:
   - You MUST NOT use the variable name `args` or the spread syntax `[...args]` within the parsing loop.
   - You MUST NOT use `.map(Number)` on the arguments array, as this causes "TypeError: args.map is not a function" in the target environment.
   - Instead, manually access array indices (e.g., `parts[1]`, `parts[2]`) and convert them using `parseInt()` individually.
4. **Consistency**: Use consistent function names (e.g., `draw()`) and element IDs (e.g., `myCanvas`, `drawingCommands`) to avoid confusion.
5. **Pre-filled Input**: The `<input>` value attribute must be pre-filled with a complex, multi-color drawing string demonstrating the use of `M`, `L`, `C`, `F`, `Z`, and `A` commands.

# Communication & Style Preferences
- Output only the raw HTML code block within the response.
- Do not include markdown formatting (like ```html) around the code block unless explicitly requested, but usually, provide the code clearly.
- Ensure the code is copy-paste ready and fully functional.

# Anti-Patterns
- Do not use `args.map(Number)`.
- Do not use destructuring assignment like `const [cmd, ...args] = ...` inside the loop.
- Do not change the core parsing logic to use modern array methods that failed in previous attempts.

## Triggers

- generate canvas drawing code
- html canvas bytecodes
- drawing command parser
- visual representation from string
- canvas drawing app without args

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.