tree-sitter
AST-based code analysis using tree-sitter. Use for parsing code structure, extracting symbols, finding patterns with tree-sitter queries, analyzing complexity, and understanding code architecture. Supports Python, JavaScript, TypeScript, Go, Rust, C, C++, Swift, Java, Kotlin, Julia, and more.
Best use case
tree-sitter is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
AST-based code analysis using tree-sitter. Use for parsing code structure, extracting symbols, finding patterns with tree-sitter queries, analyzing complexity, and understanding code architecture. Supports Python, JavaScript, TypeScript, Go, Rust, C, C++, Swift, Java, Kotlin, Julia, and more.
Teams using tree-sitter should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/tree-sitter/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How tree-sitter Compares
| Feature / Agent | tree-sitter | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
AST-based code analysis using tree-sitter. Use for parsing code structure, extracting symbols, finding patterns with tree-sitter queries, analyzing complexity, and understanding code architecture. Supports Python, JavaScript, TypeScript, Go, Rust, C, C++, Swift, Java, Kotlin, Julia, and more.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Tree-sitter Code Analysis
Intelligent code analysis via AST parsing with tree-sitter.
## When to Use
- Understanding code structure across multiple languages
- Extracting function/class definitions
- Finding code patterns with tree-sitter queries
- Analyzing code complexity
- Symbol extraction and dependency analysis
## Setup
MCP server configured in `~/.mcp.json`:
```json
{
"tree-sitter": {
"command": "python3",
"args": ["-m", "mcp_server_tree_sitter.server"],
"cwd": "/Users/alice/mcp-server-tree-sitter"
}
}
```
## Usage Pattern
### 1. Register a Project First
```
register_project_tool(path="/path/to/project", name="my-project")
```
### 2. Explore Files
```
list_files(project="my-project", pattern="**/*.py")
get_file(project="my-project", path="src/main.py")
```
### 3. Analyze Structure
```
get_ast(project="my-project", path="src/main.py", max_depth=3)
get_symbols(project="my-project", path="src/main.py")
```
### 4. Search with Queries
```
find_text(project="my-project", pattern="function", file_pattern="**/*.py")
run_query(
project="my-project",
query='(function_definition name: (identifier) @function.name)',
language="python"
)
```
### 5. Complexity Analysis
```
analyze_complexity(project="my-project", path="src/main.py")
```
## Available Tools
- **Project**: `register_project_tool`, `list_projects_tool`, `remove_project_tool`
- **Language**: `list_languages`, `check_language_available`
- **Files**: `list_files`, `get_file`, `get_file_metadata`
- **AST**: `get_ast`, `get_node_at_position`
- **Search**: `find_text`, `run_query`
- **Symbols**: `get_symbols`, `find_usage`
- **Analysis**: `analyze_project`, `get_dependencies`, `analyze_complexity`
- **Queries**: `get_query_template_tool`, `build_query`, `adapt_query`
- **Similar Code**: `find_similar_code`
## Supported Languages
Python, JavaScript, TypeScript, Go, Rust, C, C++, Swift, Java, Kotlin, Julia, APL, and many more via tree-sitter-language-pack.
## Scientific Skill Interleaving
This skill connects to the K-Dense-AI/claude-scientific-skills ecosystem:
### Tree Structures
- **etetoolkit** [○] via bicomodule
- Tree parsing and traversal
### Bibliography References
- `graph-theory`: 38 citations in bib.duckdb
## Cat# Integration
This skill maps to **Cat# = Comod(P)** as a bicomodule in the equipment structure:
```
Trit: 0 (ERGODIC)
Home: Prof
Poly Op: ⊗
Kan Role: Adj
Color: #26D826
```
### GF(3) Naturality
The skill participates in triads satisfying:
```
(-1) + (0) + (+1) ≡ 0 (mod 3)
```
This ensures compositional coherence in the Cat# equipment structure.Related Skills
Tree-Sitter Analyzer Skill
**Version**: 1.0.0
zx-calculus
Coecke's ZX-calculus for quantum circuit reasoning via string diagrams with Z-spiders (green) and X-spiders (red)
zulip-cogen
Zulip Cogen Skill 🐸⚡
zls-integration
zls-integration skill
zig
zig skill
zig-syrup-bci
Multimodal BCI pipeline in Zig: DSI-24 EEG, fNIRS mBLL, eye tracking IVT, LSL sync, EDF read/write, GF(3) conservation
zig-programming
zig-programming skill
zeroth-bot
Zeroth Bot - 3D-printed open-source humanoid robot platform for sim-to-real and RL research. Affordable entry point for humanoid robotics.
xlsx
Comprehensive spreadsheet creation, editing, and analysis with support
wycheproof
Google's Wycheproof test vectors for cryptographic implementation testing.
Writing Hookify Rules
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
worldmat-tidar
worldmat-tidar