Dependency Violations: How the Rules Get Broken
A utility function that quietly calls the database breaks Axiom A2. See how upward imports creep in, what they cost, and the small refactor that undoes them.
Nobody sets out to create a dependency cycle. Someone needs the list of ticket states inside a validation schema and notices that an enum already exists in one of the tools. Someone else wants to send a reminder after a booking and spots a tool that does exactly that. Each import is a single line, and each one is a violation.
Schema is the bottom of the stack (ν 0.3), and every other layer may depend on it. Tools sit far above it (ν 0.8). So when a schema file imports from a tool, the dependency runs backwards across three layers:
// L1 Schema: the violation
import { TicketStatus } from "../../tools/closeTicket/closeTicket.tool";
export const TicketSchema = z.object({
id: z.string().uuid(),
status: z.nativeEnum(TicketStatus),
});
Tools already import Schema to validate their inputs. Now Schema imports Tools, which is a cycle. Edit the enum in that one tool and the Schema layer must be recompiled and revalidated, and because everything depends on Schema, so must everything else. The book's Change Impact Radius, its measure of how many files a typical change touches, reaches its theoretical maximum from a single import.
The repair is to define the values where they belong. Declare the enum in Schema and let the tool import it. The set of valid ticket states is then decided by the most stable layer in the system, which is where such a decision should live.
The second variant stays within one layer. A bookAppointment tool imports sendReminder so that confirmations go out automatically. This breaks Axiom A5, the rule that distinct tools never depend on each other.
The usual costs follow: a cycle waiting to happen if reminders ever need booking details, edits to one tool rippling into the other, and a test setup that must now stand in for both. The book adds a fourth point that is easy to miss. A tool that calls another tool is performing orchestration, whether or not anyone has admitted it. Coordinating several business operations is the job of the API layer (L5) or an agent (L8), not of an individual tool.
What to do instead depends on what is actually being shared:
The article on Axiom A5 walks through that last decision in more depth.
Both imports compile. Both are short, locally sensible and easy to approve in a busy review. The damage is invisible at the scale of one file and only appears at the scale of the system: slower builds, wider test setups, and changes that fan out further than anyone expected.
That is why the book recommends a mechanical answer rather than good intentions. For every new import, ask which layer it points at. In case one the answer is "up", and in case two it is "sideways within Tools". Neither answer is permitted, and a linter can ask the question faster than a reviewer. The book's suggested CI setup fails the build on exactly these two kinds of violation, and treats the rest as warnings.
Judge an import by the layer it crosses, not by how small it is. The enum that "just saves duplication" and the tool that "just reuses a function" both turn a clean one-way graph into something you have to reason about as a whole. Read how the upward case begins in Utils, see why cycles are structurally excluded, and look at why Schema is the layer to protect most.