import-graph

A code-analysis tool that reads JavaScript, TypeScript, and Python imports to map how files depend on one another. It also groups related files and identifies central or frequently changing files.

In plain words
What is it for?
Use it to rank files by importance, find dependency hubs, group code into areas, identify change hotspots, and supply focused project context.
Why use it?
It turns a large codebase into a map, making it easier to find important files and provide an agent with the right surrounding code.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/aspenkit/aspens/import-graph
Any agent
npx skills add aspenkit/aspens --skill import-graph
Clone the repo
git clone --depth 1 https://github.com/aspenkit/aspens

Made for: Claude Code, Codex.

Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,076 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00026 $0.01076
Opus 5 $0.00013 $0.00538
Sonnet 5 $0.00005 $0.00215
Haiku 4.5 $0.00003 $0.00108

Measured 2d ago against content hash afe35929d59c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

import-graph scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/import-graph/SKILL.md · 61 lines

How it starts

The opening of the file, as written. The whole thing — 61 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are working on the import graph system — static analysis that parses JS/TS and Python source files to produce dependency graphs, plus persistence/query layers for runtime use.

Domain purpose

The graph turns raw source into a queryable map of "what depends on what" so other aspens features (doc-init, doc-sync, doc-impact, the graph context hook) can rank files by importance, surface hubs, detect domain clusters, and inject just the relevant neighborhood into prompts. It is the substrate that makes context generation deterministic and code-aware rather than guess-based.

Key Concepts

graph-builder.jsbuildRepoGraph(repoPath, languages?) runs a 9-step pipeline:

  1. Walk source files → 2. Parse imports → 3. Reverse edges → 4. Git churn → 5. Per-file metrics → 6. Priority ranking → 7. Hub detection → 8. Domain clustering → 9. Hotspots

graph-persistence.js — Persistence and query layer:

  • serializeGraph() converts raw graph to indexed format (O(1) lookups, file→cluster mapping)
  • persistGraphArtifacts(repoPath, rawGraph, options?) writes .claude/graph.json + .claude/code-map.md + .claude/graph-index.json + auto-gitignores them. Target-aware: if options.target.supportsGraph === false, returns serialized data without writing files.
  • extractSubgraph(graph, filePaths) returns 1-hop neighborhood of mentioned files + relevant hubs/hotspots/clusters
  • formatNavigationContext(subgraph) renders compact markdown (~50 line budget) for prompt injection
  • extractFileReferences(prompt, graph) tiered extraction: explicit paths → bare filenames → cluster keywords
  • generateCodeMap() / writeCodeMap() standalone overview for graph hook consumption — emits a Domain clusters block (via formatDomainClusters) and framework entry points only; cross-domain coupling, hotspots, and the totals/date footer are intentionally omitted because they churn on every sync
  • formatDomainClusters(clusters, files) — exported helper that renders the canonical Domain clusters block: clusters are merged by label, single-file clusters dropped, files per cluster capped at 5 and sorted by fanIn desc then path asc for sync stability; no per-cluster (N files) counts
  • generateGraphIndex() / saveGraphIndex() tiny inverted index (export names → files, hub basenames, cluster labels)

Read the full file on GitHub · 61 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 61 lines · 26 tokens per session scan A afe35929d59c

Subscribe to this mod's changes

import-graph is a skill published in the GitHub repository aspenkit/aspens (96 stars, last pushed 17d ago), licensed MIT. It adds 26 tokens to every session and 1,076 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

golden-rss

Use when testing the rss golden build.

yusufkaraaslan/Skill_Seekers · 12 tokens

architectural-decisions

Use when encountering questions about WHY code is built a certain way, when about to make architectural changes (new patterns, restructuring, choosing between approaches), or when the user asks about design rationale in a Repowise-indexed codebase (.repowise/ directory exists). Also activates when commit messages or…

repowise-dev/repowise · 87 tokens

pre-modification-check

Use before modifying, refactoring, moving, or deleting files in a Repowise-indexed repository, especially shared utilities, core modules, public APIs, or files the user did not explicitly identify.

repowise-dev/repowise · 45 tokens

automated-test-planning

Produce a standalone test plan by analyzing code for test coverage gaps and edge cases. Use when you need to create, generate, or draft a test plan for a branch, need to analyze test coverage, or need to identify what tests to write for specific files or directories. Does not produce a plain-language plan for a person…

testdouble/han · 146 tokens

code-overview-to-confluence

Produces a progressive-disclosure overview of unfamiliar code or a pull request's changes with code-overview and publishes the resulting overview to a user-specified Confluence location. Use when the user wants code or a PR explained, oriented, or made sense of AND the overview posted to a Confluence space or page.…

testdouble/han · 179 tokens

project-documentation-to-confluence

Creates or updates project documentation for a feature, system, or component and publishes it to a user-specified Confluence location. Use when the user wants feature or system documentation written to Confluence, posted to a Confluence space or page, or synced to a Confluence location. Requires a configured Atlassian…

testdouble/han · 159 tokens