circular-dep-untangler

circular-dep-untangler is an agent for Claude Code from luongnv89/skills. It costs 20 tokens per session (992 once invoked), scanned A, original, MIT.

An agent for finding circular dependencies, where modules import one another in a loop, and breaking those loops with small code changes.

In plain words
What is it for?
Use it to inspect a project’s dependency graph, identify import cycles, and choose a suitable way to remove each cycle.
Why use it?
Import cycles can cause initialization bugs, ordering problems, failed tests, and unclear module boundaries.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: mentions subagents.

Good fit Use it to inspect a project’s dependency graph, identify import cycles, and choose a suitable way to remove each cycle.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/luongnv89/skills/circular-dep-untangler
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.

Clone the repo
git clone --depth 1 https://github.com/luongnv89/skills

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for circular-dep-untangler

README.md
[![agentmods](https://agentmods.dev/badge/agents/luongnv89/skills/circular-dep-untangler/github.svg)](https://agentmods.dev/agents/luongnv89/skills/circular-dep-untangler)
Your own site
<a href="https://agentmods.dev/agents/luongnv89/skills/circular-dep-untangler"><img src="https://agentmods.dev/badge/agents/luongnv89/skills/circular-dep-untangler/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for circular-dep-untangler

Your own site · 80×15
<a href="https://agentmods.dev/agents/luongnv89/skills/circular-dep-untangler"><img src="https://agentmods.dev/badge/agents/luongnv89/skills/circular-dep-untangler.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 992 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00020 $0.00992
Opus 5 $0.00010 $0.00496
Sonnet 5 $0.00004 $0.00198
Haiku 4.5 $0.00002 $0.00099

Measured 9d ago against content hash 5fa49e0a4c63, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

circular-dep-untangler 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 9d 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.

skills/code-review/agents/circular-dep-untangler.md · 89 lines

How it starts

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

Circular Dependency Untangler Subagent

Find cycles in the import/dependency graph and break them with minimal intrusive changes. Cycles cause subtle bugs (partial initialization, ordering issues, test isolation failures) and block clean module boundaries.

Input

{
  "repo_path": "/abs/path",
  "stack": {"language": "ts|py|go|rust|java|...", "typecheck_cmd": "..."},
  "output_report": ".slop-cleanup/wave-1/circular-dep-untangler.md"
}

Tools (pick per stack)

  • TS/JS: madge --circular src/ (primary); dependency-cruiser for richer rules
  • Python: pylint cyclic-import check; pydeps for visualization; importlab
  • Go: cycles are compile errors — this category is mostly moot; still check internal/ boundary violations
  • Rust: cycles blocked at module level; check crate-level with cargo-modules
  • Java: JDeps, ArchUnit rules

If no tool is available, fall back to building the import graph with grep + a simple tarjan's SCC walker. It's slower but reliable.

The Five Break Strategies

When you find a cycle, apply the first viable strategy:

  1. Extract shared types. If A.ts and B.ts import each other for type definitions, move those types to shared/types.ts. Both import from shared; the cycle dies. This is the most common and cleanest fix.

  2. Invert the dependency. If high-level orchestrator imports low-level store, and store imports orchestrator for a callback type, define the callback interface in store and have orchestrator implement it. Low-level modules should not know about high-level ones.

  3. Extract the shared computation. If two modules call into each other to complete one logical flow, extract that flow into a third module that both depend on.

  4. Delete the weaker edge. If the cycle exists only because someone added a convenience import for a single utility, copy the three-line utility or inline it. Small duplication beats a cycle.

  5. Merge the modules. If two files are so tightly coupled they always change together, they should be one file. Merge them and the cycle disappears.

Read the full file on GitHub · 89 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. 9d ago First seen · 89 lines · 20 tokens per session scan A 5fa49e0a4c63

Subscribe to this mod's changes

circular-dep-untangler is an agent published in the GitHub repository luongnv89/skills (123 stars, last pushed yesterday), licensed MIT. It adds 20 tokens to every session and 992 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.