cleanup-cycles

Solid

Detect and untangle circular dependencies. Runs madge/skott (TS), pycycle (Py), or compiler-only checks (Go/Rust). Auto-fixes leaf-extractable cycles; reports core cycles for human review. Use when the user asks to find circular imports, fix dependency cycles, or untangle module graph. Example queries — "find circular imports", "fix dependency cycles", "untangle our module graph", "why is madge complaining".

AI & Automation 78 stars 9 forks Updated today MIT

Install

View on GitHub

Quality Score: 87/100

Stars 20%
63
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

Detect circular import dependencies and break them where it's mechanically safe. Cycles between leaf utilities can be fixed by extraction; cycles between core modules need architectural decisions and are reported, not auto-fixed. ## Preflight 1. **Language detect**: `package.json` (TS/JS), `pyproject.toml` (Py), `go.mod` (Go), `Cargo.toml` (Rust). Note: Go and Rust prevent cycles at compile time, so this skill is mostly TS/Py work. 2. **Git state**: refuse auto-apply on dirty tree. 3. **Report dir**: ensure `.claude/cleanup-reports/` exists. 4. **Existing scripts**: check `package.json` for a `cycle:check` (or similar) script — if the repo already wires up madge with custom config, prefer that over defaults. ## Detect ### TypeScript / JavaScript ```bash # Madge is the standard. Skott is faster for large repos. bunx madge --circular --extensions ts,tsx,js,jsx --json src/ apps/ packages/ > /tmp/madge.json 2>/dev/null \ || npx madge --circular --extensions ts,tsx --json . > /tmp/madge.json ``` Each entry is an array describing one cycle: `["a.ts", "b.ts", "a.ts"]`. ### Python ```bash pipx run pycycle --here --verbose > /tmp/pycycle.txt 2>&1 || true # Fallback: import-linter with auto-config pipx run import-linter > /tmp/import-linter.txt 2>&1 || true ``` ### Go ```bash # Go enforces acyclic at compile; this just confirms build is clean. go build ./... 2>&1 # Optional: visualize with goda for ergonomics go install github.com/loov/goda@latest 2>/dev/null goda graph ./... >...

Details

Author
raintree-technology
Repository
raintree-technology/agent-starter
Created
7 months ago
Last Updated
today
Language
JavaScript
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Solid

cleanup-unused

Detect and delete unused code, exports, files, and dependencies. Runs knip/vulture/staticcheck/cargo-machete appropriate to the language, writes a critical assessment, and auto-applies HIGH-confidence deletions. Use when the user asks to remove dead code, find unused exports, clean up dependencies, or run dead-code analysis. Example queries — "find dead code", "what's unused in this repo", "are there unused npm deps", "kill the cruft".

78 Updated today
raintree-technology
Code & Development Listed

cli-audit-tangle

Detect spaghetti code and dependency cycles using graph theory, spectral analysis, and biomimetic patterns. Finds god functions, circular dependencies, dead code, suboptimal module boundaries, CI/CD pipeline deadlocks, and inefficient call patterns. Uses call graph topology (not just line-level metrics) to identify structural problems invisible to linters. Provides concrete fix patterns per domain. Use when the user says 'spaghetti', 'tangle', 'untangle', 'god function', 'god object', 'circular dependency', 'cycle detection', 'call graph', 'module coupling', 'dead code', 'code topology', 'complexity analysis', 'who calls who', 'démêler', 'couplage', 'dépendances circulaires', 'fonction dieu', 'code mort', 'import cycle', 'ImportError', 'pipeline deadlock', 'CI stuck', 'needs deadlock', 'everything depends on everything'. Also triggers on 'refactor structure', 'split module', 'too coupled', 'architecture debt', 'dependency diagnostic', 'workflow cycle'.

4 Updated yesterday
Destynova2
AI & Automation Listed

elixir-cyclic-deps

Detects and removes cyclic compile-time dependencies in Elixir codebases using mix xref, with minimal code changes. Use when the user explicitly asks to check for cycles, remove cyclic dependencies, or fix xref cycle failures. Requires Elixir 1.19 or higher for accurate results.

54 Updated 2 months ago
matteing