ast-dependency-analyzer_skill

This skill analyzes JavaScript and TypeScript projects to build dependency graphs and identify barrels, hubs, cycles, and orphaned files.
  • JavaScript

0

GitHub Stars

5

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill splitleaseteam/splitlease_monorepo --skill ast-dependency-analyzer

  • __init__.py1.6 KB
  • ast_dependency_analyzer.py30.8 KB
  • ast_types.py16.0 KB
  • lsp_validator.py16.4 KB
  • SKILL.md11.0 KB

Overview

This skill analyzes JavaScript and TypeScript codebases to extract exports, imports, and build a complete dependency graph. It uses tree-sitter AST parsing to produce a DependencyContext containing a symbol table, dependency graph, and reverse dependencies. Use it to get a precise, line-numbered map of how modules relate across a project. The output is optimized for programmatic queries and prompt-friendly summaries.

How this skill works

The analyzer parses every .js/.jsx/.mjs/.cjs/.ts/.tsx file with tree-sitter and extracts all export and import nodes including re-exports, type-only imports, dynamic imports, and side-effect imports. It resolves module specifiers where possible to absolute paths and records line numbers, export/import kinds, aliases, and source files. From that data it builds three primary structures: symbol_table (what each file exports), dependency_graph (what each file imports), and reverse_dependencies (who imports each file). Results are cached by content hash and timestamp to speed repeated runs.

When to use it

  • Detect barrel files that re-export symbols from other modules
  • Find hub files that many modules depend on before refactoring
  • Detect circular dependencies and import cycles
  • Discover orphaned files that nothing imports
  • Analyze import patterns and type vs runtime imports for cleanup

Best practices

  • Run analysis from the repository root to get consistent resolved paths
  • Use force_refresh when you changed many files to bypass cache
  • Combine reverse_dependencies with symbol_table to identify unused exports
  • Treat type-only imports separately when making runtime dependency changes
  • Exclude generated or build artifacts from the target path to reduce noise

Example use cases

  • Barrel detection: find pure and mixed re-export files and rank by consumer count
  • Hub detection: identify files with many dependents to prioritize stabilization before changes
  • Circular dependency tracing: produce a cycle path for remediation and tests
  • Orphan detection: list files with zero consumers for possible deletion
  • Impact analysis: given a file, list all consumers to assess risk before edits

FAQ

JavaScript and TypeScript: .js, .jsx, .mjs, .cjs, .ts, .tsx.

How does the analyzer handle node_modules or external packages?

External packages (non-relative specifiers) are recorded with resolved_path = null; they are tracked as imports but not resolved into your repo graph.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational