nexus-query

haaaiawd/nexus-skills · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/haaaiawd/nexus-skills --skill nexus-query
0 commentsdiscussion
summary

生成 AST 时,支持与 nexus-mapper 一致的扫描过滤:

skill.md

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

# 若不希望读取 .gitignore,可显式关闭
python $SKILL_DIR/scripts/extract_ast.py $repo_path \
  --no-gitignore \
  > $AST_JSON

# 若需要 git 风险数据(可选,仅在存在 .git 时)
python $SKILL_DIR/scripts/git_detective.py $repo_path --days 90 > $GIT_JSON

$SKILL_DIR 为本 Skill 的安装路径(.agent/skills/nexus-query 或独立 repo 路径)。 extract_ast.py 默认排除 .git/.nexus-map/node_modules/__pycache__/.venv/dist/build/ 等噪音目录及文件;默认还会读取 <repo_path>/.gitignore,忽略其中声明的文件和目录。--no-gitignore 仅关闭 .gitignore 规则,不会关闭内置排除项,也不会关闭 --exclude-dirs

依赖安装(首次使用)

pip install -r $SKILL_DIR/scripts/requirements.txt

五个查询模式

# 文件骨架:类、方法、行号、import 清单
python $SKILL_DIR/scripts/query_graph.py $AST_JSON --file <path>
python $SKILL_DIR/scripts/query_graph.py $AST_JSON --file <path> --git-stats $GIT_JSON

# 反向依赖:谁 import 了这个模块(区分源码文件和测试文件)
python $SKILL_DIR/scripts/query_graph.py $AST_JSON --who-imports <module_or_path>

# 影响半径:上游依赖 + 下游被依赖(X upstream, Y downstream)
python $SKILL_DIR/scripts/query_graph.py $AST_JSON --impact <path>
python $SKILL_DIR/scripts/query_graph.py $AST_JSON --impact <path> --git-stats $GIT_JSON

# 全仓库核心节点:按扇入(被引用最多)和扇出(引用最多)排序
python $SKILL_DIR/scripts/query_graph.py $AST_JSON --hub-analysis [--top N]

# 按顶层目录聚合结构摘要
python $SKILL_DIR/scripts/query_graph.py $AST_JSON --summary

各模式核心价值

模式 一句话价值 典型触发时机
--file 不读源码也能掌握文件骨架,精确到行号 接手大型模块前;Bug 调查缩小读取区间
--who-imports 改接口前的"炸弹清单"——列出所有调用方 删函数/改签名/重命名类之前,必须跑
--impact 0 upstream, 24 downstream 一眼看清改动范围 Sprint 估时;评估修改是局部手术还是全局手术
--hub-analysis 找出真正的高耦合核心,不靠目录名猜 架构评审;技术债优先级排序
--summary 5 秒建立全局分层认知,比 README 更客观 初次接触项目;识别循环依赖风险区域

场景速查

你此刻的问题 用哪个
这个文件有哪些类/方法,各在哪几行 --file
改这个接口/删函数,哪些文件跟着改 --who-imports
这个改动最终影响多少模块 --impact
这个改动风险有多高(加 git 热度) --impact --git-stats
项目里谁是真正的高耦合中心 --hub-analysis
整个项目的模块分布和层级 --summary
连续重构,改完一处要看影响链 --who-imports--impact
估算技术债改造的工作量 --hub-analysis--impact

执行守则

守则1: 先骨架再查询 使用 --impact--who-imports 分析某个模块前,建议先用 --file 读取其骨架,理解职责和现有 import,避免对查询结果产生误判。

守则2: git-stats 是加分项,不是硬阻塞 没有 .git 或 git 历史不足时,跳过 git_detective.py,只用 AST 数据查询。

守则3: 路径匹配灵活但要验证 支持路径片段匹配(如 vision.py 可匹配 src/core/vision.py)。结果返回 [NOT FOUND] 时,先用 --summary 确认仓库中存在的模块路径格式,再重新查询。

守则4: 结果直接呈现,让数字说话 --impact 返回的 X upstream, Y downstream 是客观数字,直接告知用户,不用「可能影响较大」这类模糊词替代。

how to use nexus-query

How to use nexus-query on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add nexus-query
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/haaaiawd/nexus-skills --skill nexus-query

The skills CLI fetches nexus-query from GitHub repository haaaiawd/nexus-skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/nexus-query

Reload or restart Cursor to activate nexus-query. Access the skill through slash commands (e.g., /nexus-query) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.648 reviews
  • Pratham Ware· Dec 28, 2024

    nexus-query fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Sophia Kapoor· Dec 24, 2024

    Registry listing for nexus-query matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Benjamin Zhang· Dec 16, 2024

    Useful defaults in nexus-query — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Ren Abebe· Dec 12, 2024

    nexus-query fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Mei Khan· Dec 8, 2024

    nexus-query is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Mei Gonzalez· Nov 27, 2024

    nexus-query reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Mateo Gonzalez· Nov 15, 2024

    Keeps context tight: nexus-query is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Benjamin Singh· Nov 7, 2024

    nexus-query has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Tariq Smith· Oct 26, 2024

    Solid pick for teams standardizing on skills: nexus-query is focused, and the summary matches what you get after install.

  • Diya Jackson· Oct 18, 2024

    Registry listing for nexus-query matched our evaluation — installs cleanly and behaves as described in the markdown.

showing 1-10 of 48

1 / 5