ast-analyzer

Parse Python, JavaScript, and TypeScript code into ASTs for structural analysis.

27|16|Updated Oct 20, 2025
One-click install
npx skills add https://github.com/bejranonda/LLM-Autonomous-Agent-Plugin-for-Claude --skill ast-analyzer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ast-analyzer
Source: https://github.com/bejranonda/LLM-Autonomous-Agent-Plugin-for-Claude/tree/main/skills/ast-analyzer
Command: npx skills add https://github.com/bejranonda/LLM-Autonomous-Agent-Plugin-for-Claude --skill ast-analyzer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? This Skill provides a structural understanding of code beyond simple text analysis, enabling precise refactoring, accurate dependency tracking, and reliable impact analysis across multiple programming languages. This prevents unintended side effects during code changes and reduces debugging time.

Core Features & Use Cases:

  • Multi-Language AST Parsing: Parses code into Abstract Syntax Trees for Python, JavaScript, and TypeScript to understand its true structure and semantics.
  • Hierarchy & Call Graph Analysis: Extracts function/class hierarchies and builds call graphs to visualize dependencies and control flow.
  • Pattern & Anti-Pattern Detection: Identifies common design patterns (e.g., Singleton) and code smells (e.g., God Class, Long Function) at a structural level.
  • Impact & Coupling Analysis: Calculates the downstream impact of changes and measures coupling between modules to identify high-risk areas for modification.
  • Use Case: Before refactoring a critical function, use this skill to analyze its call graph and calculate the potential impact of changes, ensuring no unintended side effects are introduced and the refactoring is safe.

Quick Start: Analyze the provided Python code snippet to detect any "God Class" anti-patterns and "Long Function" code smells.

Frequently Asked Questions about ast-analyzer

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

FAQPage Schema
How do I analyze code structure and dependencies before refactoring?

AST analysis parses code into Abstract Syntax Trees to reveal function and class hierarchies, call graphs, and dependencies across Python, JavaScript, and TypeScript. This structural understanding lets you map the impact of changes before refactoring, preventing unintended side effects.

Can AST analysis detect code smells and design anti-patterns?

Yes, AST analysis identifies structural code smells like God Class and Long Function, plus design patterns at the semantic level. Pattern detection works across multi-language codebases by analyzing class hierarchies, method counts, and function complexity from the parsed syntax tree.

How do I track variable scope and function dependencies across a codebase?

AST analysis extracts and maps imports, exports, decorators, and variable scopes to build comprehensive dependency graphs. This scope tracking enables precise impact assessment and coupling analysis to identify high-risk areas for modification.

What languages does AST-based code analysis support?

AST analysis supports Python, JavaScript, and TypeScript through language-aware parsers. Multi-language support lets you apply consistent structural analysis, dependency mapping, and refactoring guidance across mixed-language projects.

How do I measure coupling and calculate change impact in my codebase?

AST analysis calculates downstream impact and coupling metrics by analyzing call graphs and inheritance chains extracted from the syntax tree. These measurements reveal which modules are tightly coupled and which changes carry highest risk of breakage.