generate-tree-structure

generate-tree-structure is a skill for Claude Code from jimmc414/claude-code-plugin-marketplace. It costs 30 tokens per session (707 once invoked), scanned A, original, MIT.

A method for building connected tree structures, including spanning trees and random mazes, by exploring neighboring nodes from a changing frontier.

In plain words
What is it for?
Use it to generate random mazes, build a tree that connects every node, or create procedural branching layouts with winding or bushy shapes.
Why use it?
It provides one reusable way to create connected structures while changing the traversal order to get different shapes. It also makes clear when another method is needed, such as for shortest paths or structures with cycles.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the norvig-patterns plugin — 54 skills shipped together

Good fit Use it to generate random mazes, build a tree that connects every node, or create procedural branching layouts with winding or bushy shapes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jimmc414/claude-code-plugin-marketplace/generate-tree-structure
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add jimmc414/claude-code-plugin-marketplace --skill generate-tree-structure
Clone the repo
git clone --depth 1 https://github.com/jimmc414/claude-code-plugin-marketplace

Made for: Claude Code.

Or install norvig-patterns, the plugin that ships this one along with the rest of its 54 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for generate-tree-structure

README.md
[![agentmods](https://agentmods.dev/badge/skills/jimmc414/claude-code-plugin-marketplace/generate-tree-structure.svg)](https://agentmods.dev/skills/jimmc414/claude-code-plugin-marketplace/generate-tree-structure)
Your own site
<a href="https://agentmods.dev/skills/jimmc414/claude-code-plugin-marketplace/generate-tree-structure"><img src="https://agentmods.dev/badge/skills/jimmc414/claude-code-plugin-marketplace/generate-tree-structure.svg" alt="Measured on agentmods" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 707 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00030 $0.00707
Opus 5 $0.00015 $0.00353
Sonnet 5 $0.00006 $0.00141
Haiku 4.5 $0.00003 $0.00071

Measured 8d ago against content hash 411bfa2d5a56, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

generate-tree-structure scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/norvig-patterns/skills/generate-tree-structure/SKILL.md · 107 lines

How it starts

The opening of the file, as written. The whole thing — 107 lines — stays where its author put it; the contents beside it link to each section on GitHub.

generate-tree-structure

When to Use

  • Generating random mazes
  • Building spanning trees
  • Covering all nodes exactly once
  • Procedural generation of connected structures
  • When you need different tree "styles" (twisted vs. branchy)

When NOT to Use

  • When you need a specific tree structure (build directly)
  • Shortest path trees (use BFS/Dijkstra)
  • When cycles are needed (not a tree)

The Pattern

Use frontier-based exploration where the pop strategy determines tree shape.

from collections import deque
import random

def random_tree(nodes, neighbors, pop=deque.pop):
    """Build spanning tree by frontier exploration.

    pop strategy determines tree shape:
    - deque.pop (DFS): long winding paths
    - deque.popleft (BFS): short bushy branches
    - random.choice: random structure
    """
    tree = set()
    nodes = set(nodes)
    root = nodes.pop()
    frontier = deque([root])

    while nodes:
        # Pop from frontier according to strategy
        current = pop(frontier)

        # Find unvisited neighbors
        unvisited = [n for n in neighbors(current) if n in nodes]

        if unvisited:
            # Pick random neighbor, add edge
            chosen = random.choice(unvisited)
            tree.add((current, chosen))
            nodes.remove(chosen)

            # Add both back to frontier
            frontier.append(current)
            frontier.append(chosen)

    return tree

Example (from pytudes Maze.ipynb)

from collections import deque
import random

def make_maze(width, height):
    """Generate a random maze using DFS-based tree generation."""

    def neighbors(cell):
        x, y = cell
        candidates = [(x+1, y), (x-1, y), (x, y+1), (x, y-1)]
        return [(nx, ny) for nx, ny in candidates
                if 0 <= nx < width and 0 <= ny < height]

    all_cells = {(x, y) for x in range(width) for y in range(height)}

    # DFS creates long winding passages
    edges = random_tree(all_cells, neighbors, pop=deque.pop)

    return Maze(width, height, edges)

def solve_maze(maze, start, goal):
    """BFS to find shortest path through maze."""
    frontier = deque([(start, [start])])
    visited = {start}

    while frontier:
        current, path = frontier.popleft()
        if current == goal:
            return path

        for neighbor in maze.neighbors(current):
            if neighbor not in visited:
                visited.add(neighbor)
                frontier.append((neighbor, path + [neighbor]))

    return None

Read the full file on GitHub · 107 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 107 lines · 30 tokens per session scan A 411bfa2d5a56

Subscribe to this mod's changes

generate-tree-structure is a skill published in the GitHub repository jimmc414/claude-code-plugin-marketplace (4 stars, last pushed yesterday), licensed MIT. It adds 30 tokens to every session and 707 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

audit-progressive-disclosure

Read-only progressive-disclosure audit for agent-facing instruction markdown. Grades every target against a three-tier load-cost model (always-loaded / invocation-loaded / on-demand) and classifies seven finding shapes in two lanes: split opportunities (oversize vs tier-calibrated Anthropic-prescribed caps…

melodic-software/claude-code-plugins · 259 tokens

quiz-me

Post-work comprehension check: after a change is complete, generate a self-contained HTML report of what was done (context, intuition, decisions) with a quiz at the bottom that you answer. Verifying the HUMAN absorbed the work, not the artifact. Non-gating by default; the quizpolicy userConfig tunes offer cadence.…

melodic-software/claude-code-plugins · 177 tokens

shape

Shape the assistant's output for a reader with ADHD, and anyone who wants action-first, low-friction responses. Lead with the concrete next action, number multi-step work, restate state across turns, cap and rank lists, give concrete time estimates, make wins visible, and cut preamble, recap, and closers. Use when…

melodic-software/claude-code-plugins · 209 tokens

generate

Build a source-backed AI industry briefing from official vendor publications, configured RSS feeds, GitHub releases, reputable secondary reporting, and user-supplied URLs. Use when: 'ai briefing', 'ai news', 'what's new in AI', 'catch me up on AI', 'prep for AI meeting', 'AI roundup', or 'generate AI slides'.

melodic-software/claude-code-plugins · 72 tokens

changelog

Ingest Claude Code changelog entries and integrate them into the current repo. Fetch (read-only display), diff (impact analysis, no edits), status (applied versions), and apply (full integrate pipeline, explicit user intent only). Use when: 'new cc version', 'what changed in claude code', 'apply changelog', a new CC…

melodic-software/claude-code-plugins · 84 tokens

eli5

Dead-simple VISUAL explainer. Produces a visual HTML explainer that assumes zero prior knowledge: one idea per diagram, minimal text. Works on a codebase object (a module, a tradeoff, an incident) or a general concept, and grounds in the real artifact before drawing anything. Use when: 'ELI5', 'explain like I'm five'…

melodic-software/claude-code-plugins · 165 tokens