/tampermonkey:tampermonkeyfrom tampermonkey
Writes and debugs Tampermonkey userscripts that inject JavaScript/CSS into websites, auto-fill forms, scrape data, or react to SPA URL changes. Includes header templates, grant management, and debugging guides.
Ships in tampermonkey. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
@grant, every cross-origin host has its @connect, and @match covers only the target pages.@grant used and why; browser support if not universal.// ==UserScript==
// @name My Script Name // unique script name
// @namespace https://example.com/scripts/ // your unique namespace
// @version 1.0.0 // increment on every update
// @description Brief description of the script
// @author Your Name
// @match https://example.com/* // target URL pattern
// @grant GM.getValue // one line per GM API used
// @grant GM.setValue
// @run-at document-idle // the default
// ==/UserScript==
(async () => {
'use strict';
const setting = await GM.getValue('myKey', 'default');
})();
A script that uses no GM APIs takes @grant none (which disables the sandbox) and a plain (function() { 'use strict'; ... })(); wrapper.
| The script needs to | Grant |
|---|---|
| Store persistent data | GM_setValue + GM_getValue |
| Batch read/write settings (v5.3+) | GM.getValues + GM.setValues |
| Make cross-origin requests | GM_xmlhttpRequest + @connect domain |
| Add custom CSS | GM_addStyle |
| Access the page's window | unsafeWindow |
| Show notifications | GM_notification |
| Add menu commands | GM_registerMenuCommand |
| Detect URL changes (SPA) | window.onurlchange |
| Mute/unmute tab audio | GM_audio |
A userscript cannot:
Workarounds for most of these are in common-pitfalls.md.
Critical:
@match is specific (not *://*/*)eval(), new Function() or string-based setTimeout/setIntervalImportant:
'use strict'@grant is necessary@connect includes every external domainRecommended:
@version follows semantic versioning (X.Y.Z)| Read | When the task involves |
|---|---|
| header-reference.md | Any tag beyond the template: @run-at timing, @run-in, @require/@resource with SRI, @noframes, update URLs, i18n names |
| url-matching.md | A @match beyond one domain or its subdomains: specific paths, @include regex, @exclude |
| patterns.md | Waiting for an element, SPA navigation, mutation observers, element or form manipulation, keyboard shortcuts, table or link extraction, debouncing, retry with backoff - full implementations |
| sandbox-modes.md | @sandbox, page-context access, CSP errors, Firefox cloneInto/exportFunction |
| api-async.md | GM.* promise APIs - prefer these for new scripts |
| api-sync.md | GM_* callback APIs: notifications, menu commands, clipboard, downloads, resources, GM_info |
| api-storage.md | Stored settings, batch values, value-change listeners |
| http-requests.md | Cross-origin requests with GM_xmlhttpRequest |
| web-requests.md | Intercepting or blocking requests: GM_webRequest (Firefox only), page-level interception elsewhere |
| api-cookies.md | Reading or changing cookies with GM_cookie |
| api-dom-ui.md | GM_addElement, GM_addStyle, unsafeWindow, custom UI, page frameworks |
| api-tabs.md | Tab-persistent data, opening or closing tabs, cross-tab communication |
| api-audio.md | Muting or unmuting tabs |
| common-pitfalls.md | A script that misbehaves, or a workaround for a limit above |
| debugging.md | A script that does not run or throws |
| browser-compatibility.md | Chrome vs Firefox differences, Manifest V3, Safari |
| security-checklist.md | Scripts handling credentials, cookies or user input, or reviewing someone else's script |
| version-numbering.md | Version strings beyond X.Y.Z, or auto-update comparison |
| typescript.md | TypeScript: @types/tampermonkey, tsconfig, bundling to a single .user.js |
references/api-async.md (opens in a new tab)references/api-audio.md (opens in a new tab)references/api-cookies.md (opens in a new tab)references/api-dom-ui.md (opens in a new tab)references/api-storage.md (opens in a new tab)references/api-sync.md (opens in a new tab)references/api-tabs.md (opens in a new tab)references/browser-compatibility.md (opens in a new tab)references/common-pitfalls.md (opens in a new tab)references/debugging.md (opens in a new tab)references/header-reference.md (opens in a new tab)references/http-requests.md (opens in a new tab)references/patterns.md (opens in a new tab)references/sandbox-modes.md (opens in a new tab)references/security-checklist.md (opens in a new tab)references/typescript.md (opens in a new tab)references/url-matching.md (opens in a new tab)references/version-numbering.md (opens in a new tab)references/web-requests.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub henkisdabro/wookstar-claude-plugins --plugin tampermonkeyOther plugins' skills for the same job