跳到正文
cccskills
免费在 GitHub 公开中文介绍

understand-domain

从代码中提取业务领域、业务流程和具体步骤,生成可交互的横向流程图。既可利用现有知识图谱,也可通过轻量扫描收集分析材料。

原文查看原文说明

Extract business domain knowledge from a codebase and generate an interactive domain flow graph. Works standalone (lightweight scan) or derives from an existing /understand knowledge graph.

AI 评分70分/ 100查看安装方法

适用场景

  • 了解代码中实现的业务流程
  • 展示业务领域与步骤的联系
  • 从业务角度梳理现有知识图谱
  • 重新扫描并更新业务流程图

中文介绍

功能

understand-domain 从代码中提取业务领域、业务流程和各个步骤,在仪表板中生成可交互的横向流程图。如果已有知识图谱,它会根据其中的组成部分和关系归纳业务知识;如果没有,则轻量扫描文件结构、处理入口和部分代码,收集分析所需的材料。

适用场景

适合了解项目实际实现的业务流程,或从业务角度整理代码结构。可以在图中查看业务领域与具体步骤之间的联系,也可以换一个角度重新理解现有知识图谱。

使用示例

  • “把这份代码中的业务领域和处理流程画成图。”
  • “从现有知识图谱中提取业务流程。”
  • “运行 /understand-domain --full,重新扫描。”

注意事项

需要相关插件和分析代理,轻量扫描使用 Python。即使已有图谱,--full 也会重新扫描。结果保存到 domain-graph.json,并启动 /understand-dashboard。在 Git worktree 中,默认将输出位置切换到主仓库。如果现有图谱尚未反映某些变更,会发出警告。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

客观评估

AI 仅根据 SKILL.md 的内容,从 4 个方面进行了评估。星标数和热度不计入评估。

指令清晰度能否看出何时使用、做什么
A良好明确说明现有图谱与轻量扫描的选择条件,以及生成业务流程图的用途。
步骤具体性步骤、输入输出和示例是否具体
B部分不足Git 检查和 Python 扫描步骤具体,但所提供片段没有最终结果的生成步骤。
安全性发送数据、删除文件、执行命令等是否有说明
B部分不足说明了执行 Python 和将输出切换到主仓库,但未规定写入前的确认。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足记载了插件查找方式和 Python 执行命令,但没有安装步骤。

总分按每项 A=25 分、B=15 分、C=5 分相加。 由 AI(OpenAI Codex)于 2026年10月21日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(2)

  • SKILL.md9.6 KB
  • extract-domain-context.py15.9 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

/understand-domain

Extracts business domain knowledge — domains, business flows, and process steps — from a codebase and produces an interactive horizontal flow graph in the dashboard.

How It Works

  • If a knowledge graph already exists (.ua/knowledge-graph.json, or the legacy .understand-anything/knowledge-graph.json when that directory is present), derives domain knowledge from it (cheap, no file scanning)
  • If no knowledge graph exists, performs a lightweight scan: file tree + entry point detection + sampled files
  • Use --full flag to force a fresh scan even if a knowledge graph exists

Instructions

Phase 0: Resolve PROJECT_ROOT

Set PROJECT_ROOT to the current working directory.

Worktree redirect. If PROJECT_ROOT is inside a git worktree (not the main checkout), redirect output to the main repository root. Worktrees managed by Claude Code are ephemeral — the data directory (.ua/, or legacy .understand-anything/) written there is destroyed when the session ends, taking the domain graph with it (issue #133). Detect a worktree by comparing git rev-parse --git-dir against git rev-parse --git-common-dir; in a normal checkout or submodule they resolve to the same path, in a worktree they differ and the parent of --git-common-dir is the main repo root.

COMMON_DIR=$(git -C "$PROJECT_ROOT" rev-parse --git-common-dir 2>/dev/null)
GIT_DIR=$(git -C "$PROJECT_ROOT" rev-parse --git-dir 2>/dev/null)
if [ -n "$COMMON_DIR" ] && [ -n "$GIT_DIR" ]; then
  COMMON_ABS=$(cd "$PROJECT_ROOT" && cd "$COMMON_DIR" 2>/dev/null && pwd -P)
  GIT_ABS=$(cd "$PROJECT_ROOT" && cd "$GIT_DIR" 2>/dev/null && pwd -P)
  if [ -n "$COMMON_ABS" ] && [ "$COMMON_ABS" != "$GIT_ABS" ]; then
    MAIN_ROOT=$(dirname "$COMMON_ABS")
    if [ -d "$MAIN_ROOT" ] && [ "${UNDERSTAND_NO_WORKTREE_REDIRECT:-0}" != "1" ]; then
      echo "[understand-domain] Detected git worktree at $PROJECT_ROOT"
      echo "[understand-domain] Redirecting output to main repo root: $MAIN_ROOT"
      echo "[understand-domain] (Set UNDERSTAND_NO_WORKTREE_REDIRECT=1 to keep PROJECT_ROOT as the worktree.)"
      PROJECT_ROOT="$MAIN_ROOT"
    fi
  fi
fi

Use $PROJECT_ROOT (not the bare CWD) for every reference to "the current project" / <project-root> in subsequent phases.

Resolve the data directory $UA_DIR. All Understand-Anything artifacts live in the project's data directory. Resolve it once, now that $PROJECT_ROOT is known, and reuse $UA_DIR for every read and write in later phases:

UA_DIR="$PROJECT_ROOT/$([ -d "$PROJECT_ROOT/.understand-anything" ] && echo .understand-anything || echo .ua)"

This keeps the legacy .understand-anything/ directory when it already exists (existing projects keep working with no migration) and uses the new .ua/ otherwise. Because each phase may run in a fresh shell, carry $UA_DIR forward like $PROJECT_ROOT, re-resolving it with the line above if a later command block needs it.

Important: do not assume the plugin root is simply two directories above the skill path string. In many installations ~/.agents/skills/understand-domain is a symlink into the real plugin checkout. Prefer runtime-provided plugin roots first (for Claude), then fall back to universal symlinks, skill symlink resolution, and common clone-based install paths.

Resolve the plugin root like this:

SKILL_REAL=$(realpath ~/.agents/skills/understand-domain 2>/dev/null || readlink -f ~/.agents/skills/understand-domain 2>/dev/null || echo "")
SELF_RELATIVE=$([ -n "$SKILL_REAL" ] && cd "$SKILL_REAL/../.." 2>/dev/null && pwd || echo "")
COPILOT_SKILL_REAL=$(realpath ~/.copilot/skills/understand-domain 2>/dev/null || readlink -f ~/.copilot/skills/understand-domain 2>/dev/null || echo "")
COPILOT_SELF_RELATIVE=$([ -n "$COPILOT_SKILL_REAL" ] && cd "$COPILOT_SKILL_REAL/../.." 2>/dev/null && pwd || echo "")

PLUGIN_ROOT=""
for candidate in \
  "${CLAUDE_PLUGIN_ROOT}" \
  "$HOME/.understand-anything-plugin" \
  "$SELF_RELATIVE" \
  "$COPILOT_SELF_RELATIVE" \
  "$HOME/.codex/understand-anything/understand-anything-plugin" \
  "$HOME/.opencode/understand-anything/understand-anything-plugin" \
  "$HOME/.pi/understand-anything/understand-anything-plugin" \
  "$HOME/understand-anything/understand-anything-plugin"; do
  if [ -n "$candidate" ] && [ -f "$candidate/package.json" ] && [ -f "$candidate/pnpm-workspace.yaml" ]; then
    PLUGIN_ROOT="$candidate"
    break
  fi
done

if [ -z "$PLUGIN_ROOT" ]; then
  echo "Error: Cannot find the understand-anything plugin root."
  echo "Checked:"
  echo "  - ${CLAUDE_PLUGIN_ROOT:-<unset CLAUDE_PLUGIN_ROOT>}"
  echo "  - $HOME/.understand-anything-plugin"
  echo "  - ${SELF_RELATIVE:-<unresolved path derived from ~/.agents/skills/understand-domain>}"
  echo "  - ${COPILOT_SELF_RELATIVE:-<unresolved path derived from ~/.copilot/skills/understand-domain>}"
  echo "  - $HOME/.codex/understand-anything/understand-anything-plugin"
  echo "  - $HOME/.opencode/understand-anything/understand-anything-plugin"
  echo "  - $HOME/.pi/understand-anything/understand-anything-plugin"
  echo "  - $HOME/understand-anything/understand-anything-plugin"
  echo "Make sure the plugin is installed correctly."
  exit 1
fi

Use $PLUGIN_ROOT for every reference to agent definitions in subsequent phases.

Phase 1: Detect Existing Graph

  1. Check if $UA_DIR/knowledge-graph.json exists
  2. If it exists AND --full was NOT passed, check freshness before deriving from it:
    • Read project.gitCommitHash from the graph metadata as GRAPH_COMMIT_RAW. Change to $PROJECT_ROOT, resolve it as a commit before using it in any Git diff, compare the resolved commit with git rev-parse HEAD, and inspect project-scoped committed and working-tree changes:
      GRAPH_COMMIT=$(git rev-parse --verify --end-of-options "${GRAPH_COMMIT_RAW}^{commit}" 2>/dev/null)
      git rev-parse HEAD
      git diff --name-only "$GRAPH_COMMIT" HEAD -- .
      git diff --cached --name-only -- .
      git diff --name-only -- .
      git ls-files --others --exclude-standard -- .
      
    • The -- . pathspec is required: commits that only touch a sibling monorepo project must not make this graph stale. A hash mismatch alone is not stale when the project diff is empty.
    • Ignore the selected data directory (.ua/ or legacy .understand-anything/) in every command's output because it contains generated graph artifacts, not project source drift.
    • If the committed diff or any working-tree command reports project files, warn that domain extraction may omit those changes. Suggest: Run /understand to refresh the knowledge graph.
    • Run the commit diff only when GRAPH_COMMIT_RAW resolves successfully. If the graph commit or Git metadata is missing, invalid, or unavailable, give a brief best-effort warning and continue instead of blocking.
  3. After that preflight, proceed to Phase 3 (derive from graph).
  4. Otherwise, proceed to Phase 2 (lightweight scan). When --full is used, skip this preflight because the command performs a fresh scan instead of consuming the existing graph.

Phase 2: Lightweight Scan (Path 1)

The preprocessing script does NOT produce a domain graph — it produces raw material (file tree, entry points, exports/imports) so the domain-analyzer agent can focus on the actual domain analysis instead of spending dozens of tool calls exploring the codebase. Think of it as a cheat sheet: cheap Python preprocessing → expensive LLM gets a clean, small input → better results for less cost.

  1. Run the preprocessing script bundled with this skill, passing $PROJECT_ROOT from Phase 0:
    python ./extract-domain-context.py "$PROJECT_ROOT"
    
    This outputs $UA_DIR/intermediate/domain-context.json containing:
    • File tree (respecting .gitignore)
    • Detected entry points (HTTP routes, CLI commands, event handlers, cron jobs, exported handlers)
    • File signatures (exports, imports per file)
    • Code snippets for each entry point (signature + first few lines)
    • Project metadata (package.json, README, etc.)
  2. Read the generated domain-context.json as context for Phase 4
  3. Proceed to Phase 4

Phase 3: Derive from Existing Graph (Path 2)

  1. Read $UA_DIR/knowledge-graph.json
  2. Format the graph data as structured context:
    • All nodes with their types, names, summaries, and tags
    • All edges with their types (especially calls, imports, contains)
    • All layers with their descriptions
    • Tour steps if available
  3. This is the context for the domain analyzer — no file reading needed
  4. Proceed to Phase 4

Phase 4: Domain Analysis

  1. Read the domain-analyzer agent prompt from $PLUGIN_ROOT/agents/domain-analyzer.md
  2. Dispatch a subagent with the domain-analyzer prompt + the context from Phase 2 or 3
  3. The agent writes its output to $UA_DIR/intermediate/domain-analysis.json

Phase 5: Validate and Save

  1. Read the domain analysis output
  2. Validate using the standard graph validation pipeline (the schema now supports domain/flow/step types)
  3. If validation fails, log warnings but save what's valid (error tolerance)
  4. Save to $UA_DIR/domain-graph.json
  5. Clean up $UA_DIR/intermediate/domain-analysis.json and $UA_DIR/intermediate/domain-context.json

Phase 6: Launch Dashboard

  1. Auto-trigger /understand-dashboard to visualize the domain graph
  2. The dashboard will detect domain-graph.json and show the domain view by default

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

understand

免费有简介AI 评分 80分

分析项目代码、配置、文档和基础设施文件,生成可交互探索的结构与依赖关系图。支持日语说明、文件排除,以及根据变更更新已有分析结果。

  • 了解首次接触的项目结构
  • 检查组成部分之间的依赖
  • 用日语生成设计说明
Egonex-AI/Understand-Anything8.8万2026年10月23日 更新

understand-chat

免费有简介AI 评分 100分

利用记录代码组成及其关系的知识图谱,查找与问题有关的文件和函数,追踪调用与依赖关系,并结合架构分层具体解释项目的工作方式。

  • 了解功能的工作方式
  • 查找调用方和依赖项
  • 探索与某个概念相关的代码
Egonex-AI/Understand-Anything8.8万2026年10月23日 更新

understand-dashboard

免费有简介AI 评分 90分

启动交互式网页仪表板,以图形查看已分析代码库的结构和关系。可显示当前工作目录或指定项目的数据,并提供包含访问令牌的本地网址。

  • 以图形查看已分析的代码库
  • 打开当前项目的结构关系图
  • 查看其他项目的分析结果
Egonex-AI/Understand-Anything8.8万2026年10月23日 更新

understand-diff

免费有简介AI 评分 90分

将 Git 差异或拉取请求与知识图谱对照,整理修改位置、周边影响、跨架构层关系及审查风险,并保存用于仪表板展示的数据。

  • 准备审查拉取请求
  • 检查未提交变更的影响
  • 检查跨架构层的变更
Egonex-AI/Understand-Anything8.8万2026年10月23日 更新

understand-explain

免费有简介AI 评分 100分

结合现有知识图谱与实际源代码,详细解释指定文件、函数或模块的设计作用、调用关系、依赖及输入输出流程,帮助不熟悉该编程语言的读者理解代码。

  • 了解指定文件的作用
  • 查找函数的调用方和依赖
  • 追踪从输入到输出的数据流程
Egonex-AI/Understand-Anything8.8万2026年10月23日 更新

understand-figma

免费有简介AI 评分 80分

分析 Figma 文件,将页面、界面、组件、实例及颜色等共享设计值之间的关系整理成图,并通过交互式仪表板查看整体设计结构。

  • 了解 Figma 文件的整体结构
  • 查看组件及其实例所在位置的关系
  • 检查共享设计值的使用情况
Egonex-AI/Understand-Anything8.8万2026年10月23日 更新

查看 Egonex-AI 的全部技能

报告此技能的问题