tsentials/tree

Build and traverse recursive hierarchical tree structures with query, transform, and fold operations.

49|Updated May 12, 2026
One-click install
npx skills add https://github.com/senrecep/tsentials --skill tsentials-tree
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tsentials/tree
Source: https://github.com/senrecep/tsentials/tree/main/.well-known/agent-skills/tsentials-tree
Command: npx skills add https://github.com/senrecep/tsentials --skill tsentials-tree

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you model, traverse, and transform recursive parent-child structures without writing error-prone custom recursion logic.

Core Features & Use Cases

  • Recursive Tree Construction: Build roots, leaves, and nested forests for hierarchies like categories, comments, and org charts.
  • Query & Search: Retrieve root values, enumerate immediate children, compute total size, check leaf nodes, and find nodes by predicates.
  • Transform & Flatten: Map and filter values, then convert the tree into pre-order arrays with optional depth metadata for rendering or analytics.
  • Aggregation via Fold: Compute recursive results (e.g., sums, derived metrics, or validation checks) by folding values and child results.
  • Pretty Rendering: Generate human-readable tree diagrams using a default stringifier or a custom value display function.

Quick Start

Use the tsentials/tree Skill to create a hierarchy for your domain (like categories or comments), then call Tree.findAll to collect every matching node and prepare the result for rendering or further processing.

Frequently Asked Questions about tsentials/tree

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I model recursive hierarchies in TypeScript without writing custom recursion logic?

To model recursive hierarchies, use a fluent API to build root-with-children tree structures, enabling you to construct, traverse, and transform nested data like category nesting or comment threads without manual recursion.

How do I flatten a recursive tree structure into a pre-order array with depth metadata in TypeScript?

Flattening a tree structure into pre-order arrays is handled by transforming values with map and filter, then converting the nodes while attaching optional depth metadata for rendering or analytics purposes.

What is the best way to compute recursive aggregations across nested hierarchical data?

Computing recursive aggregations across nested data is achieved by folding the tree, which combines current node values with child results to calculate derived metrics, sums, or validation checks.

Can I search and query specific nodes in a hierarchical tree by predicates?

Yes, you can query nodes in a hierarchical tree by using predicates to find specific matches, retrieve root values, enumerate immediate children, compute total size, and check for leaf nodes.

Does this tree modeling approach work for organizational charts and category nesting?

Yes, this tree modeling approach works for organizational charts, category nesting, and comment threads by representing nodes as a recursive parent-child structure suitable for complex domain modeling.

How do I generate human-readable diagrams from a nested tree structure?

Generating human-readable diagrams from a nested tree structure is done using a default stringifier or a custom value display function to render the hierarchy clearly for visual inspection.