domain-dag

Validates acyclic local import graphs and domain ownership boundaries in modular codebases.

Updated Aug 2, 2026
One-click install
npx skills add https://github.com/mikalv/pi-extensions --skill domain-dag-mikalv
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: domain-dag
Source: https://github.com/mikalv/pi-extensions/tree/main/packages/pi-telegram/.agents/skills/domain-dag
Command: npx skills add https://github.com/mikalv/pi-extensions --skill domain-dag-mikalv

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Modular codebases drift over time: import cycles appear, domain modules start importing entrypoints, and generic folders like utils or shared quietly absorb real responsibilities. This Skill audits and enforces a Domain DAG architecture so every durable module has clear ownership, explicit exclusions, and a one-directional dependency graph. ## Core Features & Use Cases - Import Graph Validation: Detects cycles, reverse entrypoint imports, forbidden edges, and layer-direction violations across TypeScript, JavaScript, and Svelte sources, including configured path aliases. - Ownership & Boundary Guidance: Provides axioms, placement heuristics, extraction protocols, and stop rules for deciding where code belongs and when to stop decomposing. - Configurable Severity Ladder: Distinguishes hard failures (cycles, forbidden edges) from heuristic warnings (shared buckets, missing headers, wide interface surfaces) via a project-local domain-dag.json. - Use Case: Before merging a refactor of a monorepo, run the bundled validator from the project root to confirm the local import graph is acyclic and no domain module reaches into the application composition root. ## Quick Start Ask the agent to run the domain-dag validator against the current project root and report any import cycles or boundary violations.

Frequently Asked Questions about domain-dag

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

FAQPage Schema
How do I detect circular imports in a TypeScript project?▼

Run the bundled validator script from the project root; it builds a local import graph from TypeScript and JavaScript sources and reports every cycle as a hard failure. Path aliases like @/* can be declared in domain-dag.json so aliased imports are resolved too.

How to enforce layered architecture boundaries in a monorepo?▼

Define ranked layers and forbidden edges in a domain-dag.json config file, then run the validator. Lower-ranked layers importing higher-ranked ones are reported as errors, and custom forbidden-edge rules block specific cross-boundary imports.

Does the validator support import aliases like @/ or $lib?▼

Yes, the importAliases config maps alias prefixes such as @/* or $lib/* to real directories so the graph resolver can follow them. Aliases are project-local and do not assume any specific bundler or language server convention.

Why are folders named utils or shared flagged as warnings?▼

Generic shared-bucket names like utils, types, or shared often hide real domain ownership, so the validator flags them as heuristic warnings. They are not proof of bad architecture; you can allow specific paths via allowedSharedBuckets or escalate severity in config.

When should I stop decomposing a large module?▼

Stop when remaining code is orchestration glue, the next extraction would only pass host state through as props, or the boundary would become a long callback list. The skill's stop rules prioritize change locality and visible control flow over file size.