modscode / コード参考書 / スラッシュコマンドを足す
スラッシュコマンドを足す($.command.register)
.claude/commands/ の Markdown は Claude への頼みを定型にするだけですが、mod のコマンドはコードで動きます。session.start で $.command.register({ name, description }) し、on('command.run', { command: name }) で受けて { text }(何も出さないなら {})を返します。ペインを開くコマンドにもよく使います。
最小の形
export function register(on) {
on('session.start', async ($, e, next) => {
await $.command.register({ name: 'standup', description: 'Summarize what changed today', argumentHint: '[days]' })
return next(e)
})
on('command.run', { command: 'standup' }, async ($, e) => {
const days = e.args || '1'
const log = await $.process.run(['git', 'log', '--oneline', '--since=' + days + '.days'])
return { text: log.stdout || 'Nothing changed.' }
})
}
modscode が公式ドキュメントの API で書いた最小の例です。自由に使えます。
実際の Mod のコード(6 本)
GitHub の公開 Mod から、図鑑が読んだコミットの該当行をそのまま引いています。見出しから Mod のページ(何をするか・良いところ・画面・コードが触るもの)へ、ファイル名から GitHub の該当行へ移れます。
写す前・入れる前に、必ず自分でコードを確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode は中身の安全を保証しません。
better-statusline Ewen Gao · ターミナル+デスクトップ · ★ 135
The status line above the prompt: the session's status and the music playing, one design
on('session.start', async ($, e, next) => {
const started = await next(e)
if (!e.isInteractive) return started
await Promise.all([
$.command.register({ name: 'fold', description: 'Fold the status line into one row, or open it to five', immediate: true }),
seed($),
])
void readGit($)
plan($)
watchAgents($)
$.clock.every(60_000, () => void readGit($))
void setUp($, options as Options).then(machine => (machine.folder === null ? undefined : listen($)))
return started
})MIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面
ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Ewen Gao 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.
intermission Jarrod Watts · ターミナル+デスクトップ · ★ 99
Play Doom deathmatch while Claude works, and get handed back when it's done
on('session.start', async ($, e, next) => {
isOn = (await $.store.get('isOn')) === true
name = await $.store.get('name')
if (!name) {
name = randomName()
await $.store.set('name', name)
}
await $.command.register({
name: 'intermission',
description: 'Play Doom while Claude works',
argumentHint: '[off]',
})
return next(e)
})MIT ライセンス。写すときは著作権表示を残してください。 この Mod のコードと画面
ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Jarrod Watts 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-rag-memory ruvnet · フックだけ · ★ 73986
RuVector memory with HNSW search, AgentDB, and semantic retrieval. As a mod (ADR-445): a write guard that keeps secrets out of memory, /rag-mod, and a status file the console shows
on('session.start', async ($, e, next) => {
const result = await next(e)
try {
s.root = (await $.session.root()) as string | undefined
} catch {
/* no project root: the mod still answers, it just writes no status file */
}
try {
await $.command.register({ name: 'rag-mod', description: 'ruflo-rag-memory mod: status, scan <text>, tools' })
} catch {
/* a name taken by another plugin must not stop the mod */
}
await flush($, s)
return result
})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-ruvllm ruvnet · フックだけ · ★ 73986
RuVLLM local inference with chat formatting (Claude/GPT/Gemini/Ollama/Cohere), model configuration, MicroLoRA fine-tuning, and SONA real-time adaptation. As a mod (ADR-445): a guard that keeps secrets out of adapters and the pattern router…
on('session.start', async ($, e, next) => {
const result = await next(e)
try {
s.root = (await $.session.root()) as string | undefined
} catch {
/* no project root: the mod still answers, it just writes no status file */
}
try {
await $.command.register({ name: 'ruvllm-mod', description: 'ruflo-ruvllm mod: status, scan <text>, tools' })
} catch {
/* a name taken by another plugin must not stop the mod */
}
await flush($, s)
return result
})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-ruvector ruvnet · フックだけ · ★ 73986
Self-learning vector database via npx ruvector@0.2.25 — HNSW, adaptive LoRA embeddings, code-graph clustering, hooks routing, brain/SONA, 103 MCP tools. As a mod (ADR-445): a write guard that keeps secrets out of the vector store and share…
on('session.start', async ($, e, next) => {
const result = await next(e)
try {
s.root = (await $.session.root()) as string | undefined
} catch {
/* no project root: the mod still answers, it just writes no status file */
}
try {
await $.command.register({ name: 'ruvector-mod', description: 'ruflo-ruvector mod: status, scan <text>, tools' })
} catch {
/* a name taken by another plugin must not stop the mod */
}
await flush($, s)
return result
})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-rvf ruvnet · フックだけ · ★ 73986
RVF format for portable agent memory, session persistence, and cross-platform transfer. As a mod (ADR-445): a write guard that keeps secrets out of memory, sessions and transfers, /rvf-mod, and a status file the console shows
on('session.start', async ($, e, next) => {
const result = await next(e)
try {
s.root = (await $.session.root()) as string | undefined
} catch {
/* no project root: the mod still answers, it just writes no status file */
}
try {
await $.command.register({ name: 'rvf-mod', description: 'ruflo-rvf mod: status, scan <text>, tools' })
} catch {
/* a name taken by another plugin must not stop the mod */
}
await flush($, s)
return result
})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 の一覧が出ます。