tree-sitter-core

Explain tree-sitter's parsing model and node classification for CST vs AST debugging.

1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/hafley66/claude-research --skill tree-sitter-core
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tree-sitter-core
Source: https://github.com/hafley66/claude-research/tree/main/skills/tree-sitter-core
Command: npx skills add https://github.com/hafley66/claude-research --skill tree-sitter-core

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Explain tree-sitter's parsing model and node classification to clarify CST vs AST in concrete syntax trees.

Core Features & Use Cases

  • Clarifies how tree-sitter represents syntax trees (CST vs AST) and distinguishes named and anonymous nodes.
  • Explains fields vs kinds and how ast-grep maps to tree-sitter internals.
  • Use case: debugging AST matching issues and navigating parse trees during language tooling development.

Quick Start

Explain how to identify named vs unnamed nodes in a tree-sitter CST and how to map them to ast-grep concepts.

Frequently Asked Questions about tree-sitter-core

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

FAQPage Schema
What is the difference between CST and AST in tree-sitter parse trees?

Tree-sitter generates a Concrete Syntax Tree (CST), not a true AST, because it retains anonymous nodes like punctuation alongside named nodes. This preserves the complete source structure for accurate syntax representation and debugging.

How do I identify named vs unnamed nodes when debugging tree-sitter syntax trees?

To identify named vs unnamed nodes in tree-sitter, you inspect the node's type: named nodes have descriptive identifiers (e.g., `function_declaration`), while unnamed nodes represent punctuation or keywords. This distinction is crucial for debugging structural patterns.

How does ast-grep map to tree-sitter node types and fields?

ast-grep maps to tree-sitter by matching named nodes and using fields to define parent-child relationships. This mapping clarifies how ast-grep patterns translate into underlying tree-sitter queries for precise syntax tree navigation.

Why does my ast-grep pattern fail to match unnamed nodes in a tree-sitter parse tree?

ast-grep patterns often fail to match unnamed nodes because ast-grep primarily targets named tree-sitter nodes. Unnamed nodes, such as punctuation or keywords, are typically ignored in pattern matching unless explicitly referenced in the query syntax.

Can I use tree-sitter to inspect parse trees across different programming languages?

Yes, you can use tree-sitter to inspect parse trees across multiple programming languages. Its generalized parsing model standardizes node classification into named and anonymous types, enabling consistent syntax tree analysis and debugging regardless of the language grammar.

What is the difference between fields and kinds when navigating tree-sitter node types?

In tree-sitter, kinds refer to the specific node type (e.g., `identifier`), while fields define the structural role of a child node within its parent (e.g., `left` or `right` in a binary operation). Distinguishing them is essential for accurate tree navigation.