elixir-cyclic-dependencies

Detect and resolve cyclic compile-time dependencies in Elixir projects using mix xref.

26|5|Updated Feb 3, 2026
One-click install
npx skills add https://github.com/dominicletz/elixir-skills --skill elixir-cyclic-dependencies
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: elixir-cyclic-dependencies
Source: https://github.com/dominicletz/elixir-skills/tree/main/elixir-cyclic-dependencies
Command: npx skills add https://github.com/dominicletz/elixir-skills --skill elixir-cyclic-dependencies

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Elixir projects often suffer from cyclic compile-time dependencies that complicate builds and hinder refactors. This skill helps identify and resolve these cycles with minimal code changes.

Core Features & Use Cases

  • Detects and analyzes compile-time dependency cycles in Elixir projects using mix xref.
  • Guides minimal-change fixes, such as extracting common helpers or re-structuring modules to break cycles.
  • Supports verification steps (version checks, threshold-based cycle reporting) and practical workflow guidance for production codebases.

Quick Start

Run the recommended xref commands from your project root to identify and begin breaking cycles.

Frequently Asked Questions about elixir-cyclic-dependencies

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

FAQPage Schema
How do I find cyclic compile-time dependencies in an Elixir project?

Break cyclic compile dependencies by extracting helper modules or moving shared code into separate modules. This minimizes structural changes while ensuring the Elixir compiler can properly order and build the affected modules.

Can I set a threshold to automatically fail builds with mix xref cycles?

Yes, you can use the --fail-above threshold flag with mix xref to automatically fail builds when cyclic compile-time dependencies exceed an acceptable limit. This helps enforce dependency graph quality in production Elixir codebases.

What Elixir version is required to detect compile-time cycles with mix xref?

Detecting compile-time cycles with mix xref requires Elixir 1.19 or later. This version provides the necessary graph and cycle formatting features to properly surface and report compile-time dependency issues.

What is the best way to resolve cyclic dependencies in Elixir without large refactors?

The best way to resolve cyclic dependencies with minimal code changes is extracting common helpers or restructuring specific modules. This targeted approach breaks the compile-time cycle without requiring a full architecture overhaul.

Why does my Elixir build have cyclic compile-time dependencies?

Cyclic compile-time dependencies occur when modules reference each other during compilation, creating a circular chain in the dependency graph. This complicates Elixir builds and hinders code refactors by preventing the compiler from determining a valid compilation order.