setup-ts-deep-modules

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

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Fatih0234/mattpocock-skills-pi --skill setup-ts-deep-modules-fatih0234
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: setup-ts-deep-modules
Source: https://github.com/Fatih0234/mattpocock-skills-pi/tree/main/skills/in-progress/setup-ts-deep-modules
Command: npx skills add https://github.com/Fatih0234/mattpocock-skills-pi --skill setup-ts-deep-modules-fatih0234

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires dependency-cruiser.

What problem does it solve? TypeScript monorepos often suffer from leaky package boundaries where code imports deep into another package's internals, making refactors risky and coupling invisible. This Skill wires dependency-cruiser into a repo so every package becomes a deep module: implementation hidden in subfolders, reachable only through its root entry-point files. ## Core Features & Use Cases - Boundary rule installation: Copies a ready-made dependency-cruiser config with four error-level rules covering entry-point boundaries, intra-package freedom, tests-through-entrypoints, and cycle detection. - Environment detection: Detects the package manager (pnpm, yarn, bun, npm), the packages root (src/packages or packages), and merges rules into any existing dependency-cruiser config instead of overwriting it. - Proof the rules bite: Scaffolds an example package, then verifies the lint passes, fails on a deliberately added deep import, and passes again after reverting. - Use Case: A team adopting a packages/ layout wants to stop cross-package deep imports. Run this Skill to install the config, add a lint:boundaries script to the CI check command, scaffold a copy-me example package, and document the convention in the packages README and CLAUDE.md/AGENTS.md. ## 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 a package's subfolders from outside code. This Skill installs that config, adds a lint:boundaries script, and folds it into the repo's existing check command alongside typecheck.

What is a deep module in TypeScript package design?▼

A deep module exposes a small public interface hiding a lot of implementation. Here, a package's root files are its entry points and everything in subfolders like lib/ and tests/ is private, enforced by path-depth-based dependency-cruiser rules.

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

Yes. The Skill detects the package manager from lockfiles (pnpm-lock.yaml, yarn.lock, bun.lockb) and uses it for installing dependency-cruiser and running commands, falling back to npm when no lockfile matches.

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

Yes. The public surface is every root file of a package, so it can expose several small entry points like index.ts, client.ts, and server.ts. Barrel files that re-export whole subtrees are explicitly discouraged.

What happens if a dependency-cruiser config already exists?▼

The Skill does not overwrite an existing .dependency-cruiser file. It merges the four boundary rules and options into the existing config and reports what was added.

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

The rules are not wired correctly if a deliberate deep import passes. The Skill's verification step requires observing a pass, a failure on a temporary deep import, and a pass again after reverting before finishing.