develop-userscripts
par xixu-me
À utiliser lors de la construction, du débogage, du packaging ou de la publication de userscripts pour navigateur destinés à Tampermonkey ou ScriptCat, incluant les API GM, les blocs de métadonnées, les problèmes de permissions, la configuration @match/@grant/@connect, les scripts d’arrière-plan ou planifiés de ScriptCat, les blocs UserConfig, ou les workflows d’abonnement.
npx skills add https://github.com/xixu-me/skills --skill develop-userscriptsUserscript work usually breaks at the runtime and metadata boundary, not in the page logic. Choose the runtime first, declare the minimum permissions up front, then debug in the environment where the script actually runs.
When to Use
Use this skill for:
- writing or fixing a Tampermonkey or ScriptCat userscript
- debugging injection timing, missing permissions, CSP workarounds, update checks, or
GM_*behavior - deciding between a portable foreground script and ScriptCat-only
@backgroundor@crontab - adding config UI with
==UserConfig== - packaging a ScriptCat
==UserSubscribe==bundle or preparing a CloudCat-compatible script
Do not use this skill for full browser extension development or general browser automation outside userscript managers.
Runtime Selection
digraph userscript_runtime {
"Need page DOM or page context?" [shape=diamond];
"Need persistent or scheduled work?" [shape=diamond];
"Need to install many scripts as one package?" [shape=diamond];
"Portable foreground script" [shape=box];
"ScriptCat background or crontab script" [shape=box];
"ScriptCat subscription package" [shape=box];
"Need page DOM or page context?" -> "Portable foreground script" [label="yes"];
"Need page DOM or page context?" -> "Need persistent or scheduled work?" [label="no"];
"Need persistent or scheduled work?" -> "ScriptCat background or crontab script" [label="yes"];
"Need persistent or scheduled work?" -> "Need to install many scripts as one package?" [label="no"];
"Need to install many scripts as one package?" -> "ScriptCat subscription package" [label="yes"];
"Need to install many scripts as one package?" -> "Portable foreground script" [label="no"];
}
Preflight
- Confirm the manager and browser. On Manifest V3 browsers, ScriptCat may require
Allow User Scriptsor browser developer mode before scripts run. - Decide page script versus background script before writing code. ScriptCat background scripts cannot touch the DOM.
- Start with metadata, not implementation:
@match,@grant,@connect,@run-at, and any update URLs. - Prefer portable
==UserScript==patterns for ordinary page scripts. Only switch to ScriptCat-only headers when the requested behavior actually needs them.
Workflow
- Choose the runtime and metadata first.
- Declare the smallest permission surface that fits the task.
- Implement against the runtime you chose.
- Debug where the code really runs.
- Foreground scripts: page console plus manager logs.
- ScriptCat background scripts: run log first, then
background.htmlfor real-environment debugging.
- Publish with the right update model.
- Normal scripts: keep
@versionaccurate and add@updateURLor@downloadURLonly when needed. - Subscription bundles: use
==UserSubscribe==, HTTPS URLs, and subscription-level@connect.
- Normal scripts: keep
Quick Reference
| Intent | Default choice | Watch for |
|---|---|---|
| Page UI, DOM scraping, page patching | Portable ==UserScript== | @match, @grant, @run-at, CSP-sensitive injection |
| Cross-origin API access | GM_xmlhttpRequest with explicit @connect | Missing hosts, cookie behavior differences, user authorization |
| Long-running worker | ScriptCat @background | No DOM, must return Promise for async work |
| Scheduled task | ScriptCat @crontab | Only first @crontab counts, prefer 5-field cron, avoid interval overlap |
| User-editable settings | ==UserConfig== plus GM_getValue | Block placement and group.key naming |
| Silent bundle install and updates | ==UserSubscribe== | HTTPS, user.sub.js, subscription connect overrides child scripts |
Common Mistakes
- Missing
@grantfor APIs the script actually uses. - Missing
@connectfor hosts used byGM_xmlhttpRequestorGM_cookie. - Treating
@includeas a better default than@matchfor ordinary host targeting. - Using DOM APIs inside ScriptCat background or cron scripts.
- Returning from a ScriptCat background script before async GM work is truly finished.
- Mixing
==UserScript==and==UserSubscribe==packaging concepts. - Putting
==UserConfig==in the wrong place or reading config keys without thegroup.keyname. - Assuming Tampermonkey and ScriptCat storage, notification, or request behavior is identical.
References
Plus de skills de xixu-me
github-actions-docs
xixu-me
Utiliser lorsque les utilisateurs demandent comment écrire, expliquer, personnaliser, migrer, sécuriser ou résoudre des problèmes liés aux workflows GitHub Actions, à la syntaxe des workflows, aux déclencheurs, aux matrices, aux runners, aux workflows réutilisables, aux artefacts, à la mise en cache, aux secrets, à OIDC, aux déploiements, aux actions personnalisées ou à Actions Runner Controller, en particulier lorsqu'ils ont besoin de la documentation officielle de GitHub, de liens exacts ou de conseils YAML basés sur la documentation.
developmentdevopsdocument
use-my-browser
xixu-me
À utiliser lorsque le travail dépend de la session de navigateur en direct de l'utilisateur ou de l'état rendu visible plutôt que de récupérations statiques, en particulier pour les contextes de débogage de navigateur ou les éléments ou requêtes sélectionnés via DevTools, les tableaux de bord connectés ou les flux CMS, les applications localhost, les formulaires, les téléversements, les téléchargements, l'inspection des médias, l'inspection DOM ou iframe, le Shadow DOM, ou les échecs de navigateur ressemblant à des soft 404, des murs d'authentification, des vérifications anti-bot ou des limites de débit.
browser-automationweb-scrapingtesting
readme-i18n
xixu-me
Utiliser lorsque l'utilisateur souhaite traduire un README de dépôt, rendre un dépôt multilingue, localiser de la documentation, ajouter un sélecteur de langue, internationaliser le README, ou mettre à jour des variantes localisées du README dans un dépôt de type GitHub.
documentdevelopmentapi
openclaw-secure-linux-cloud
xixu-me
Utiliser lors de l'auto-hébergement d'OpenClaw sur un serveur cloud, du durcissement d'une passerelle OpenClaw distante, du choix entre le tunneling SSH, Tailscale ou l'exposition par proxy inverse, ou de l'examen des paramètres par défaut de Podman, de l'appairage, du sandboxing, de l'authentification par jeton et des permissions d'outils pour un déploiement personnel sécurisé.
devopssecurity
secure-linux-web-hosting
xixu-me
À utiliser lors de la configuration, du durcissement ou de la révision d’un serveur cloud pour l’auto-hébergement, incluant DNS, SSH, pare-feu, Nginx, hébergement de site statique, proxy inverse d’une application, HTTPS avec Let’s Encrypt ou clients ACME, redirections sécurisées HTTP vers HTTPS, ou réglage réseau optionnel après lancement comme BBR.
devopssecurityaws
opensource-guide-coach
xixu-me
Utilisez lorsque l'utilisateur souhaite des conseils pour démarrer, contribuer, développer, gouverner, financer, sécuriser ou maintenir un projet open source, ou s'interroge sur l'intégration des contributeurs, la santé de la communauté, l'épuisement des mainteneurs, le code de conduite, les métriques, les bases juridiques ou l'adoption d'un projet open source.
developmentresearch
running-claude-code-via-litellm-copilot
xixu-me
Use when routing Claude Code through a local LiteLLM proxy to GitHub Copilot, reducing direct Anthropic spend, configuring ANTHROPIC_BASE_URL or ANTHROPIC_MODEL overrides, or troubleshooting Copilot proxy setup failures such as model-not-found, no localhost traffic, or GitHub 401/403 auth errors.
developmentapidevops
skills-cli
xixu-me
Use when users ask to discover, install, list, check, update, remove, back up, restore, sync, or initialize Agent Skills, mention `bunx skills`, `npx skills`, `skills.sh`, or `skills-lock.json`, ask "find a skill for X", or want help extending agent capabilities with installable skills.
developmentapiproductivity