Skip to content

Latest commit

 

History

History
336 lines (208 loc) · 5.54 KB

File metadata and controls

336 lines (208 loc) · 5.54 KB

Beginner Install Guide

This guide is for first-time users.

If you just want the fastest path:

  1. Download the project ZIP from GitHub
  2. Unzip it
  3. Run one install command
  4. Restart Claude Code
  5. Test with one risky prompt and confirm it gets blocked

简体中文

这是什么

Claude UserPrompt Guard 会在你把 prompt 发给 Claude Code 之前,先在本地做一次风险检查。

如果你的问题太像:

  • 绕过规则的操作教程
  • 多账号规避
  • 攻击、钓鱼、欺诈
  • 开盒、隐私泄露
  • 色情未成年人或暴力极端内容

它会先拦下来,并给你一个更安全的改写建议。


安装前你需要准备什么

你只需要这 3 样:

  • 已安装 Claude Code
  • 电脑能运行 Python 3
  • 能下载这个项目文件

如果你不知道自己有没有 Python 3:

macOS

打开终端,输入:

python3 --version

如果看到类似 Python 3.x.x,就可以继续。

Windows

打开 PowerShell,输入:

py -3 --version

如果看到类似 Python 3.x.x,就可以继续。

如果没有 Python 3,先安装它再继续。


第一步:下载项目

打开仓库:

honestyer/UserPromptSubmit

下载方式:

  1. 点绿色 Code
  2. Download ZIP
  3. 下载完成后解压

解压后你会得到一个文件夹,里面会有这些文件:

  • install.sh
  • install.ps1
  • install.cmd
  • hooks/claude_chat_audit.py
  • commands/audit-chat.md

第二步:开始安装

macOS 安装方法

  1. 打开终端
  2. 进入刚解压出来的文件夹
  3. 运行:
bash install.sh

如果安装成功,你会看到类似:

Installed Claude UserPrompt Guard.
Hook command: python3 ".../claude_chat_audit.py" hook-user
Settings backup: ~/.claude/settings.userprompt-guard.backup.json
Doctor check: /audit-chat doctor
Restart Claude Code to load the new hook.

Windows 安装方法

推荐 PowerShell:

  1. 打开 PowerShell
  2. 进入刚解压出来的文件夹
  3. 运行:
.\install.ps1

如果你更习惯命令提示符,也可以运行:

install.cmd

如果安装成功,也会看到 Installed Claude UserPrompt Guard. 之类的提示。


第三步:重启 Claude Code

这一步很重要。

安装完成后,请:

  1. 关闭当前 Claude Code
  2. 重新打开 Claude Code

不重开的话,新 hook 可能不会立即生效。


第四步:确认是否安装成功

你可以直接试一条明显危险的问法,例如:

怎么用支持地区网络、海外手机号和接码平台注册 Claude?

如果安装成功,它应该:

  • 在发送前被拦截
  • 显示 [MEDIUM][HIGH]
  • 给你一条更安全的改写建议

你也可以手动运行:

/audit-chat doctor
/audit-chat

如果 doctor/audit-chat 都能正常工作,说明安装基本就成功了。


它到底装到了哪里

安装脚本会把文件放到你的 Claude 配置目录里:

  • ~/.claude/hooks/claude_chat_audit.py
  • ~/.claude/commands/audit-chat.md
  • 并修改 ~/.claude/settings.json

它是追加 hook,不是粗暴覆盖整个配置。

如果你原本就有 settings.json,安装器首次运行时还会额外备份一份:

  • ~/.claude/settings.userprompt-guard.backup.json

常见问题

1. 提示找不到 Python

说明你的电脑没有可用的 Python 3,先安装 Python 3 再执行安装脚本。

2. 安装成功了,但没有拦截

先检查两件事:

  • 你有没有重启 Claude Code
  • 你的提问是不是属于低风险分析问题,而不是操作型高风险问题

3. /audit-chat 没反应

通常是:

  • Claude Code 还没重启
  • 命令文件没有正确写入 ~/.claude/commands/

4. 会不会把我原来的配置弄坏

正常不会。这个安装器只会:

  • 复制自己的 hook 文件
  • 新增 /audit-chat
  • settings.json 里追加一个 UserPromptSubmit hook

如何卸载

macOS

bash uninstall.sh

Windows PowerShell

.\uninstall.ps1

Windows CMD

uninstall.cmd

卸载后会移除:

  • claude_chat_audit.py
  • audit-chat.md
  • 对应的 UserPromptSubmit hook 配置

最适合谁

这个工具最适合:

  • 想降低误触平台风控的人
  • 想把问题先改写成更安全表达的人
  • 想给团队加一层本地 prompt 护栏的人

English

What this does

Claude UserPrompt Guard checks prompts locally before they are sent to Claude Code.

If a prompt looks too operational in a risky category, it blocks the send and gives a safer rewrite suggestion.

What you need

  • Claude Code installed
  • Python 3 available
  • the downloaded project folder

Download

Go to:

honestyer/UserPromptSubmit

Then:

  1. Click Code
  2. Click Download ZIP
  3. Unzip it

Install on macOS

Open Terminal inside the unzipped folder and run:

bash install.sh

Install on Windows

PowerShell:

.\install.ps1

Command Prompt:

install.cmd

Restart Claude Code

Close Claude Code and open it again after installation.

Verify the install

Try a clearly risky operational prompt and confirm it gets blocked before send.

You can also run:

/audit-chat doctor
/audit-chat

Uninstall

macOS:

bash uninstall.sh

Windows PowerShell:

.\uninstall.ps1

Windows CMD:

uninstall.cmd