---
title: "blast-radius"
url: "https://claudemods.dev/zh-tw/builds/blast-radius-bb4550"
source: "https://github.com/cskwork/claude-code-mods/tree/main/blast-radius"
source_type: "github"
repo: "https://github.com/cskwork/claude-code-mods/tree/main/blast-radius"
author: "cskwork"
author_handle: "cskwork"
stars: 0
category: "安全與隱私"
categories: ["security"]
tags: ["bash", "claude-code", "destructive-commands", "dry-run", "hooks", "plugin", "safety"]
permission_level: 2
scan_complete: true
install: "claude plugin marketplace add cskwork/claude-code-mods\nclaude plugin install blast-radius@claude-code-mods"
added: "2026-10-05T15:34:12.942Z"
updated: "2026-11-06T03:14:49Z"
locale: "zh-tw"
content_locale: "zh-tw"
---

# blast-radius

先預演有風險的 Bash 指令（遞迴刪除、破壞性的 git、kubectl delete、清除 SQL），再詢問 Proceed 或 Cancel。

## Description

# claude-code-mods

Claude Code (2.1.287+) 的 mod：透過 function hooks 觀察、改寫或回應 Claude Code 的行為，並繪製自己的介面。根據 [Getting started with Claude Code mods](https://claude.dev/blog/getting-started-with-claude-code-mods/)。

落地頁：https://cskwork.github.io/claude-code-mods/

| Mod | 功能 |
| --- | --- |
| [token-weather](token-weather) | 在提示列上方顯示上下文視窗的一行預測：☀ Clear → ↯ Compact soon、已使用的 token、最近 12 個回合的 sparkline，以及最近一回合增加的數量。 |
| [blast-radius](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）預演會觸及的內容，再詢問 **Proceed** 或 **Cancel**。取消或關閉都會拒絕呼叫。 |
| [template](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

```bash
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 由三個檔案和一份可選的狀態契約組成：

```
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）。

## 檢查

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

## Install

```
claude plugin marketplace add cskwork/claude-code-mods
claude plugin install blast-radius@claude-code-mods
```

## Original 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](https://claude.dev/blog/getting-started-with-claude-code-mods/).

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

| Mod | What it does |
| --- | --- |
| [`token-weather`](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`](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`](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

```bash
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

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