research-to-diagram

Original🇨🇳 Chinese
Translated
1 scripts

Conduct in-depth research on topics and automatically generate knowledge relationship graph PDFs. After receiving a research topic, it automatically performs web research, information collection, knowledge organization, and finally generates a professional visualized relationship graph. Suitable for scenarios such as "research...and diagram", "in-depth analysis...and visualization", "generate knowledge graph", etc.

3installs
Added on

NPX Install

npx skill4agent add wshuyi/research-to-diagram research-to-diagram

SKILL.md Content (Chinese)

View Translation Comparison →

Research to Diagram

Conduct in-depth research on topics and automatically generate knowledge relationship graph PDFs. A one-stop tool from research to visualization.

Description

This Skill receives research topics provided by users, automatically performs in-depth web research, information collection, knowledge organization, structure design, and finally generates professional visualized relationship graph PDFs. Different from
structure-to-pdf
, this Skill focuses on active research and knowledge mining rather than passive data conversion.

Core Features

  • Automated Research: Conduct multi-round in-depth research using WebSearch
  • Intelligent Organization: Automatically extract, classify, and structure information
  • Professional Design: Select the optimal visualization scheme based on topic characteristics
  • Multiple Outputs: Support tools like Graphviz, PlantUML, Mermaid
  • High-Quality PDF: Generate vector graphics that can be infinitely scaled

Trigger Conditions

When users want to:
  • Research the knowledge structure of a complex topic (e.g., "A Dream of Red Mansions character relationships")
  • Generate character relationship diagrams, concept maps, knowledge graphs
  • Understand the organizational structure or technical architecture of a certain field
  • Visualize complex relationship networks
  • Need to research and visualize a topic from scratch
Keywords:
  • "Research...and diagram"
  • "Study the relationships of..."
  • "In-depth analysis...and visualization"
  • "Generate...knowledge graph"
  • "Draw...relationship diagram" (no existing data)

Workflow

1. Task Planning (TodoWrite)

- Conduct in-depth research on the topic and related knowledge
- Design the graph structure and hierarchy
- Create visual diagrams
- Generate PDF documents

2. In-Depth Research Phase

  • Multi-round WebSearch: Collect information from different perspectives
    • Topic overview and background
    • Core elements and characters/concepts
    • Relationships and connections
    • Hierarchies and classifications
  • Information Source Recording: Save links to all reference materials
  • Knowledge Extraction: Identify key entities and relationships

3. Structure Design Phase

Select the optimal structure based on topic type:
Character Relationship Diagrams:
  • Family pedigree: Multi-level tree structure
  • Social network: Network relationship diagram
  • Organizational structure: Hierarchical layout
Concept Maps:
  • Knowledge classification: Tree or mind map
  • Concept relationships: Directed graph
  • Flowchart: Linear or branching process
Technical Architecture:
  • System components: Modular layout
  • Dependency relationships: Hierarchical or network diagram
  • Data flow: Flowchart

4. Visualization Implementation

Priority use of Graphviz (DOT language):
dot
digraph G {
    // 全局样式
    graph [rankdir=TB bgcolor="#fdfdf5" fontname="Arial Unicode MS"]
    node [shape=box style="rounded,filled" fillcolor="#e8f4f8"]
    edge [fontname="Arial Unicode MS"]

    // 使用 subgraph cluster 分组
    subgraph cluster_group1 {
        label="分组名称"
        node1 [label="节点1"]
        node2 [label="节点2"]
    }

    // 定义关系
    node1 -> node2 [label="关系类型" color=red]
}
Alternative Tools:
  • PlantUML: UML diagrams, sequence diagrams
  • Mermaid: Simple flowcharts, sequence diagrams

5. PDF Generation

bash
dot -Tpdf diagram.dot -o output.pdf

6. Document Organization

Optionally generate explanatory documents including:
  • Research topic overview
  • Graph explanation
  • Reference sources (Sources)
  • Usage instructions

Design Principles

Visual Design

  1. Color Coding: Use different colors to distinguish categories
  2. Shape Differentiation: Use different shapes for different types of entities
  3. Clear Hierarchy: Use subgraph cluster for grouping
  4. Relationship Annotation: Use edge color, style, and labels to express relationship types
  5. Chinese Support: Use "Arial Unicode MS" or system Chinese fonts

Information Hierarchy

  1. Title Layer: Main title
  2. Grouping Layer: Main categories/families
  3. Entity Layer: Specific characters/concepts
  4. Relationship Layer: Connections and annotations
  5. Legend Layer: Explain symbol meanings

Layout Strategies

  • rankdir=TB: Top to bottom (family trees, organizational structures)
  • rankdir=LR: Left to right (flowcharts, timelines)
  • rankdir=BT: Bottom to top (dependency diagrams)
  • splines=ortho: Orthogonal edges (clear organizational diagrams)
  • splines=curved: Curved edges (aesthetic relationship networks)

Output Files

Default save location:
~/Downloads/
or user-specified directory
Generated files:
  • <topic>_relations.dot
    - Graphviz source file
  • <topic>_relations.pdf
    - Final PDF graph
  • <topic>_sources.md
    - Reference materials (optional)

Usage Examples

Example 1: Literary Work Character Relationships

User: Conduct in-depth research on the relationships between characters in "Romance of the Three Kingdoms" and create a structure diagram PDF
Skill Execution:
  1. Research main characters, camps, and relationships in the Three Kingdoms period
  2. Design: Three major camps (Wei, Shu, Wu) + character hierarchy + alliance/opposition relationships
  3. Create a multi-level relationship diagram using Graphviz
  4. Generate PDF

Example 2: Technical Concept Map

User: Research Kubernetes architecture and generate a visualized graph
Skill Execution:
  1. Research K8s core components and architecture hierarchy
  2. Design: Control plane/data plane/plugin ecosystem
  3. Generate technical architecture diagram
  4. Output PDF

Example 3: Historical Event Relationships

User: Analyze the relationships between major countries and alliances in World War II and create a chart
Skill Execution:
  1. Research participating countries, camps, and key time nodes
  2. Design: Axis powers/Allied powers/neutral countries relationship network
  3. Generate a relationship diagram with timeline
  4. Output PDF

Differences from structure-to-pdf

Featureresearch-to-diagramstructure-to-pdf
InputOnly topic/research questionExisting structured data
Research✅ Automated in-depth research❌ No research needed
Knowledge Organization✅ Automatic extraction and structuring❌ Directly use user data
Application ScenariosKnowledge exploration, research visualizationQuick data conversion
TimeLonger (requires research)Fast
When to Use This Skill:
  • ✅ No existing data, need to research from scratch
  • ✅ Want to deeply understand the knowledge structure of a topic
  • ✅ Need visualization supported by authoritative sources
When to Use structure-to-pdf:
  • ✅ Have existing structured data
  • ✅ Need quick conversion to charts
  • ✅ Data format is simple and clear

Dependent Tools

Required:
  • Graphviz:
    brew install graphviz
    (macOS)
  • WebSearch: Built into Claude Code
Optional:
  • PlantUML:
    brew install plantuml
  • Mermaid CLI:
    npm install -g @mermaid-js/mermaid-cli

Configuration Options

Users can customize via parameters:
  • --tool
    : Specify visualization tool (graphviz/plantuml/mermaid)
  • --layout
    : Specify layout direction (TB/LR/BT/RL)
  • --output
    : Specify output directory
  • --depth
    : Research depth (quick/medium/deep)
  • --sources
    : Whether to generate reference materials document

Best Practices

  1. Clear Topic Scope: The more specific the topic, the clearer the graph
  2. Reasonable Grouping: Use clusters to group related entities
  3. Control Complexity: No more than 50 nodes in a single graph
  4. Progressive Refinement: Generate an overview first, then dive into details
  5. Consistent Colors: Use the same color scheme for similar entities
  6. Cite Sources: Label reference materials at the bottom of the PDF or in a separate document

Common Graph Type Templates

Character Relationship Diagram Template

dot
- Use cluster for family/organization grouping
- Use box/ellipse for characters, special shapes for important characters
- Use solid lines for blood relationships, red lines for marriage, dashed lines for others
- Add legends to explain symbol meanings

Concept Map Template

dot
- Top-level concepts at the top
- Sub-concepts expanded layer by layer
- Use solid lines for is-a relationships, dashed lines for has-a relationships
- Use colors to distinguish different categories

Technical Architecture Diagram Template

dot
- Use rankdir=TB for layered architecture
- Use rectangles for components, rounded rectangles for services
- Use arrows for dependency relationships
- Use thick lines or special colors for critical paths

Troubleshooting

Chinese Display Garbled Characters:
dot
graph [fontname="Arial Unicode MS"]
node [fontname="Arial Unicode MS"]
edge [fontname="Arial Unicode MS"]
Overly Complex Graph:
  • Use
    concentrate=true
    to merge identical edges
  • Split into multiple subgraphs
  • Use different rankdir settings
Ideal Layout Not Achieved:
  • Adjust
    ranksep
    and
    nodesep
  • Use
    rank=same
    to force nodes to be on the same layer
  • Try different
    splines
    settings

Version History

  • v1.0 (2026-01-02): Initial version
    • Summarized based on the "A Dream of Red Mansions" character relationship graph project
    • Support automatic generation with Graphviz
    • Integrated WebSearch for in-depth research
    • TodoWrite for task management