alivirgo/major-ai-skills/tree-sitter-scope-extractor
Claude Code and agent skill by alivirgo/major-ai-skills
- community
Checking that the SKILL.md file is still in the repository.
Use Tree-sitter to extract the enclosing function or class and relevant imports around a source location.
Install
npx vskill@latest install alivirgo/major-ai-skills/tree-sitter-scope-extractorSKILL.md
Tree-Sitter AST Scope Extraction Protocol (Surgical Block Ingestion)
Overview
When an agent is debugging a stack trace pointing to a specific line number (e.g., `TypeError at src/services/order.ts:142`), naive agents ingest the complete 800-line source file.
Full-file ingestion:
- Consumes 6,000+ Tokens: 90% of the file contains unrelated CRUD routes, database connection pools, and logging utilities.
- Dilutes Debugging Attention: The LLM's attention heads must filter through 750 lines of background code to focus on the 20 lines that actually caused the bug.
- Multiplies Turn Latency: Re-ingested on every follow-up diagnostic turn.
The Tree-Sitter AST Scope Extraction Protocol parses the file into an Abstract Syntax Tree in 2 milliseconds, extracting strictly the top-level imports and the immediate enclosing AST scope (function, method, or class block).
Full-File Dump vs. Tree-Sitter Enclosing Scope Slice
The 3-Step AST Extraction Pipeline
Production Python Tree-Sitter Scope Extractor
Benchmark Comparison
Debugging 30 runtime exceptions across large full-stack codebases:
| Context Ingestion Strategy | Ingested Tokens / Turn | Bug Diagnosis Accuracy | Debugging Turns | |
|---|---|---|---|---|
| Full 800-Line File Dumps | 6,400 tokens | 78.5% | 4.2 turns | |
| Tree-Sitter AST Scope Protocol | 480 tokens | 96.4% | 1.8 turns (2.3x Faster) |
Agent Operational Directive
MANDATORY: When debugging specific lines or function symbols, agents must extract strictly the module imports and the enclosing Tree-sitter AST scope. Never pass entire monolithic files into context when only a single function is under investigation.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/tree-sitter-scope-extractor/SKILL.md
Popularity
- Repository stars
- 1
- 7-day trend score
- 3
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/alivirgo/major-ai-skills/tree-sitter-scope-extractor)