
Nexus Query
Before you refactor an interface or estimate a sprint in unfamiliar code, this answers the questions static analysis tools don't: who actually depends on this module, what's the real blast radius if I change it, which files are the high-coupling chokepoints. It parses your repo into ast_nodes.json, then lets you query with five modes: file skeleton, reverse dependencies (who imports X), impact radius (upstream + downstream counts), hub analysis (most-depended-on modules), and directory-level summary. The who-imports and impact queries are the money shots when you're about to rename something or touch a core abstraction. Requires Python 3.10+ and produces hard numbers, not guesses. Works standalone or shares the .nexus-map structure with nexus-mapper if you need the full knowledge base later.
- skills.sh installs
- 298
- GitHub stars
- 167
- last updated
- Aug 21, 2026
Install
$ npx -y skills add haaaiawd/nexus-skills --skill nexus-query --agent claude-codeInstalls into .claude/skills of the current project.
Files
nexus-query — 代码结构精准查询
何时调用
| 场景 | 调用 |
|---|---|
| 「这个文件有哪些类/方法,依赖什么」 | 是 |
| 「改这个接口/模块,哪些文件受影响」 | 是 |
| 「这个改动的影响半径是多大」 | 是 |
| 「项目里谁是真正的核心依赖节点」 | 是 |
| 「整个项目大概分哪几块」 | 是 |
用户希望生成完整的 .nexus-map/ 知识库 | 否 → 改用 nexus-mapper |
| 运行环境无 shell 执行能力 | 否 |
| 宿主机无本地 Python 3.10+ | 否 |
前提:确保 ast_nodes.json 可用
进入查询前 → 检查是否有 ast_nodes.json
├── 有(.nexus-map/raw/ast_nodes.json 或用户指定路径)→ 直接查询
└── 没有 → 运行 extract_ast.py 生成 → 再查询
生成 AST 时,支持与 nexus-mapper 一致的扫描过滤:
--exclude-dirs django_static,.go_root按目录名或仓库相对路径忽略杂物目录--use-gitignore启用<repo_path>/.gitignore规则(默认开启),忽略其中声明的文件和目录--no-gitignore不应用.gitignore规则;此时仍会保留内置排除项和--exclude-dirs
# 默认路径(和 nexus-mapper 的 .nexus-map/ 兼容,可互通)
AST_JSON="$repo_path/.nexus-map/raw/ast_nodes.json"
GIT_JSON="$repo_path/.nexus-map/raw/git_stats.json" # 可选
# 若 ast_nodes.json 不存在,先创建目录再生成(约数秒)
mkdir -p "$repo_path/.nexus-map/raw"
python $SKILL_DIR/scripts/extract_ast.py $repo_path > $AST_JSON
# 若仓库包含大批静态资源、生成物或杂物目录,可显式追加排除项
python $SKILL_DIR/scripts/extract_ast.py $repo_path \
--exclude-dirs django_static,.go_root,third_party/assets \
> $AST_JSON
Sponsors
Details
- Repository
- github.com/haaaiawd/nexus-skills
- Categories
- Code Review & Quality, Productivity & Planning, Python, CLI & Terminal
- First seen
- Jun 3, 2026