manish5616/claude-code-devkit
GitHub: manish5616/claude-code-devkit
一个 Claude Code 插件,通过自带的 Python MCP 服务器提供确定性的代码分析工具,帮助 LLM 自动生成代码库架构概述和入职指南。
Stars: 1 | Forks: 0
# claude-code-devkit


其核心是 **Repo Archaeologist**,这是一个独立的 Python **MCP server**,提供确定性的代码分析工具。Claude(或任何 MCP 客户端)可以调用它们来回答关于代码库的事实性问题,然后将这些事实转化为架构概述和新人指南。
## 演示

## 功能简介
安装此插件会为 Claude Code 提供五项新功能:
| 功能 | 类型 | 作用 |
|---|---|---|
| `/map-repo` | Slash command | 生成当前代码库的架构概述 |
| `onboarding-guide` | Sub-agent | 一个只读 worker,用于编写新开发者入职指南 |
| `module-summary` | Skill | 自动总结 Python 模块(内置 `ast` 辅助脚本) |
| **`repo-archaeologist`** | **MCP server** | **5 个代码分析工具(见下文)——完全使用 Python 从头构建** |
| secret-guard / auto-format | Hooks | 阻止对 secrets 的修改;在修改后自动格式化 Python 代码 |
### Repo Archaeologist MCP 工具
| 工具 | 返回内容 |
|---|---|
| `find_symbol(name, path)` | 根据名称查找函数/class/method 的所有定义 |
| `list_symbols(path)` | 指定路径下的所有顶层函数/class(以及 method) |
| `summarize_module(path)` | 模块结构:docstring、imports、classes、functions |
| `git_blame_story(repo, file)` | 文件历史:commit 数量、作者、首次/最近修改时间 |
| `explain_commit_range(repo, base, head)` | 两个 ref 之间变更的 commits 和文件 |
## 设计原则
**服务器返回确定性的事实;LLM 负责撰写描述。**
服务器内部没有 LLM 或网络调用——每个工具都是基于 `ast` 和 `git` 的纯函数。这使得它运行速度快、完全经过单元测试,并且可供任何 MCP 客户端(Claude Desktop、Cursor、MCP Inspector 或你自己的脚本)使用。
## 安装说明
**前置条件:** Python 3.11+,并且 Claude Code 启动服务器所使用的 Python 环境中需安装 `mcp` 包:
```
python -m pip install mcp
```
然后添加 marketplace 并安装插件:
```
claude plugin marketplace add manish5616/claude-code-devkit
claude plugin install devkit@devkit-marketplace
```
重启 Claude Code。使用 `claude mcp list` 进行验证(查找
`repo-archaeologist ✔ connected`)并运行 `/map-repo`。
## 使用示例
```
/map-repo # architecture overview of the current repo
"Summarize the module app.py" # triggers the module-summary skill
"Use repo-archaeologist to find the symbol Calculator"
"Onboard me to this repository" # delegates to the onboarding-guide sub-agent
```
## 完整示例
请参阅 **[`docs/example-click.md`](./docs/example-click.md)** —— 指向
[`pallets/click`](https://github.com/pallets/click) 的 Repo Archaeologist 工具:真实的输出
(591 个 symbol,`core.py` class 模型,git 历史)以及基于这些事实生成的架构概述。
## 开发
```
git clone https://github.com/manish5616/claude-code-devkit
cd claude-code-devkit
python -m venv .venv
./.venv/Scripts/python.exe -m pip install -e ".[dev]" # Windows
# source .venv/bin/activate && pip install -e ".[dev]" # macOS/Linux
pytest # runs the 9 analyzer tests
ruff check . # lint
```
## 局限性(实话实说)
- **仅支持 Python。** 分析使用 Python 的 `ast`;不解析其他语言。
- **`find_symbol` 基于名称** —— 它不会根据 scope 区分同名的 symbol。
- git 工具要求 `PATH` 中存在 `git`。
## 路线图
- `trace_callers` 和 `detect_dead_code`(启发式,尽力而为)
- 通过 tree-sitter 实现多语言支持
- 基于 GitHub API 的 `explain_pr`
请参阅 [`ROADMAP.md`](./ROADMAP.md) 了解本项目所基于的完整学习路线图。
## 许可证
[MIT](./LICENSE) © Manish Kumar
标签:Claude Code, MCP, Python, SOC Prime, 云安全监控, 代码分析, 代码考古, 凭证管理, 安全规则引擎, 开发工具, 无后门, 逆向工具, 静态分析