scratch-vm-injection

Inject Scratch blocks into the web editor's VM using Playwright.

2|Updated Feb 9, 2026
One-click install
npx skills add https://github.com/yokobond/scratch-skills --skill scratch-vm-injection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scratch-vm-injection
Source: https://github.com/yokobond/scratch-skills/tree/main/plugins/scratch-operation/skills/scratch-vm-injection
Command: npx skills add https://github.com/yokobond/scratch-skills --skill scratch-vm-injection

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill automates the creation and modification of Scratch programs by directly interacting with the Scratch Virtual Machine (VM), bypassing the need for manual block dragging and dropping.

Core Features & Use Cases

  • Programmatic Block Injection: Define and inject complex scripts directly into sprites or the stage by manipulating the project's JSON structure.
  • Automated Project Creation: Quickly generate entire Scratch projects or significant portions thereof based on code.
  • Use Case: Automatically generate a Scratch project that makes a sprite draw a complex geometric pattern, or create a series of educational Scratch games based on predefined logic.

Quick Start

Use the scratch-vm-injection skill to make Sprite1 move 10 steps when the green flag is clicked.

Frequently Asked Questions about scratch-vm-injection

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate Scratch programming without manually dragging blocks?

You can automate Scratch programming by injecting blocks directly into the web editor's Virtual Machine (VM) using Playwright. This approach bypasses manual dragging by programmatically serializing and deserializing project JSON to create and modify scripts.

What is Scratch VM injection and how does it work for code generation?

Scratch VM injection is a technique that automates code generation by interacting directly with the Scratch Virtual Machine. It works by using Playwright to evaluate browser logic, serialize project JSON, and inject block definitions into sprites programmatically.

Can I generate entire Scratch projects programmatically from code?

Yes, you can generate entire Scratch projects programmatically by defining sprite blocks and managing sprites through project JSON serialization. This allows you to quickly create educational games or complex geometric drawing scripts based on predefined logic.

Does Scratch VM injection require Playwright to run in the browser?

Yes, Scratch VM injection requires Playwright to execute browser evaluation and interact with the Scratch web editor's VM. It uses Playwright to automate the injection of blocks and execution of project logic within the browser environment.

How do I make a Scratch sprite move when the green flag is clicked using code?

You make a sprite move by defining the block logic in code and injecting it into the sprite's JSON structure via the Scratch VM. This programmatically adds the green flag event and move steps blocks without manual editor interaction.

What are the limitations of modifying Scratch projects through JSON manipulation?

Modifying Scratch projects through JSON manipulation requires understanding the Scratch VM's internal project structure. Complex scripts must be accurately serialized and deserialized to avoid corrupting the project file when injecting blocks programmatically.