skill-tree

command
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Skill Tree

Generate Graphviz DOT diagrams showing skill dependency trees from SpaceMolt skills data.

Overview

The skill-tree tool reads skills.json from the SpaceMolt game API and generates Graphviz DOT files, one per skill category. Each diagram shows the skill dependencies with a left-to-right flow: root skills on the left, dependent skills on the right.

Features

  • Category Separation: Generates one DOT file per skill category
  • Dependency Visualization: Shows skill prerequisites clearly
  • Cross-Category Links: Gray edges for dependencies between categories
  • Ordered Layout: Consistent left-to-right flow
  • Graphviz Compatible: Standard DOT format for rendering

Usage

Basic Usage
# Generate diagrams from skills.json
go run ./cmd/skill-tree -input skills.json -out ./diagrams

# Or use the built binary
go build -o bin/skill-tree ./cmd/skill-tree
./bin/skill-tree -input skills.json -out ./diagrams
Command-Line Flags
-input string
    Path to skills.json file (default "skills.json")

-out string
    Output directory for DOT files (default ".")
Example Session
$ go run ./cmd/skill-tree -input server_docs/skills.20260216.json -out diagrams

wrote diagrams/combat.dot
wrote diagrams/engineering.dot
wrote diagrams/mining.dot
wrote diagrams/trading.dot
wrote diagrams/piloting.dot

Generated 5 DOT files in diagrams
Convert to SVG: dot -Tsvg -o Engineering.svg engineering.dot

Rendering Diagrams

Install Graphviz
# macOS
brew install graphviz

# Debian/Ubuntu
sudo apt-get install graphviz

# Fedora/RHEL
sudo dnf install graphviz
Convert DOT to SVG
# Convert a single diagram
dot -Tsvg -o Engineering.svg diagrams/engineering.dot

# Convert all diagrams
for f in diagrams/*.dot; do
    dot -Tsvg -o "${f%.dot}.svg" "$f"
done
Convert DOT to PNG
# Convert a single diagram
dot -Tpng -o Engineering.png diagrams/engineering.dot

# Convert all diagrams
for f in diagrams/*.dot; do
    dot -Tpng -o "${f%.dot}.png" "$f"
done
Other Output Formats

Graphviz supports many formats:

  • -Tsvg - Scalable Vector Graphics (recommended)
  • -Tpng - Portable Network Graphics
  • -Tpdf - Portable Document Format
  • -Tps - PostScript

Diagram Structure

Layout
┌─────────────────────────────────────────────────────────┐
│  Category Name (Engineering, Mining, etc.)              │
├─────────────────────────────────────────────────────────┤
│                                                          │
│  [Root Skills] → [Intermediate] → [Advanced]           │
│                                                          │
│  Basic Eng.    →  Adv. Eng.   →  Expert Eng.          │
│       │               │                │                │
│       └───────────────┴────────────────┘                │
│       (dependencies shown as edges)                     │
│                                                          │
└─────────────────────────────────────────────────────────┘
Edge Colors
  • Black edges: Dependencies within the same category
  • Gray edges: Dependencies from other categories
Node Labels

Each skill node shows:

  • Skill name (truncated if too long)
  • Skill ID (in tooltip, if rendered as SVG)

Example Diagram

Input: skills.json
{
  "skills": [
    {
      "id": "basic_mining",
      "name": "Basic Mining",
      "category": "mining",
      "requires": []
    },
    {
      "id": "advanced_mining",
      "name": "Advanced Mining",
      "category": "mining",
      "requires": ["basic_mining"]
    },
    {
      "id": "expert_mining",
      "name": "Expert Mining",
      "category": "mining",
      "requires": ["advanced_mining", "basic_engineering"]
    }
  ]
}
Output: diagrams/mining.dot
digraph mining {
    rankdir=LR;
    node [shape=box];

    "Basic Mining" [id="basic_mining"];
    "Advanced Mining" [id="advanced_mining"];
    "Expert Mining" [id="expert_mining"];

    "Basic Mining" -> "Advanced Mining";
    "Advanced Mining" -> "Expert Mining";

    // Cross-category dependency
    "Basic Engineering" [id="basic_engineering", style=dashed, color=gray];
    "Basic Engineering" -> "Expert Mining" [color=gray];
}

Skill Categories

Common categories include:

  • Combat: Weapon and combat skills
  • Engineering: Crafting and repair skills
  • Mining: Resource extraction skills
  • Trading: Commerce and negotiation skills
  • Piloting: Ship handling and navigation skills

Building

# Build the binary
go build -o bin/skill-tree ./cmd/skill-tree

# Run the built binary
./bin/skill-tree -input skills.json -out diagrams

Implementation Details

Category Ordering

Categories are output in a consistent order:

  1. Alphabetically sorted
  2. Empty categories skipped
Graph Building

For each category:

  1. Find all skills in the category
  2. Create nodes for each skill
  3. Add edges for dependencies
  4. Add gray edges for cross-category dependencies
  5. Emit DOT format with left-to-right layout
Error Handling
  • Invalid JSON: Fatal error with message
  • Missing skills: Logged, skipped
  • Empty categories: Logged, skipped

Use Cases

1. Game Documentation

Generate skill trees for official game wiki:

go run ./cmd/skill-tree \
  -input server_docs/skills.json \
  -out docs/diagrams

# Convert to SVG for web
for f in docs/diagrams/*.dot; do
    dot -Tsvg -o "docs/$(basename $f .dot).svg" "$f"
done
2. Planning Tool

Visualize skill progression for agent development:

# Generate and view immediately
go run ./cmd/skill-tree -input skills.json -out /tmp/skill-tree
dot -Tsvg /tmp/skill-tree/mining.dot | display
3. Data Validation

Verify skill data integrity:

# Generate and check for errors
go run ./cmd/skill-tree -input skills.json -out /tmp/test
# Check log output for missing skills or circular dependencies

Troubleshooting

Issue: "skill not found" in dependencies

Cause: A skill references a prerequisite that doesn't exist in the JSON.

Solution: Verify all requires fields reference valid skill IDs.

Issue: Diagram too large/complex

Solution: Filter by category manually or use Graphviz clustering:

# Extract single category from JSON
jq '{skills: [.skills[] | select(.category == "mining")]}' \
  skills.json > mining-only.json

# Generate diagram
go run ./cmd/skill-tree -input mining-only.json -out diagrams
Issue: Overlapping nodes

Solution: Adjust Graphviz layout parameters:

dot -Tsvg -Goverlap=scale -Gsplines=true \
  -o output.svg input.dot

License

Part of the SpaceMolt project.

Documentation

Overview

skill-tree reads skills.json and generates Graphviz DOT files (one per category) showing the skill dependency tree. Left-to-right flow: root skills on the left, dependents on the right. Cross-category dependencies use gray edges.

Usage:

skill-tree -input skills.json -out ./diagrams
dot -Tsvg -o Engineering.svg diagrams/engineering.dot

Package main parses skills.json for the skill-tree diagram generator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL