module-userscript

Generate a Tampermonkey-compatible .user.js scaffold with GM_* grants and @match patterns.

5.5k|794|Updated Nov 26, 2025
One-click install
npx skills add https://github.com/shiaho777/web-to-app --skill module-userscript
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: module-userscript
Source: https://github.com/shiaho777/web-to-app/tree/main/app/src/main/assets/skills/module-userscript
Command: npx skills add https://github.com/shiaho777/web-to-app --skill module-userscript

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This module helps you generate Tampermonkey/Greasemonkey userscripts that run through a GM_* bridge, simplifying integration with the WebToApp host and enabling automation on web pages.

Core Features & Use Cases

  • Output a single .user.js file with a standard metadata header and an immediately invoked function expression to ensure scope isolation.
  • GM_ support*: declare and use Grants such as GM_setValue, GM_getValue, GM_xmlhttpRequest, and other domain-specific APIs safely.
  • Precise matching: configure exact @match patterns to target specific sites or SPA routes, avoiding global scope.
  • Use Case: build lightweight site tweaks, automations, or UI enhancements that execute within the page context without server interaction.

Quick Start

Create a basic Tampermonkey userscript using GM_* APIs and output a single .user.js with the metadata header at the top.

Frequently Asked Questions about module-userscript

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

FAQPage Schema
How do I generate a Tampermonkey userscript with GM_* API support?

Generate a Tampermonkey userscript by outputting a single .user.js file containing a standard metadata header, declared GM_* grants, and a minimal IIFE for scope isolation. This scaffold safely integrates GM_setValue, GM_getValue, and GM_xmlhttpRequest for web automation.

How do I configure @match patterns for SPA routes in a userscript?

Configure precise @match patterns in the userscript metadata header to target specific sites or SPA routes. This avoids global scope execution and ensures your web automation or UI enhancements run only on the intended page contexts.

What is the best way to structure a .user.js file for web automation?

The best way to structure a .user.js file is using a metadata header followed by a minimal immediately invoked function expression. This IIFE ensures scope isolation while the header declares necessary GM_* grants and exact @match patterns for execution.

Can I use this to build UI enhancements without server interaction?

Yes, you can build lightweight site tweaks, UI enhancements, and web automation that execute entirely within the page context. The generated userscript runs locally through the GM_* bridge, requiring no server interaction to apply the modifications.

Does this userscript generator support Greasemonkey and WebToApp integration?

Yes, the generator supports Greasemonkey and simplifies integration with the WebToApp host through the GM_* bridge. It produces a compatible userscript scaffold that safely declares domain-specific APIs for cross-platform web automation.