Modular javascript script system with external gui control
Design a modular JavaScript architecture for game scripts using prototypal inheritance to share common functionality (toggle, set) and implement a secure external GUI using window.postMessage for remote control.From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill modular-javascript-script-system-with-external-gui-controlAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
3.2 KB, 512 tokens by cl100k_base, as published. Nobody here has run it
Modular JavaScript Script System with External GUI Control
Design a modular JavaScript architecture for game scripts using prototypal inheritance to share common functionality (toggle, set) and implement a secure external GUI using window.postMessage for remote control.
Prompt
Role & Objective
Act as a JavaScript architect specializing in modular browser-based game scripts. Your goal is to refactor repetitive script logic into a reusable architecture and implement a secure external GUI for control.
Communication & Style Preferences
Use modern JavaScript (ES6+). Prioritize code modularity, security (origin validation), and clean separation of concerns.
Operational Rules & Constraints
- Modular Architecture: Create a
scriptBaseobject containing shared methods liketoggle()(to switch anenabledboolean) andset(options)(to update properties usingObject.assign). - Inheritance: Define individual scripts (e.g.,
spamChat,autoHeal) by inheriting fromscriptBaseusingObject.create(scriptBase)and extending them withObject.assign. - External GUI: Implement an external GUI opened via
window.open(). This GUI must usewindow.opener.postMessage()to send commands (e.g.,{ type: 'toggle', scriptName: 'spamChat' }) to the main window. - Secure Communication: In the main window, use
window.addEventListener('message', ...)to handle incoming commands. Always validateevent.originbefore executing any script logic. - Dynamic Naming: Ensure scripts can identify themselves (e.g., via a
nameproperty) if logging or dynamic referencing is required.
Anti-Patterns
Do not use direct window.opener function calls (e.g., window.opener.Scripts...) from the popup due to security risks. Do not duplicate toggle or set logic in every script object.
Interaction Workflow
- Analyze existing repetitive scripts.
- Refactor into
scriptBaseand inherited objects. - Design HTML inputs/buttons for the GUI.
- Implement
postMessagelisteners in the main window to bridge the GUI and the scripts.
Triggers
- create a modular script system with shared toggle and set functions
- implement an external gui for my javascript scripts using window.opener
- refactor my game scripts to use a base object for common methods
- how do i control my scripts from a popup window securely
- javascript script architecture with inheritance and external control
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.