setup-ts-deep-modules

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

Updated Jun 28, 2026
One-click install
npx skills add https://github.com/AO-HyS/aohys.com --skill setup-ts-deep-modules-ao-hys
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: setup-ts-deep-modules
Source: https://github.com/AO-HyS/aohys.com/tree/main/.agents/skills/setup-ts-deep-modules
Command: npx skills add https://github.com/AO-HyS/aohys.com --skill setup-ts-deep-modules-ao-hys

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires dependency-cruiser.

What problem does it solve? TypeScript monorepos often leak internal implementation details across packages, making refactors risky and interfaces unclear. 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 enforcement: Installs four error-level dependency-cruiser rules covering entry-point boundaries, intra-package freedom, tests-through-entrypoints, and no dependency cycles. - Verified setup: Scaffolds an example package and proves the rules bite by observing a pass, an intentional failure on a deep import, then a pass again. - Convention documentation: Writes a README in the packages folder and links it from CLAUDE.md or AGENTS.md so agents discover the boundary rule. - Use Case: A team adopting a packages-based monorepo wants to stop deep imports like ../../other-package/lib/internal from creeping in; this Skill installs the config, the lint:boundaries script, and the docs in one pass. ## 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 code. This Skill installs the 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 anything in subfolders like lib/ or tests/ is private, enforced by path-depth rules rather than a single barrel index.

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

Yes. The setup detects the package manager from the lockfile (pnpm-lock.yaml, yarn.lock, bun.lockb, else npm) and uses it for installing dependency-cruiser and running the lint:boundaries script.

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

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

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

The rules only bite if PACKAGES_ROOT in .dependency-cruiser.cjs matches the actual packages directory and lint:boundaries runs depcruise against it. The setup verifies this by adding a temporary deep import and confirming the check fails before reverting it.