setup-ts-deep-modules

Configures dependency-cruiser to enforce deep-module package boundaries in TypeScript repositories.

Updated Apr 28, 2026
One-click install
npx skills add https://github.com/GregM1991/skills --skill setup-ts-deep-modules-gregm1991
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: setup-ts-deep-modules
Source: https://github.com/GregM1991/skills/tree/main/skills/vendor/mattpocock/setup-ts-deep-modules
Command: npx skills add https://github.com/GregM1991/skills --skill setup-ts-deep-modules-gregm1991

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires dependency-cruiser.

What problem does it solve? TypeScript monorepos often leak implementation details because any file can import any other file, making packages shallow and tightly coupled. This Skill wires dependency-cruiser into a repo so each package becomes a deep module: implementation hidden in subfolders and reachable only through its root entry-point files. ## Core Features & Use Cases - Boundary rule installation: Installs dependency-cruiser and writes a .dependency-cruiser.cjs config with four error-level rules covering entry-point boundaries, intra-package freedom, tests-through-entrypoints, and cycle detection. - Verification loop: Scaffolds an example package, then proves the rules bite by observing a pass, a deliberate failure on a deep import, and a pass again. - Documentation and discoverability: Writes a README in the packages folder discouraging barrel files and adds a pointer from CLAUDE.md or AGENTS.md so agents discover the convention. - Use Case: A team adopting package-based architecture in a pnpm monorepo runs this Skill to enforce that src/packages/billing is only ever imported through its root files, never its lib/ internals. ## Quick Start Ask the agent to set up deep-module boundaries with dependency-cruiser for the packages in this TypeScript repo.

Frequently Asked Questions about setup-ts-deep-modules

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

FAQPage Schema
How do I enforce package boundaries in a TypeScript monorepo?▼

Use dependency-cruiser with forbidden rules that block imports into package subfolders from outside the package. This Skill installs the tool, writes the config, adds a lint:boundaries script, and folds it into the repo's existing check command.

How to make packages importable only through their entry points?▼

Define the public surface as the package's root files and forbid imports matching anything deeper. The generated config uses path-depth patterns with group back-references so a package's own files import freely while outsiders can only reach entry points.

Does dependency-cruiser work with pnpm, yarn, and bun?▼

Yes, dependency-cruiser is package-manager agnostic. The setup detects the manager from lockfiles (pnpm-lock.yaml, yarn.lock, bun.lockb) and uses it for installation and script commands.

Can a package expose multiple entry points instead of one index.ts?▼

Yes, every root file of a package is an entry point, so a package can expose index.ts, client.ts, and server.ts as separate small entry points. Barrel files that re-export whole subtrees are explicitly discouraged.

Why does the boundary check not fail on deep imports?▼

The rules are not wired correctly if a deliberate deep import passes. The setup includes a verification step that adds a temporary deep import, confirms lint:boundaries fails with tests-through-entrypoints, then reverts and confirms it passes.