modscode EN

modscode / コード参考書 / 設定項目(userConfig)

設定項目を持たせる(userConfig)

マニフェスト(.claude-plugin/plugin.json)の userConfig で設定項目を宣言すると、その値が既定値込みで register(on, options) の options に入ります。使う人は設定の pluginConfigs で値を変えられます。

plugin.json userConfigregister(on, options)pluginConfigs

最小の形

hooks/register.js (+ plugin.json)
// .claude-plugin/plugin.json
// {
//   "name": "focus-timer",
//   "userConfig": {
//     "minutes": { "type": "number", "title": "Minutes", "description": "Length of one focus block", "default": 25 }
//   }
// }

export function register(on, options) {
  // options holds the userConfig values, with the defaults filled in
  const minutes = Number(options.minutes ?? 25)

  on('session.start', async ($, e, next) => {
    $.ui.status('focus: ' + minutes + ' min')
    return next(e)
  })
}

modscode が公式ドキュメントの API で書いた最小の例です。自由に使えます。

実際の Mod のコード(6 本)

GitHub の公開 Mod から、図鑑が読んだコミットの該当行をそのまま引いています。見出しから Mod のページ(何をするか・良いところ・画面・コードが触るもの)へ、ファイル名から GitHub の該当行へ移れます。

写す前・入れる前に、必ず自分でコードを確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode は中身の安全を保証しません。

ruview-live ruvnet · ターミナル+デスクトップ · ★ 96675

RuView live sensing in Claude Code: /ruview opens a pane beside the transcript with three views: an overview of your CSI nodes (ESP32, Realtek) and 60 GHz radar (rates, loss, RSSI, presence, device-reported vitals, alerts), a live CSI ampl…

"userConfig": {
  "udpPort": {
    "type": "number",
    "title": "UDP port",
    "description": "Port your CSI nodes stream to (the sensing server's default is 5005). The pane listens briefly on each refresh; it reports port_in_use when the sensing server holds it.",
    "default": 5005
  },
  "radarHost": {
    "type": "string",
    "title": "Radar kit host",
    "description": "IP or hostname of an ESPHome radar kit (e.g. a Seeed MR60BHA2) on your private network. Empty skips the radar.",
    "default": ""
  },
  "refreshSeconds": {
    "type": "number",
    "title": "Refresh interval (s)",
    "description": "Seconds between refreshes while the pane is open (minimum 5).",
    "default": 15
  },
  "captureSeconds": {
    "type": "number",
    "title": "Capture window (s)",
    "description": "Seconds each refresh listens for node packets and radar states (1-10).",
    "default": 3
  },
  "liveRefreshSeconds": {
    "type": "number",
    "title": "Live view refresh (s)",
    "description": "Seconds between refreshes in the waterfall and radar views (2-60).",
    "default": 4
  }
}

MIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面

ライセンスの全文(MIT)
MIT License

Copyright (c) 2024 rUv

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

my-mod ruvnet · ターミナル+デスクトップ · ★ 73986

A Claude Code mod scaffolded by ruflo-plugin-creator: counts the session's tool calls in a status line, adds /my-mod-status, and keeps a classic hook as the fallback where function hooks are off.

"userConfig": {
  "statusLine": {
    "type": "boolean",
    "title": "Status line",
    "description": "Show the tool-call count under the prompt.",
    "required": false,
    "default": true
  }
}

MIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面

ライセンスの全文(MIT)
MIT License

Copyright (c) 2024-2026 ruvnet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

ruflo-protector ruvnet · ターミナル+デスクトップ · ★ 73986

Project Anatole: an optional, learning watchdog for unattended agents. Deterministic OWASP-mapped rules, a per-project behavioural baseline, four modes (off, learn, notify, enforce), alerts you can read later.

"userConfig": {
  "mode": {
    "type": "string",
    "title": "Project Anatole mode",
    "description": "off: do nothing. learn (default): record the baseline and say nothing. notify: alert, never block. enforce: rules marked block deny. A mode set with /protector mode overrides this.",
    "required": false,
    "default": "learn",
    "options": ["off", "learn", "notify", "enforce"]
  },
  "autoGraduate": {
    "type": "string",
    "title": "Graduate learn to notify",
    "description": "When the baseline is mature (200 events, 3 sessions, 24 hours), move learn to notify. Never moves to enforce.",
    "required": false,
    "default": "on",
    "options": ["on", "off"]
  }
}

MIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面

ライセンスの全文(MIT)
MIT License

Copyright (c) 2024-2026 ruvnet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

ruflo-adr ruvnet · フックだけ · ★ 73986

ADR lifecycle management — create, index, reconcile, supersede, check compliance, and link Architecture Decision Records to code via AgentDB hierarchical store + causal edges (supersedes/amends/depends-on/related)

"userConfig": {
  "guard": {
    "type": "string",
    "title": "ADR guard",
    "description": "Refuse ADR writes (agentdb_hierarchical-store, agentdb_causal-edge, memory_store into an adr* namespace) that hold a key, token or password.",
    "required": false,
    "default": "on",
    "options": [
      "on",
      "off"
    ]
  }
}

MIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面

ライセンスの全文(MIT)
MIT License

Copyright (c) 2024-2026 ruvnet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

ruflo-agent ruvnet · フックだけ · ★ 73986

Agent runtimes for ruflo — local WASM-sandboxed agents (rvagent: 10 wasm_agent_*/wasm_gallery_* MCP tools, built on @ruvector/rvagent-wasm + @ruvector/ruvllm-wasm per ADR-070) plus Anthropic Claude Managed Agents as a cloud backend (manage…

"userConfig": {
  "guard": {
    "type": "string",
    "title": "Agent guard",
    "description": "Refuse text sent into an agent runtime (wasm_agent_prompt, wasm_agent_tool, wasm_agent_create, wasm_gallery_create, managed_agent_create, managed_agent_prompt) that hold a key, token or password.",
    "required": false,
    "default": "on",
    "options": [
      "on",
      "off"
    ]
  }
}

MIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面

ライセンスの全文(MIT)
MIT License

Copyright (c) 2024-2026 ruvnet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

ruflo-ai-team ruvnet · フックだけ · ★ 73986

Give Claude a tenant-isolated AI team that divides work, coordinates progress, recalls approved context, and returns evidence-backed results.

"userConfig": {
  "guard": {
    "type": "string",
    "title": "AI Team guard",
    "description": "Refuse what goes into team memory and task or run records (memory_remember, task_create, task_update, run_create on the ruflo-ai-team server) that hold a key, token or password.",
    "required": false,
    "default": "on",
    "options": [
      "on",
      "off"
    ]
  }
}

MIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面

ライセンスの全文(MIT)
MIT License

Copyright (c) 2024-2026 ruvnet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

作り始める

フォルダーに .claude-plugin/plugin.json({"name": "my-mod"})と hooks/hooks.json({"modules": ["register.js"]})を置き、上のコードを hooks/register.js に保存して、claude --plugin-dir . で 1 セッションだけ読み込みます。claude plugin validate . で、フックするイベントと呼ぶ API の一覧が出ます。

ほかのパターン