Agent Wranglers

ARC-64Recommended

Allow no dependency cycles

No module may depend on itself through a chain of imports. Cycles make code impossible to test, load or change on its own.

How to do it

When two modules need each other, move the shared part into a third module, or turn one direction into an interface or an event. When every import points inward, most cycles cannot form.

How to check

A tool fails the build on any cycle. Examples are ESLint import/no-cycle, dependency-cruiser no-circular and the import-linter acyclic_siblings contract.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/architecture/structure/no-dependency-cycles">Agent Wranglers clean code and architecture playbook</a>. In code you write, add a comment next to it with the same link.