zcaceres/claude-investigate-repo
GitHub: zcaceres/claude-investigate-repo
这是一个Claude Code技能,通过静态分析审计第三方仓库,检测恶意代码和供应链风险,以在安装前预防安全威胁。
Stars: 0 | Forks: 1
# riptive, but keep it in English if it's a proper noun.
一项 Claude Code 技能,用于在您安装、分叉或运行之前,审计一个不熟悉的第三方代码仓库,检查其是否存在安全问题、恶意代码、供应链风险以及低质量模式。
## 功能介绍
给定一个 GitHub URL(或其他 git 仓库 URL),该技能会:
1. 获取仓库元数据(存在时长、星标数、许可证、最后推送时间、作者集中度)
2. 浅克隆到一个临时目录——绝不会克隆到用户的工作目录
3. 映射目录树:按扩展名统计文件数量、最大文件、顶层布局
4. 读取 README、清单文件(`package.json`、`pyproject.toml` 等)、入口点、CI 工作流以及安装/后安装脚本
5. 运行静态分析扫描以查找恶意模式:
* `eval` / `new Function` / `child_process` / `os.system` / pickle / yaml.load
* 网络信标、外泄 URL、硬编码凭据
* Base64 / 十六进制数据块、作为源码分发的混淆 JS 代码
* npm 的 `preinstall` / `postinstall` 钩子、Python 的 `setup.py` `cmdclass`
* 无构建脚本的本地二进制文件
6. 审查依赖项是否存在 git/tarball URL、拼写劫持、可疑的低层级依赖项
7. 健全性检查 git 历史(单一作者、同一天内全部提交、强制推送)
8. 生成一份结构化报告,包含**结论**(安全 / 可疑 / 危险 / 无法确定)以及按 `path:line` 引用的发现结果。
该工具绝不安装、构建或执行目标仓库中的任何内容。仅进行静态分析。
## 安装说明
该技能由 Claude Code 从 `~/.claude/skills//` 加载。要安装:
```
git clone https://github.com//claude-investigate-repo.git ~/claude-investigate-repo
ln -s ~/claude-investigate-repo ~/.claude/skills/investigate-repo
```
然后重启 Claude Code。通过以下短语触发:
- "调查这个仓库:"
- "这个仓库安全吗?"
- "审计这个 GitHub 仓库的恶意代码"
- "在安装前审查此依赖项"
## 主机上需要的工具
- `git` — 用于克隆
- `gh`(可选)— 用于获取仓库元数据;如果不可用,技能会回退到网页抓取
- `rg`(推荐)或 `grep` — 用于模式扫描
- `find` — 支持 macOS(`stat -f`)和 Linux(`-printf`)
## 工具限制
该技能声明了 `allowed-tools: Read, Grep, Glob, Bash, WebFetch`。不能对目标仓库使用 `Edit` 或 `Write`。Bash 的使用范围仅限于克隆、列出、grep 和 git 日志——不包括安装或执行目标代码。
## 输出结果
聊天窗口内的一份 Markdown 报告,结构如下:
```
# Perhaps I can translate the words literally. For example, "investigate" to "调查", "repo" to "仓库". But "repo" is commonly used in tech contexts, so it might be kept as "repo" in Chinese translations.
**Verdict:** SAFE / SUSPICIOUS / DANGEROUS / INCONCLUSIVE — one line of justification.
## To be consistent with the instruction, I'll keep all that are likely technical terms in English.
## Let's decide:
### 🔴 Critical
### 🟡 Concerning
### 🟢 Notes
## - "claude-investigate-repo": Keep "claude" in English, and "investigate-repo" might be translated. But since it's a compound, perhaps translate it as "调查仓库". However, to keep it simple, I'll treat "investigate-repo" as a technical term and keep it in English. So "claude-investigate-repo" remains "claude-investigate-repo".
## But that doesn't seem like a translation. I need to output translations. Perhaps I can translate it to Chinese while keeping the English words.
```
## 许可证
MIT
标签:Claude Code技能, GitHub集成, 云安全监控, 仓库安全, 仓库审计, 代码审查, 代码质量分析, 威胁情报, 安装前检查, 开发者工具, 恶意模式检测, 网络安全研究, 软件供应链, 静态分析, 风险分析