elixir-cyclic-depslisted
Install: claude install-skill matteing/opal
# Elixir Cyclic Dependencies
## When to Use
Apply this skill only when the user **explicitly asks** to check or remove cyclic dependencies (e.g. "check for cycles", "remove cyclic dependencies", "fix xref cycles").
## Prerequisite: Elixir Version
Cycle detection is correct only on **Elixir 1.19 or higher**. Before running any cycle checks:
1. Verify version: `elixir -v` or inside the project run `mix run -e 'IO.inspect(System.version())'`.
2. If the version is below 1.19, stop and inform the user that upgrading to Elixir 1.19+ is required for reliable cycle detection.
## Detecting Cycles
Run both commands from the project root. Start with a relaxed threshold, then tighten:
```bash
mix xref graph --format cycles --label compile-connected --fail-above 3
mix xref graph --format cycles --label compile --fail-above 3
```
- **compile-connected**: cycles in the compile-time dependency graph (modules that compile in a cycle).
- **compile**: same graph, different label; both should be run.
- **--fail-above N**: exit code fails when cycle count is above N. Use `3` initially, goal is **0**.
To list cycles without failing (for inspection), omit `--fail-above` or set it high:
```bash
mix xref graph --format cycles --label compile-connected
mix xref graph --format cycles --label compile
```
**Goal**: reach `--fail-above 0` for both commands (no cycles).
## Workflow
1. **Check Elixir version** (must be ≥ 1.19).
2. **Establish baseline**: run both xref commands with `--fail-abo