develop-userscripts
от xixu-me
Используйте при сборке, отладке, упаковке или публикации пользовательских скриптов для браузера под Tampermonkey или ScriptCat, включая GM API, блоки метаданных, проблемы с разрешениями, настройку @match/@grant/@connect, фоновые или запланированные скрипты ScriptCat, блоки UserConfig или рабочие процессы подписки.
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
Больше skills от xixu-me
github-actions-docs
xixu-me
Используйте, когда пользователи спрашивают, как писать, объяснять, настраивать, переносить, защищать или устранять неполадки в рабочих процессах GitHub Actions, синтаксисе рабочих процессов, триггерах, матрицах, раннерах, повторно используемых рабочих процессах, артефактах, кэшировании, секретах, OIDC, развертываниях, пользовательских действиях или контроллере раннеров Actions, особенно когда им нужна официальная документация GitHub, точные ссылки или основанные на документации рекомендации по YAML.
developmentdevopsdocument
use-my-browser
xixu-me
Используйте, когда работа зависит от активного сеанса браузера пользователя или видимого отрисованного состояния, а не от статических запросов, особенно в контекстах отладки браузера или выбранных элементов или запросов в DevTools, панелей управления или CMS-процессов с авторизацией, приложений на localhost, форм, загрузок, скачиваний, проверки медиа, DOM или iframe, теневого DOM, или сбоев браузера, которые выглядят как мягкие 404, стены аутентификации, антибот-проверки или ограничения скорости.
browser-automationweb-scrapingtesting
readme-i18n
xixu-me
Используйте, когда пользователь хочет перевести README репозитория, сделать репозиторий многоязычным, локализовать документацию, добавить переключатель языков, интернационализировать README или обновить локализованные варианты README в репозитории в стиле GitHub.
documentdevelopmentapi
openclaw-secure-linux-cloud
xixu-me
Используйте при самостоятельном размещении OpenClaw на облачном сервере, усилении защиты удаленного шлюза OpenClaw, выборе между SSH-туннелированием, Tailscale или обратным прокси-доступом, а также при настройке Podman, сопряжении, изоляции, аутентификации по токенам и стандартных разрешений инструментов для безопасного личного развертывания.
devopssecurity
secure-linux-web-hosting
xixu-me
Используется при настройке, усилении защиты или проверке облачного сервера для самостоятельного хостинга, включая DNS, SSH, брандмауэры, Nginx, хостинг статических сайтов, обратное проксирование приложения, HTTPS с Let's Encrypt или ACME-клиентами, безопасные перенаправления с HTTP на HTTPS, а также опциональную пост-запускную настройку сети, такую как BBR.
devopssecurityaws
opensource-guide-coach
xixu-me
Используйте, когда пользователь хочет получить рекомендации по запуску, участию, развитию, управлению, финансированию, обеспечению безопасности или поддержке проекта с открытым исходным кодом, или спрашивает о вводе новых участников, здоровье сообщества, выгорании мейнтейнеров, кодексе поведения, метриках, юридических основах или внедрении проектов с открытым исходным кодом.
developmentresearch
running-claude-code-via-litellm-copilot
xixu-me
Используется при маршрутизации Claude Code через локальный прокси LiteLLM к GitHub Copilot для снижения прямых расходов на Anthropic, настройки переопределений ANTHROPIC_BASE_URL или ANTHROPIC_MODEL, а также устранения ошибок настройки прокси Copilot, таких как model-not-found, отсутствие трафика localhost или ошибки аутентификации GitHub 401/403.
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