setup
Verify the rate-limits plugin on this machine: node, whether its mod runs in this session, the snapshot file's freshness, the StopFailure hook, every option's effective value, and a directory left by the plugin's earlier name. Use when: 'set up rate-limits', 'is rate-limits working', the snapshot file is stale, a consuming loop lane reports guard mode unknown, or after a plugin update. Actions: check (read-only, default; prints every remediation and never edits settings, scripts or files), apply (on explicit request, migrates only the directory left by the earlier plugin name: merges its stop record into ~/.claude/rate-limits/stop-events.jsonl, old records first, and removes the directory).
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 30
- Forks
- 7
01 前言 Front Matter
- shell
- bash
- description
- Verify the rate-limits plugin on this machine: node, whether its mod runs in this session, the snapshot file's freshness, the StopFailure hook, every option's effective value, and a directory left by the plugin's earlier name. Use when: 'set up rate-limits', 'is rate-limits working', the snapshot file is stale, a consuming loop lane reports guard mode unknown, or after a plugin update. Actions: check (read-only, default; prints every remediation and never edits settings, scripts or files), apply (on explicit request, migrates only the directory left by the earlier plugin name: merges its stop record into ~/.claude/rate-limits/stop-events.jsonl, old records first, and removes the directory).
- allowed-tools
- [ "Bash(command -v node*)" ]
- argument-hint
- [check|apply]
- user-invocable
- true
- disable-model-invocation
- true
03 SKILL.md 正文
Pre-computed context
check's node probe ran at load time. Read this row instead of re-issuing it; it shows the
tool's path when present, or absent when missing:
-
node: !command -v node 2>/dev/null || echo absent -
Leftover directory from the plugin's earlier name (its entries, or
(absent)): !if [ -d "$HOME/.claude/rate-limit-guard" ]; then ls -A "$HOME/.claude/rate-limit-guard" 2>&1; else echo "(absent)"; fi
A row reading [shell command execution disabled by policy] carries no result: run that
row's probe via Bash instead.
- Pointer: for the placeholder a skipped load-time command leaves, fetch skills § Inject dynamic context live.
- As of: 2026-11-11
- Recheck trigger: the placeholder text changes.
Purpose
Narrow-write setup (docs/plugin-philosophy.md "Setup is explicit and repeatable" in the
marketplace repository): check inspects and reports PASS/FAIL/INFO with one remediation line per
FAIL. The plugin owns its machine-scope runtime directory, ~/.claude/rate-limits/; apply writes
there only to finish the migration of the directory the plugin kept under its earlier name, and
writes nothing else. Every other surface is unwritable and handled the check-only way:
- Native
userConfig: eight options whose only stored home is thepluginConfigssetup must never write. Reconfigure through Claude Code's native flow, interactively with/plugin configure rate-limits@<marketplace>or by a headless route, as the marketplace's plugin-reconfiguration convention gives them in § The routes (it owns the verified-version record). Apply the scope and failure-signal caveats in its § Caveats every setup skill's short form carries. Read both sections and print what they give, the fallback route, its behavior on an already-installed plugin and the scope to pass included, rather than only naming them, and leave out the verified-version record. Never uninstall to reconfigure; that section links what an uninstall deletes. Afterwards reruncheckin a fresh session, since a same-sessioncheckcan still show the old value, and report the observed effective value, never an unobserved change.- Pointer: for the headless command's flags, how it reports a saved or refused value, and when a saved value applies, fetch plugin CLI reference § plugin configure live.
- External prerequisites:
nodeand the Claude Code version, whichcheckprobes and whose install is the person's.
The files under ~/.claude/rate-limits/ are runtime-owned plugin data, written by the module
and the StopFailure hook, not an operator-editable surface.
Action routing: no argument or check runs the check; apply runs the earlier-name migration
below.
The code is the source of truth for its own behavior. Each check step below states what its row
needs; read ${CLAUDE_PLUGIN_ROOT}/hooks/register.tsx or
${CLAUDE_PLUGIN_ROOT}/hooks/record-rate-limit-stop.sh only for a finding no step covers. The consumer-facing constants (snapshot path, threshold, staleness rule)
are owned by ${CLAUDE_PLUGIN_ROOT}/reference/reader-contract.md.
check (read-only)
Label every row PASS, FAIL, INFO or UNKNOWN. A check that cannot run here (a command missing or refused, a file the session may not read) is UNKNOWN with the reason, never "skipped" or "not run". Give each FAIL exactly one remediation line; a FAIL that depends on a condition names it in that line.
-
node. The pre-computednoderow. FAIL if absent: theStopFailurerow inhooks/hooks.jsonis exec form,"command": "node"withhooks/exec-bash.mjsinargs, so withoutnodeonPATHthe hook never launches, a launch failure is non-blocking, and no rate-limit stop is recorded; and the module writes the snapshot by runningnode lib/write-snapshot.mjs, so no snapshot is written either. The module's lines, band row and status tool do not need it. Remediation: install Node.js (https://nodejs.org/en/download) yourself and restart Claude Code.- Pointer: when whether a Claude Code install supplies
nodeis in doubt, fetch setup § Install with npm live.
- Pointer: when whether a Claude Code install supplies
-
Module state. The plugin's module (
hooks/register.tsx) writes the snapshot file and sends the rate-limit lines; it loads only where mods can. Decide this session's state from inside this session, never from a separate process: aclaudeyou launch through Bash reads neither this session's flags nor its--settingsoverlay.-
Run
claude --version. Older than 2.1.287 → FAIL "mods off: Claude Code <version> is older than the 2.1.287 floor; older builds are unsupported". Remediation: update Claude Code. -
This session. At
session.startthe module registers its pull tool, which Claude sees asmcp__rate-limits__status. Look for that name in your own tool list, counting a name listed only as a deferred tool. Do not call it.- Present → PASS "mod running in this session".
- Absent → INFO "mods off in this session, or the status tool's registration was refused".
Say both causes and do not pick one: mods are off here (what turns them off: the
doesn't-load pointer below), or the organization's policy refused the tool, in which case the module
writes one
the status pull tool could not registerline to the debug log (claude --debug).
-
This machine (not this session). Optionally run
claude plugin testfrom a new empty temporary directory and read its message against the table at the pointer below. It reports whether mods can load on this build under the settings a fresh process reads, and nothing about this session. Label the row "machine-level: mods can load on this build" or "machine-level: mods off (<cause the table gives>)", never as this session's state. The row is INFO, or UNKNOWN whenclaude plugin testcannot run here. -
Where mods are off, the guard runs reactive-only there: the StopFailure hook still records, and the file updates only from other sessions that run the module.
-
Pointer: api: add a tool (the
mcp__<plugin>__<name>form), troubleshoot: check whether mods can load and the mod doesn't load. -
As of: 2026-10-03, Claude Code 2.1.288; the doesn't-load anchor 2026-10-11.
-
Recheck trigger: the full tool name form changes, that table changes a message, or the minimum version changes.
-
-
Snapshot freshness. The module writes after main-thread tool results, so this check's own Bash calls have each given it a chance to write before you read the file. Read the fixed contract path
~/.claude/rate-limits/rate-limits.jsonand parse it as JSON:rate_limitspresent andcaptured_atwithin the staleness window the reader contract's operable floor fixes (read the value there, never from here; a number restated in this file is a copy nothing keeps in step with the contract) → PASS (proactive mode available).- Fresh but
rate_limitsabsent → INFO: the sessions writing it see no subscription windows (API-key or enterprise auth); consumers correctly run reactive-only. Not a defect. The module writesrate_limitsonly when its session sees subscription windows, so this row needs no source read. The reader contract owns this fail-open rule: the "Snapshot file absent, stale, or missingrate_limits" row of its "Capability detection (fail-open)" table in${CLAUDE_PLUGIN_ROOT}/reference/reader-contract.md. Name that row as the owner when reporting this result. - Absent or stale while step 2 reported mods off, or while
rate_limits_enabled(step 5) isfalse→ INFO with that row's wording: no module writes from here. Not a missing instrument and not a wiring defect. - Absent or stale while step 2 found the mod running and writes are on → FAIL: the module ran
but its write did not land. Check step 1 (
node), then the debug log forrate-limits: snapshot write failedorrate-limits: snapshot write did not run, then the permissions of~/.claude/rate-limits/.
-
StopFailure hook. INFO: the hook needs no wiring (it registers via the plugin's
hooks/hooks.json); confirm the plugin is enabled (/plugin→ Installed). Report whether~/.claude/rate-limits/stop-events.jsonlexists. Absent just means no rate-limit stop has been recorded yet. -
Option posture. Report every option, each as its own row with the value substituted below and what that value does, even when every value is UNKNOWN. Never collapse them into one "active" or "UNKNOWN" status: a plugin that is enabled while its writes or lines are off is the exact state a person is diagnosing when the file is stale or the lines are missing.
Option Value Default What it does rate_limits_enabled${user_config.rate_limits_enabled}truefalsestops the StopFailure hook's records and the module's snapshot writes; lines, band and status tool continue.model_notices${user_config.model_notices}falsefalsesends Claude no lines and offers no operator-mode suggestions;truesends them.rate_limit_report_mode${user_config.rate_limit_report_mode}automaticautomaticsends the lines to Claude;operatorholds them in a turn a person typed and offers them as a prompt suggestion plus a notice row above the prompt.rate_limit_line_threshold${user_config.rate_limit_line_threshold}95Window use at which Claude gets the threshold line. An opted-in loop lane's pause threshold stays 95 whatever this is. rate_limit_approach_pct${user_config.rate_limit_approach_pct}90Window use for the one approach line; at or above the threshold, none is sent. rate_limit_line_data${user_config.rate_limit_line_data}verdict,percent,window,resetWhat a line carries beside its verdict: percent,window,reset.rate_limits_band${user_config.rate_limits_band}falsetruedraws the band row;/rate-limits band onorband offsets it for one session.rate_limits_toast${user_config.rate_limits_toast}truefalsedrops the toast when a window nears or reaches the threshold or resets; the transcript line stays.-
Any value still showing its literal
${user_config.<name>}token (unset key, or a Claude Code without the substitution) → UNKNOWN for that row, never the default stated as fact. The module gets every option with theplugin.jsondefault filled in; the StopFailure hook readsrate_limits_enabledfrom itsCLAUDE_PLUGIN_OPTION_*variable and treats unset as on. The person-inspectable source of truth is this plugin'spluginConfigsoptions block in the usersettings.json(the hook-config-delivery convention, https://github.com/melodic-software/claude-code-plugins/blob/main/docs/contracts/hook-config-delivery/README.md, owns why the declareddefaultfield is not delivered to hook processes). -
A
rate_limit_lines_enabledkey left inpluginConfigsdoes nothing;model_noticesreplaced it. Report it as INFO, safe to remove. -
A threshold or approach mark outside 1 to 100, or a
rate_limit_line_datalist with an unknown item, reads as that option's default, and the module logs one transcript line naming it. Report the value as invalid and the default as what runs. A value of the wrong type (text for a number or a switch) stops the module loading: report it with step 2's row. -
Every option except
rate_limits_enabledacts only where step 2 found the mod running. -
A change made now is observed only in a fresh session: rerun this check there and report the observed value, never an unobserved change.
- Pointer: for when a saved value reaches skill content and hook processes, fetch plugins manifest reference § Reference a saved value live.
-
-
Directory left by the earlier name (migration). Read the pre-computed leftover row.
(absent)→ PASS. Otherwise FAIL "drift:~/.claude/rate-limit-guard/is left from the plugin's earlier name" and list its entries. Lanes read the snapshot only at~/.claude/rate-limits/, so a snapshot there is read by nothing. Change nothing here. Remediation:apply, which merges its stop record and removes it (see "apply" below). A session still running the plugin under its earlier name recreates the directory until it ends; a laterapplyfinishes it.
apply (earlier-name directory only, on explicit request)
Runs when ~/.claude/rate-limit-guard/ exists; otherwise report that there is nothing to move.
Refuse, and change nothing, when either directory, or either stop-events.jsonl, is a symbolic
link. Each step that stops keeps the old directory as it is and says why; a later apply
finishes it.
-
A session still running the earlier name. When any file in
~/.claude/rate-limit-guard/changed within the staleness window the reader contract's operable floor fixes (read it from${CLAUDE_PLUGIN_ROOT}/reference/reader-contract.md), stop: that session's module rewrites the snapshot there and would recreate the directory. This check cannot see an idle session on the earlier name; whatever such a session writes later, a laterapplymerges. -
The status line. When the
statusLinecommand in effect (user, project and localsettings.json, the most specific scope that sets it) names a path under~/.claude/rate-limit-guard/, stop and print that command for the operator; never edit a settings file. -
Known entries only. List every entry of the old directory, recursively. These are known: the snapshot
rate-limits.json,stop-events.jsonl, any*.lockand any*.tmp.*file (rewritten by the module and the hook), and what releases before the module left and nothing reads now:bin/statusline-shim.sh,spool/and its files,.statusline-tee-path,.tee-disabledand.last-write. When anything else is there, list it and stop: the operator decides what it is. -
The stop record. No old
stop-events.jsonl(a machine that never hit a rate-limit stop): skip to step 5. Otherwise create~/.claude/rate-limits/with mode 700 when absent and run this block, which holds the hook's own lock in both directories for the whole merge: the sameflock -w 2overstop-events.jsonl.lockthathooks/record-rate-limit-stop.shandhook::append_jsonlinhooks/hook-utils.shtake, the old directory's first (fd 8, which a session on the earlier name writes under), then the new one's (fd 9), and no lock whereflockis missing, as the hook runs there. The old records go first and the new file's after them, because the hook appends newest last and its rotation keeps the last lines. The old file is renamed aside before the merged file replaces the new one, and the aside copy is deleted inside the block, so no laterapplycan merge it twice:old="$HOME/.claude/rate-limit-guard/stop-events.jsonl" new="$HOME/.claude/rate-limits/stop-events.jsonl" ( if command -v flock >/dev/null 2>&1; then flock -w 2 8 || exit 3 flock -w 2 9 || exit 4 fi umask 077 if [ ! -e "$new" ]; then mv -- "$old" "$new" || exit 1; exit 0; fi tmp="$new.tmp.$BASHPID" aside="$old.merged.$BASHPID" { cat -- "$old" && if [ -s "$old" ] && [ -n "$(tail -c 1 -- "$old")" ]; then printf '\n'; fi && cat -- "$new"; } >"$tmp" && mv -- "$old" "$aside" || { rm -f -- "$tmp"; exit 1; } mv -f -- "$tmp" "$new" || { mv -- "$aside" "$old"; rm -f -- "$tmp"; exit 1; } rm -f -- "$aside" ) 8>>"$HOME/.claude/rate-limit-guard/stop-events.jsonl.lock" \ 9>>"$HOME/.claude/rate-limits/stop-events.jsonl.lock"Exit 3: the old directory's lock stayed held for 2 seconds; exit 4: the new directory's did; stop either way. Any other non-zero exit: stop and say the merge failed.
-
Remove the old directory. Run this block, which holds the old directory's lock while it checks that no
stop-events.jsonlis there again (a session on the earlier name may have written one since step 4) and removes the directory, so no record lands between the check and the delete. It removes the whole directory only because step 3 already proved every entry in it known:dir="$HOME/.claude/rate-limit-guard" ( if command -v flock >/dev/null 2>&1; then flock -w 2 8 || exit 3; fi if [ -e "$dir/stop-events.jsonl" ] || [ -L "$dir/stop-events.jsonl" ]; then exit 4; fi rm -rf -- "$dir" && [ ! -e "$dir" ] ) 8>>"$HOME/.claude/rate-limit-guard/stop-events.jsonl.lock"Exit 3: the lock stayed held for 2 seconds; stop. Exit 4: a session wrote a stop record there; stop and say a later
applymerges it. Any other non-zero exit: stop and say the removal failed. Report what moved or merged, with the line counts, and what was removed.
A second apply finds nothing to move and changes nothing; say so.
Uninstalling
Uninstalling the plugin removes the cache directory, not the files under
~/.claude/rate-limits/. Consuming lanes then see no fresh snapshot and run reactive-only, as
the reader contract says. To remove the files too, delete ~/.claude/rate-limits/ after the
uninstall.
What this skill does NOT do
- Write the plugin cache, Claude Code user settings, or
pluginConfigs, per the uniform setup contract (docs/plugin-philosophy.md"Setup is explicit and repeatable" in the marketplace repository). Norsettings.json(user, project or managed), a wrapper script, or any other Claude Code settings file. - Install
node, update Claude Code, or install any system package. - Write or delete anything under
~/.claude/rate-limits/beyond theapplymigration'sstop-events.jsonlmove or merge. The module and the hook ownrate-limits.jsonandstop-events.jsonl. The migration removes only the earlier-name directory's known entries. - Edit the sibling
context-usageplugin's files.
04 同仓库更多 Skills
track
Backlog reads through the bound tracker: search open and closed items, view one item with its comments and state history. Use when another skill searches or reads tracker items.
reviewer-media
Reviewer media for one pull request: decides whether it needs a narrated walkthrough, builds the storyboard from /review:explain-change's digest, has /explainer-video:produce render it and hands the manifest to /source-control:pull-request media. Use when asked for 'reviewer media', 'a walkthrough video for this PR', 'a produced video of this change', or when pull-request ready or monitor hands a PR over.
route
Model and effort per agent role (orchestrator, worker, verifier, retrieval) for a multi-agent run, resolved through the bundled defaults and the user, team and personal override config layers into fenced JSON with single-agent and fan-out variants and the layer behind each value. Use when asked 'which model for the subagents', 'route the roles' or 'model routing', or before a skill passes a role's model on a spawn.
route
Model and effort per agent role (orchestrator, worker, verifier, retrieval) for a multi-agent run, resolved through the bundled defaults and the user, team and personal override config layers into fenced JSON with single-agent and fan-out variants and the layer behind each value. Use when asked 'which model for the subagents', 'route the roles' or 'model routing', or before a skill passes a role's model on a spawn.
principles
Module-design vocabulary for architecture findings, and the checks built on it. Use when: 'what is a deep module', 'what is a seam', 'deep vs shallow module', 'what is the deletion test', 'leverage and locality', 'module design vocabulary', 'which word do we use for X in architecture findings'. Scanning a codebase for friction is /architecture:improve.
write
Structured five-field bug report (title, steps to reproduce, expected vs actual, justified severity, suggested fix location) from an informal description, read-only. Use when the user names a defect they observed, or asks for one written up ('report a bug', 'file a bug', 'write this up as a bug').