Agent skill · software engineering · mattpocock

setup-ts-deep-modules

Wire dependency-cruiser into a TypeScript repo so each package is a deep module, with implementation hidden in subfolders and reachable only through its entry-point files. User-invoked.

Why this skill is useful

Adds specific configuration and rules for using dependency-cruiser in a TypeScript repo, which the AI wouldn't reliably generate on its own.

What it needs

Requires dependency-cruiser installed locally. About 4k tokens when loaded. Last updated 2026-08-06. 207,363 stars on the source repository.

What this skill does

Setup TS Deep Modules Make every package in this repo a deep module: a lot of behaviour behind a small interface. A package's public surface is its entry points (the files at the package root), and everything in its subfolders is hidden. This skill installs dependency-cruiser and the rules that make the entry points the only way in, then proves the rules bite. For the vocabulary (deep module, interface, seam, depth), call the Skill tool with "codebase-design" and use its language throughout. The shape this enforces The public surface is the package's root files, not one designated index.ts. By convention implementation lives in lib/ and tests in tests/, giving every package the same two-folder shape. The rule itself is general, though: anything in any subfolder is private, so you never extend the config to add a folder. Four rules, all error: 1. Entry-point boundary: code outside a package (app code or another package) may import only that package's entry points (its root files), never anything in its subfolders. 2. Intra-package freedom: a package's own files import each other freely. 3. Tests through the entry points: files under <pkg>/tests/ may import any package's entry points and their own tests/ fixtures, but never any package's subfolder internals (not even their own). Integration tests across packages are fine; deep imports are not. 4. No cycles: no dependency cycles. Entry points, not a barrel. Because the public surface is every root file, a package can expose several small entry points (index.ts, client.ts, server.ts) instead of funnelling everything through one giant index.ts. Barrel files that re-export a whole subtree are discouraged; keep entry points small and hide implementation in subfolders. Layering (which packages may depend on which) is a different concern and is left as a commented stub in the config for this repo to fill in. Steps 1. Detect the environment Package manager: pnpm-lock.yaml → pnpm, yarn.lock → yarn, bun.lockb → bun, else npm. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills mattpocock/setup-ts-deep-modules

View the source on GitHub

Browse the @skills marketplace