---
title: "blast-radius"
url: "https://claudemods.dev/zh-cn/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-cn"
content_locale: "zh-cn"
---

# 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、迁移）预演会触及的内容，并询问 **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
```
