ClaudeMods
☰
JA
● 0 人がオンライン ・閲覧 0 回
スポンサー作品を投稿
GitHub リポジトリ · 投稿者 cskwork

blast-radius

危険な Bash コマンド(再帰削除、破壊的な git、kubectl delete、SQL の消去)を dry-run し、先に Proceed か Cancel を確認します。

cskwork@cskwork

cskwork/claude-code-mods/tree/main/blast-radius

翻訳済み

この mod について

claude-code-mods

Claude Code (2.1.287+) 用の mod です。function hooks で Claude Code の動作を監視、書き換え、応答し、独自の UI を描画します。Getting started with Claude Code mods を基にしています。

ランディングページ:https://cskwork.github.io/claude-code-mods/

| Mod | 内容 | | --- | --- | | token-weather | プロンプト上のコンテキストウィンドウを 1 行で予測します。☀ Clear → ↯ Compact soon、使用済み token、直近 12 ターンの sparkline、直前のターンが追加した量を表示します。 | | blast-radius | 危険な Bash コマンド(再帰 rm、git reset --hard、git clean -f、force push、git branch -D、git stash drop/clear、kubectl delete、SQL DROP/TRUNCATE、migration)の前に影響範囲を dry-run し、Proceed または Cancel を確認します。キャンセルや閉じる操作は呼び出しを拒否します。 | | template | 未インストールの mod テンプレートです。slash command、ステータス行、band、テスト付きの $.state 契約が含まれます。 |

インストール

Claude Code 内で:

/plugin marketplace add cskwork/claude-code-mods
/plugin install token-weather@claude-code-mods
/plugin install blast-radius@claude-code-mods
/reload-plugins

新しい mod を作る

scripts/new-mod.sh my-mod "One line about what it does"
claude --plugin-dir "$PWD/my-mod"     # hot-reloads on every save

このスクリプトは template/ をコピーして名前を変更し、.claude-plugin/marketplace.json に追加してから claude plugin validate と claude plugin test を実行します。

mod は 3 つのファイルと任意の state 契約で構成されます。

my-mod/
├── .claude-plugin/plugin.json   name, version, description, "types"
├── hooks/hooks.json             { "modules": ["./register.tsx"] }
├── hooks/register.tsx           export const register: Register = on => { ... }
├── types/index.d.ts             PluginState contract for $.state values
└── tests/my-mod.test.ts         claude plugin test my-mod

注意が必要なルール:

  • すべての hook は ($, e, next) です。next(e) で通過させ、next({ ...e, x }) で書き換え、呼ばなければ応答します。
  • 値は $.state(atom / read / update)に保持します。ホットリロードのたびにモジュール変数はリセットされます。
  • Node と DOM は使いません。ファイル、プロセス、時計、UI は $ を通し、UI 要素は $.ui.resolve(e) から取得します。
  • テストの mock も hooks です:on('process.run', ($, e) => ({ value: ... }))。
  • エンジンが mod をロードすると隣に .claude-plugin/types/ を書くため、tsc -p <mod> で型チェックできます(gitignore 済み)。

チェック

for m in token-weather blast-radius template; do claude plugin validate $m && claude plugin test $m; done

インストール

まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。

claude plugin marketplace add cskwork/claude-code-mods
claude plugin install blast-radius
原文 / README

claude-code-mods

Mods for Claude Code (2.1.287+): plugins of function hooks that observe, rewrite or answer what Claude Code does and draw their own UI. Based on Getting started with Claude Code mods.

Landing page: https://cskwork.github.io/claude-code-mods/

| Mod | What it does | | --- | --- | | token-weather | A one-line forecast of the context window above the prompt: ☀ Clear → ↯ Compact soon, tokens used, a sparkline of the last 12 turns, and how much the last turn added. | | blast-radius | Before a risky Bash command runs (recursive rm, git reset --hard, git clean -f, force push, git branch -D, git stash drop/clear, kubectl delete, SQL DROP/TRUNCATE, migrations), dry-runs what it would touch and asks Proceed or Cancel. Cancel or dismiss denies the call. | | template | Starter mod, not installed: a slash command, a status line entry, a band, and a $.state contract with a test. |

Install

Inside Claude Code:

/plugin marketplace add cskwork/claude-code-mods
/plugin install token-weather@claude-code-mods
/plugin install blast-radius@claude-code-mods
/reload-plugins

Make a new mod

scripts/new-mod.sh my-mod "One line about what it does"
claude --plugin-dir "$PWD/my-mod"     # hot-reloads on every save

The script copies template/, renames it, adds it to .claude-plugin/marketplace.json, then runs claude plugin validate and claude plugin test on it.

A mod is three files plus an optional state contract:

my-mod/
├── .claude-plugin/plugin.json   name, version, description, "types"
├── hooks/hooks.json             { "modules": ["./register.tsx"] }
├── hooks/register.tsx           export const register: Register = on => { ... }
├── types/index.d.ts             PluginState contract for $.state values
└── tests/my-mod.test.ts         claude plugin test my-mod

Rules that bite:

  • Every hook is ($, e, next). Call next(e) to pass on, next({ ...e, x }) to rewrite, return without it to answer.
  • Keep values in $.state (atom / read / update); module variables reset on every hot reload.
  • No Node, no DOM: files, processes, clock and UI go through $. UI elements come from $.ui.resolve(e).
  • Test mocks are hooks too: on('process.run', ($, e) => ({ value: ... })).
  • After the engine loads a mod it writes .claude-plugin/types/ beside it, so tsc -p <mod> type-checks it (gitignored).

Check

for m in token-weather blast-radius template; do claude plugin validate $m && claude plugin test $m; done

同名の他の作品

関連作品