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
xixu-meのその他のスキル
github-actions-docs
xixu-me
ユーザーがGitHub Actionsのワークフローの書き方、説明、カスタマイズ、移行、セキュリティ、トラブルシューティング、ワークフロー構文、トリガー、マトリックス、ランナー、再利用可能なワークフロー、アーティファクト、キャッシュ、シークレット、OIDC、デプロイメント、カスタムアクション、またはActions Runner Controllerについて質問し、特に公式のGitHubドキュメント、正確なリンク、またはドキュメントに基づいたYAMLガイダンスが必要な場合に使用します。
developmentdevopsdocument
use-my-browser
xixu-me
ユーザーのライブブラウザセッションや静的なフェッチではなく表示されたレンダリング状態に依存する作業に使用します。特に、ブラウザデバッグコンテキストやDevToolsで選択された要素やリクエスト、ログイン済みのダッシュボードやCMSフロー、localhostアプリ、フォーム、アップロード、ダウンロード、メディア検査、DOMやiframe検査、Shadow DOM、またはソフト404、認証壁、アンチボットチェック、レート制限のように見えるブラウザ障害に適しています。
browser-automationweb-scrapingtesting
readme-i18n
xixu-me
ユーザーがリポジトリのREADMEを翻訳したい、リポジトリを多言語対応にしたい、ドキュメントをローカライズしたい、言語切り替え機能を追加したい、READMEを国際化したい、またはGitHubスタイルのリポジトリでローカライズされたREADMEのバリエーションを更新したい場合に使用します。
documentdevelopmentapi
openclaw-secure-linux-cloud
xixu-me
クラウドサーバー上でOpenClawをセルフホストする際、リモートのOpenClawゲートウェイを堅牢化する際、SSHトンネリング、Tailscale、リバースプロキシ公開のいずれかを選択する際、または安全な個人デプロイメントのためのPodman、ペアリング、サンドボックス化、トークン認証、ツール権限のデフォルト設定を確認する際に使用します。
devopssecurity
secure-linux-web-hosting
xixu-me
セルフホスティング用のクラウドサーバーのセットアップ、堅牢化、またはレビューを行う際に使用します。DNS、SSH、ファイアウォール、Nginx、静的サイトホスティング、アプリのリバースプロキシ、Let's EncryptやACMEクライアントを使用したHTTPS、安全なHTTPからHTTPSへのリダイレクト、またはBBRなどのオプションの起動後ネットワークチューニングを含みます。
devopssecurityaws
opensource-guide-coach
xixu-me
ユーザーがオープンソースプロジェクトの開始、貢献、成長、運営、資金調達、セキュリティ、持続可能性についてのガイダンスを求めている場合、またはコントリビューターのオンボーディング、コミュニティの健全性、メンテナーの burnout、行動規範、メトリクス、法的基礎、オープンソースプロジェクトの採用について質問している場合に使用します。
developmentresearch
running-claude-code-via-litellm-copilot
xixu-me
Claude CodeをローカルのLiteLLMプロキシ経由でGitHub Copilotにルーティングする際、直接のAnthropic費用を削減し、ANTHROPIC_BASE_URLやANTHROPIC_MODELのオーバーライドを設定する場合、またはmodel-not-found、localhostトラフィックなし、GitHub 401/403認証エラーなどのCopilotプロキシ設定の失敗をトラブルシューティングする場合に使用します。
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