setup-ts-deep-modules

Configures dependency-cruiser to enforce entry-point-only imports across TypeScript packages.

Updated Jul 30, 2026
One-click install
npx skills add https://github.com/j172/bid --skill setup-ts-deep-modules-j172
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: setup-ts-deep-modules
Source: https://github.com/j172/bid/tree/main/agent/skills/setup-ts-deep-modules
Command: npx skills add https://github.com/j172/bid --skill setup-ts-deep-modules-j172

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires dependency-cruiser.

What problem does it solve? TypeScript monorepos often leak internals: consumers deep-import files from inside other packages, making refactors risky and module boundaries meaningless. This Skill wires dependency-cruiser into a repo so every package becomes a deep module — only its root entry-point files are importable from outside, and everything in subfolders stays private. ## Core Features & Use Cases - Boundary enforcement: Installs four dependency-cruiser rules (entry-point boundary from app code, entry-point boundary across packages, tests-through-entrypoints, no-circular) plus a tests-folder privacy rule, all at error severity. - Environment detection: Detects the package manager (pnpm, yarn, bun, npm), the packages root (src/packages or packages), and merges into any existing dependency-cruiser config instead of overwriting it. - Verified setup: Scaffolds an example package with a root entry point, hidden lib/ implementation, and tests, then proves the rules bite by observing a pass, a failure on a deliberate deep import, and a pass again. - Use Case: A team adopting a packages-based monorepo wants each package to expose small entry points (index.ts, client.ts) while hiding implementation in lib/. The Skill installs the config, adds a lint:boundaries script to the existing check command, and documents the convention in the packages README and agent-instructions file. ## 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 module 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 config, adds a lint:boundaries script, and folds it into the repo's existing check command so violations fail CI.

How to restrict imports to package entry points with dependency-cruiser?

Define a forbidden rule whose target matches anything nested inside a package subfolder while leaving root files importable. Group back-references ($1) let a package reach its own internals while other packages and app code can only use its entry points.

Does dependency-cruiser work with pnpm, yarn, or bun monorepos?

Yes. The Skill detects the package manager from the lockfile (pnpm-lock.yaml, yarn.lock, bun.lockb, or npm) and uses it for installation and scripts. The config itself is package-manager agnostic and resolves .ts, .tsx, .js, and .jsx files.

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

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

Why does dependency-cruiser not fail on deep imports after setup?

The rules are not wired correctly if a deliberate deep import passes. The Skill's verification step requires observing a pass on clean code, a failure on a temporary deep import, and a pass again after reverting; if the failure never occurs, the config paths or PACKAGES_ROOT need fixing.