setup-ts-deep-modules

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

2|Updated Jun 21, 2026
One-click install
npx skills add https://github.com/IsKenKenYa/skills --skill setup-ts-deep-modules-iskenkenya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: setup-ts-deep-modules
Source: https://github.com/IsKenKenYa/skills/tree/main/skills/in-progress/setup-ts-deep-modules
Command: npx skills add https://github.com/IsKenKenYa/skills --skill setup-ts-deep-modules-iskenkenya

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires dependency-cruiser.

What problem does it solve? TypeScript monorepos often leak internal implementation details through deep imports, making packages hard to refactor and reason about. This Skill installs and configures dependency-cruiser so every package becomes a deep module: only root entry-point files are public, and everything in subfolders stays private. ## Core Features & Use Cases - Boundary rule enforcement: Installs four dependency-cruiser rules (entry-point boundary, intra-package freedom, tests-through-entrypoints, no cycles) that fail the build on deep imports. - 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 without overwriting it. - Proof the rules bite: Scaffolds an example package, then verifies the config passes on clean code, fails on a deliberate deep import, and passes again after revert. - Use Case: You maintain a pnpm monorepo where app code keeps importing packages/billing/lib/internal-utils directly. Run this Skill to wire lint:boundaries into your check script so such imports fail CI, and document the convention in src/packages/README.md. ## Quick Start Set up dependency-cruiser deep-module boundary rules for this TypeScript repo and prove they fail on a deep import.

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 prevent deep imports into package internals with dependency-cruiser?

Define a forbidden rule whose from-path excludes the package and whose to-path matches anything nested inside a package subfolder. The config uses path-depth patterns with $1 back-references so a package can reach its own internals while outsiders cannot.

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

Yes. The Skill detects the package manager from lockfiles (pnpm-lock.yaml, yarn.lock, bun.lockb) and uses it for install and script commands. The boundary rules themselves are path-based and package-manager agnostic.

Can I keep an existing dependency-cruiser config when adding boundary rules?

Yes. If a .dependency-cruiser.* file already exists, the Skill merges the four forbidden rules and options into it instead of overwriting, and reports what was added.

Why does my dependency-cruiser boundary rule not fail on violations?

A config that never fails is usually miswired paths or a wrong packages root. The Skill's completion check deliberately adds a deep import to the example test, confirms lint:boundaries fails with tests-through-entrypoints, then reverts and confirms it passes.

Should packages use a single index.ts barrel or multiple entry points?

The convention treats every root file of a package as a public entry point, so packages can expose several small entry points like index.ts, client.ts, and server.ts. Barrel files that re-export whole subtrees are explicitly discouraged.