Xpersona
C

code_flow_graph

CLAWHUB · Unverified

Generate interactive HTML node-graph diagrams for code visualization. Trigger when user asks to: visualize code architecture, diagram module dependencies, map call chains, graph class relationships, show UI event flows, display widget hierarchy layouts, or understand how code connects. Keywords: "visualize", "diagram", "graph", "map out", "call chain", "architecture", "code flow", "widget hierarchy", "UI layout", "界面布局", "调用链", "代码架构", "可视化", "模块依赖", "函数关系", "类图", "事件流". Skill: code_flow_graph Owner: biubiubiu533 Summary: Generate interactive HTML node-graph diagrams for code visualization. Trigger when user asks to: visualize code architecture, diagram module dependencies, map call chains, graph class relationships, show UI event flows, display widget hierarchy layouts, or understand how code connects. Keywords: "visualize", "diagram", "graph", "map out", "call chain", "architecture

62
Rank
84
Safety
1.5k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.5K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s1717fy5m12h249sg68tv1bf6983gpqq:code-flow-graph
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-biubiubiu533-code-flow-graph/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

111,570 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: code_flow_graph
description: >
  Generate interactive HTML node-graph diagrams for code visualization. Trigger
  when user asks to: visualize code architecture, diagram module dependencies,
  map call chains, graph class relationships, show UI event flows, display widget
  hierarchy layouts, or understand how code connects. Keywords: "visualize",
  "diagram", "graph", "map out", "call chain", "architecture", "code flow",
  "widget hierarchy", "UI layout", "界面布局", "调用链", "代码架构", "可视化",
  "模块依赖", "函数关系", "类图", "事件流".
---

# Code Flow Graph

Generate interactive node-graph HTML diagrams that visualize code structure and call relationships.

## Output

Two files in `<project>/docs/code_graph/` (or user-specified / `config.json` path):

1. **`code_flow_graph.html`** — rendering engine (copy verbatim from `example/code_flow_graph.html` in THIS skill's directory)
2. **`code_flow_graph_data.js`** — diagram data (you generate this; use `templates/diagram_skeleton.js` as starting point)

## Workflow

> This is a guide, not a script. Adapt steps based on project size, user needs, and context. Skip or merge steps when appropriate.

1. **Analyze** — Read the project structure; identify architecture type, entry points, key modules. See `references/analysis_guide.md` for inclusion/exclusion criteria.
2. **Generate Overview** — Produce a module-level dependency diagram immediately as the first deliverable. One node per module/class — NOT per function.
3. **Offer Options** — Present deep-dive choices via `ask_followup_question` with dynamic options based on discovered entry points. Always include "自定义:分析其他函数或模块" as last option.
4. **Deep-Dive** — Generate selected call-chain / UI event / data type diagrams. See `references/deep_dive_types.md`.
5. **Validate** — Run `scripts/validate_data.js` on the generated file; fix any errors before delivering.
6. **Iterate** — Append more diagrams on demand without regenerating existing content; update session state.

### Config

Check `config.json` in this skill's directory for user preferences. If missing, use defaults:
- Output: `<project>/docs/code_graph/`
- Language: Chinese for descriptions, English for code identifiers
- Scope: entire project unless user specifies otherwise

### Session Tracking

On first run for a project, create `state/code_flow_graph_session.json`:

```json
{
  "project": "<absolute-project-path>",
  "created_at": "<ISO8601>",
  "updated_at": "<ISO8601>",
  "analyzed_entries": ["func1", "func2"],
  "generated_diagrams": ["overview", "func1_callchain"],
  "pending_items": ["func3_callchain", "ui_events"],
  "last_config_hash": "<sha256-of-config.json>"
}
```

On subsequent runs, read this file to resume context: skip re-analysis of completed entries, continue from `pending_items`.

### Data Format & Templates

- **Full spec**: `references/data_format.md`
- **Composable patterns**: `templates/node_patterns.js` (6 node types + connections + groups)
- **File skeleton**: `templates/diagram_skel

README.md

# Code Flow Graph

An interactive HTML node-graph viewer skill that visualizes codebase structure, entry-point call chains, and data type flows.

![Catppuccin Mocha Theme](https://img.shields.io/badge/theme-Catppuccin%20Mocha-b4befe?style=flat-square) ![Standalone HTML](https://img.shields.io/badge/output-standalone%20HTML-a6e3a1?style=flat-square) ![No Dependencies](https://img.shields.io/badge/dependencies-none-89b4fa?style=flat-square)

## Example — [AuroraView](https://github.com/loonghao/auroraview) Analysis

Below are screenshots from analyzing the [AuroraView](https://github.com/loonghao/auroraview) Rust WebView project:

### Full Call Chain Overview

![AuroraView Full Call Chain](images/auroraview_full_call_chain.jpg)

*Complete `AuroraView::new()` call chain with all modules, IPC handlers, lifecycle management, and WebView builder — right-side panel shows the interactive call chain detail.*

### Function Signature Tooltips

![AuroraView Signature Tooltip](images/auroraview_signature_tooltip.jpg)

*Hover over any function to see its full signature and source location. Click to highlight all connected relationships.*

### Entry Point Tracing

![AuroraView Entry Point Tracing](images/auroraview_entry_tracing.jpg)

*Click `show_embedded()` to trace the DCC embedded entry flow — the viewer highlights the active path and dims unrelated nodes.*

### UI Layout Visualization

![UI Layout Visualization](images/example_ui.jpg)

*Interactive widget hierarchy viewer — nested layout boxes with color-coded widget types, resize handles on hover, stack/tab switching, and Ctrl+Z undo. Sidebar shows "🖼️ UI 布局" section for layout views.*

## Features

- **Interactive Node Graph** — Draggable nodes with bezier-curve connections, pan & zoom
- **UI Layout Visualization** — Interactive widget hierarchy viewer for UI projects (Qt, React, etc.); nested layout boxes with resize handles, Ctrl+Z undo, and hover tooltips showing widget class/properties
- **Call Chain Detail Panel** — Click entry-point functions to explore the complete call tree in a right-side panel; each item shows a description explaining what the function does
- **Global Search (Ctrl+K)** — Fuzzy search across ALL diagram pages with cross-diagram navigation
- **Multi-Diagram Support** — Organize views by entry-point call chains, UI layers, data types, and overview
- **Smart Highlighting** — Click any function to highlight its node + all connected relationships; dim everything else
- **Collapsible Children** — Sub-functions collapse/expand with connection redirect to parent
- **Signature Tooltips** — Hover functions to see full signatures, descriptions, detailed explanations, and I/O
- **Click to Copy** — Click any function attr to copy the function name to clipboard with toast notification
- **Undo Layout Moves (Ctrl+Z)** — Undo the last node/group drag operation (up to 50 steps)
- **Position Persistence** — Node positions saved to localStorage per diagram; "Reset Layout" restores defaults
- **Ca

_meta.json

{
  "ownerId": "kn7c3h9scssdeawf43t86y8m0h83hgxr",
  "slug": "code-flow-graph",
  "version": "1.0.1",
  "publishedAt": 1786504437936
}

references/analysis_guide.md

# Code Analysis Strategy Guide

How to decide what to include in a diagram and how to handle different project scales.

## What to Include

### Include functions that:

- Are **entry points** (CLI commands, API handlers, pipeline steps, hooks, UI init)
- Have **high fan-out** (call >= 2 project-internal functions)
- Have **high fan-in** (called from >= 3 sites)
- Contain **dispatch/routing logic** (switch/match, plugin registries, middleware chains)
- Perform **state mutation** or orchestrate multi-step workflows
- Implement **core domain logic** (the "why" of the project, not the "how")

### Exclude functions that:

- Are trivial getters/setters with no side effects
- Are thin wrappers around a single external call
- Are generic utilities (`format_*`, `ensure_*`, `clamp`, `retry`, `debounce`)
- Only perform logging, metrics, or telemetry
- Are auto-generated boilerplate (serializers, validators from schema)

**When in doubt, include** — more detail is better than missing logic. Excluded functions may still appear as collapsed `children` inside their caller's attr.

## Scoping by Project Size

### Small projects (< 20 files, < 2000 LOC)

- Include almost everything; one Overview + 1-2 call chains suffices
- Skip filtering thresholds; show the full picture

### Medium projects (20-100 files, 2k-20k LOC)

- Apply standard thresholds: fan-out >= 2, fan-in >= 3
- Generate Overview first, then offer 3-5 call chain options
- Group by module/package in Overview

### Large projects (100+ files, 20k+ LOC)

- Raise thresholds: fan-out >= 3, fan-in >= 4
- Collapse deeper calls into `children` rather than separate nodes
- Summarize repetitive patterns ("N similar handlers")
- Cross-module calls reference the target diagram name in `sig` hint
- Consider splitting into multiple Overview diagrams (by layer/domain)

## Architecture Detection

Identify the project's architecture type early to guide diagram structure:

| Architecture | Primary Diagram Style | Key Signals |
|---|---|---|
| **CLI tool** | Entry-point call chains per command | `argparse`, `click`, `clap`, `cobra` |
| **Web API** | Route handler → service → repo layers | Express, FastAPI, Gin, Spring routes |
| **UI application** | Widget hierarchy + event flow | Qt, React, Vue, SwiftUI imports |
| **Pipeline/ETL** | Stage-by-stage data flow | DAG definitions, step/stage functions |
| **Library/SDK** | Public API surface + internal impl | `__init__.py` exports, `mod.rs pub` |
| **Microservices** | Per-service entry + inter-service calls | Docker/K8s configs, gRPC/REST clients |

## Analysis Order

1. **Identify entry points** — `main()`, route handlers, CLI commands, signal handlers
2. **Trace hot paths** — Follow the most-called functions from entry points
3. **Map module boundaries** — Package/folder structure = natural grouping
4. **Find hub functions** — High fan-in/fan-out nodes are diagram anchors
5. **Detect patterns** — Factory, Observer, Strategy, Middleware → shape connections

## Tips for A

references/data_format.md

# Code Flow Graph Data Format Reference

## Quick Reference

| Element | Key Fields |
|---------|-----------|
| Node | `id`, `label`, `type`, `x`, `y`, `w`, `sections[]` |
| Attr | `id` (format: `NodeId.method`), `name`, `sig`, `desc`, `detail`, `children`, `callChain`, `fieldDetail` |
| Connection | `[sourceAttrId, targetAttrId, '#color', dashed, 'label?']` |
| Group | `id`, `label`, `nodes[]`, `color`, `bg` |

**Node types**: `entry` (yellow), `class` (blue), `module` (green), `function` (mauve), `data` (peach), `widget` (sapphire)

**Connection colors**: `#a6e3a1` call, `#f38ba8` inherit, `#89b4fa` data, `#f5c2e7` signal, `#fab387` external, `#6c7086` weak

**Grid**: columns at x = 30, 350, 670, 990...; 40px vertical gap between nodes

---

## Overview

The data file `code_flow_graph_data.js` defines a global `var DIAGRAMS = {};` object. Each key in `DIAGRAMS` is a diagram identifier (sidebar entry). A special `_projectTitle` key can set the sidebar header.

## Top-level Structure

```js
var DIAGRAMS = {};
DIAGRAMS._projectTitle = 'My Project'; // optional sidebar header

DIAGRAMS.module_name = {
  title: 'Module Name — Class Diagram',        // header title
  sub: 'path/to/module.py — description',       // subtitle
  navLabel: 'Module Name',                       // sidebar label
  navSub: 'path/to/module.py',                   // sidebar sublabel
  NODES: [ ... ],
  CONNECTIONS: [ ... ],
  GROUPS: [ ... ],
};
```

## NODES Array

Each node represents a **class**, **module**, **function group**, or **UI component**. Each node object:

```js
{
  id: 'className',                    // unique string, used in CONNECTIONS
  label: 'ClassName',                 // display name (header text)
  type: 'class | module | function | entry | data | QDialog | widget | slots',
  // type determines the badge label on the header (all nodes share 6px rounded shape):
  //   class      → CLASS badge
  //   module     → MODULE badge
  //   function/functions → FUNC badge
  //   entry      → ENTRY badge
  //   data       → DATA badge
  //   QDialog/widget/slots → UI CLASS / SLOTS badge
  // External dependencies use the appropriate type (module/class) with `external: true`.
  external: false,                    // optional — true for third-party dependencies (dashed border + EXT tag)
  // Visual differentiation is via color auto-assigned by type.
  x: 30, y: 60,                       // default position (pixels)
  w: 280,                             // node width (pixels)
  sections: [                         // method/attribute groups
    {
      title: 'Public Methods',        // section header (optional)
      code: 'some code snippet',      // code block (optional, mutually exclusive with attrs)
      attrs: [
        {
          id: 'cls.method_name',      // unique, format: nodeId.attrName — used in CONNECTIONS
          name: 'method_name()',       // display text
          val: '→ returns X',          // right-side value text (optional)
          sig: '<sp

Sponsored

Ads related to code_flow_graph and adjacent AI workflows.