Guide · Agent skill
How to use the Setup TS Deep Modules agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The setup-ts-deep-modules skill is an instruction package for an AI agent. When you ask the agent to use it, the agent installs dependency-cruiser into a TypeScript repository and writes rules so that each package exposes only its root entry-point files while its subfolders stay private. This guide explains what the skill does, how to install it, how to trigger it, and what to check before and after running it.
Quick start
- 1Download and place the skill. Download the ZIP from this page and unzip it into ~/.claude/skills/ or a project's .claude/skills/ folder. Or upload it in the Claude apps under Settings, then Capabilities, then Skills.
- 2Confirm the config file is present. Check that dependency-cruiser.config.cjs is in the unzipped folder, since SKILL.md links to it but the listed files do not include it.
- 3Commit your current work. Create a commit so any changes the agent makes to the repo, including an existing dependency-cruiser config, can be reviewed and reverted.
- 4Ask for the skill by name. Request the setup-ts-deep-modules skill in your prompt, since the skill is user-invoked and will not be picked up automatically.
- 5Review the environment checks. Let the agent detect the package manager, packages root and any existing dependency-cruiser config, and answer its questions about conventions.
- 6Verify the boundary rules. Confirm that lint:boundaries passes on the example, fails on a deliberate deep import, and passes again after the revert.
- 7Read the convention README. Open the README in the packages folder and the pointer in CLAUDE.md or AGENTS.md so future agents follow the rule.
What the skill makes the agent do
The skill turns each package in a TypeScript repo into a deep module: a lot of behaviour behind a small public interface. A package's public surface is its entry points, meaning the files at the package root. Everything in its subfolders is treated as hidden implementation.
The skill adds four rules, all set to error. Code outside a package may import only its entry points. A package's own files may import each other freely. Test files may import entry points and their own fixtures, but not any package's subfolder internals. And dependency cycles are not allowed.
The agent also adds a lint:boundaries script, folds it into your existing umbrella check that runs typecheck, creates a starter example package, and writes a README in the packages folder that explains the convention. Finally it adds a pointer to that README in CLAUDE.md or AGENTS.md so future agents find the rule.
Install the skill (ZIP or Claude app upload)
Download the ZIP of the skill from this page. Then choose one of two routes. For Claude Code, unzip it into ~/.claude/skills/ for all your projects, or into a project's .claude/skills/ folder to limit it to that repo. In the Claude apps, you can instead upload the skill under Settings, then Capabilities, then Skills.
The listed files are agents/openai.yaml and SKILL.md. SKILL.md links to a config file named dependency-cruiser.config.cjs, which is not in the file list on this page, so confirm it is inside the unzipped folder before you run the skill.
- Claude Code, all projects: unzip into ~/.claude/skills/
- Claude Code, one project: unzip into the project's .claude/skills/
- Claude apps: upload under Settings, then Capabilities, then Skills
~/.claude/skills/Trigger the skill with a clear request
This skill is user-invoked. The skill's metadata turns off automatic model invocation, so the agent is not expected to pick it up from a loose hint. Name it directly in your request so the agent knows to load it.
Good requests state the goal and the skill. For example, you can ask the agent to use the setup-ts-deep-modules skill on this repo so that packages only import through their entry points. Before the agent starts, it will check the environment: which package manager the repo uses, where the packages folder is, and whether a dependency-cruiser config already exists.
- Use the setup-ts-deep-modules skill to set up deep-module boundaries in this repo.
- Use setup-ts-deep-modules to add lint:boundaries next to typecheck.
- Apply the setup-ts-deep-modules skill and show me which existing config lines you changed.
What the agent does and how you verify it
The agent first detects your environment. It reads the lockfile to pick pnpm, yarn, bun or npm, and it uses a src/packages folder if src/ exists, otherwise packages. It installs dependency-cruiser as a devDependency and copies the config to the repo root as .dependency-cruiser.cjs, setting the packages root.
The skill's completion test is a proof step. The agent runs lint:boundaries and expects a pass on the clean example. It then adds a deliberate deep import such as import { thing } from "../lib/impl" to tests/example.test.ts, expects a failure under the rule tests-through-entrypoints, and reverts the change to see a pass again. If the deliberate violation does not fail, the skill says the rules are not wired correctly and must be fixed before finishing.
You can repeat this check yourself. Run the boundary check after the agent finishes, and confirm that the deep import is gone from the example test.
- Pass on the clean example
- Fail on the deliberate deep import, under tests-through-entrypoints
- Pass again after the deep import is reverted
depcruise src/packagesExample: what the resulting layout looks like
The skill enforces a layout where each package has root entry points, an implementation folder called lib/, and a tests/ folder. The rule itself covers any subfolder, so you never need to edit the config to add one. Packages are flat: one level of packages directly under the root, and a package may not contain another package.
Barrel files that re-export a whole subtree are discouraged. Instead, a package can expose several small entry points, such as index.ts, client.ts and server.ts.
- src/packages/<name>/index.ts is a public entry point
- src/packages/<name>/client.ts can be another entry point
- src/packages/<name>/lib/ holds hidden implementation
- src/packages/<name>/tests/ holds co-located tests and fixtures
src/packages/
<name>/
index.ts
client.ts
lib/
tests/Tips and safety notes before you run it
The skill is intrusive by design. Its own description says it may overwrite or conflict with an existing setup, though it asks to merge when a .dependency-cruiser config already exists. Read the diff before you accept it, and take a commit first so you can revert.
The skill runs scripts and uses the network, because installing dependency-cruiser requires your package manager. Review the commands the agent proposes before approving them. The skill also says it does not touch tsconfig or add path aliases, so check that those files are unchanged afterward.
Do not flatten the config's $1 back-references into separate per-package rules. The skill notes that these back-references are what let a package reach its own internals while outsiders cannot.
- Commit your work before running the skill.
- Check the diff of any existing .dependency-cruiser config.
- Expect the agent to add a lint:boundaries script and a README in the packages folder.
- Layering rules between packages are a commented stub for you to fill in.
What people use it for
- Stop accidental deep imports between packages in a src/packages folder, so that other code only uses each package's entry points.
- Give a TypeScript team a copy-me example package with a public entry point and a hidden lib/ implementation.
- Make agents discover import boundaries from a README and a pointer in CLAUDE.md or AGENTS.md before they add or import a package.
- Add a lint:boundaries check that runs in the same command as typecheck, so boundary violations are caught in the same pass.
Frequently asked questions
What is the setup-ts-deep-modules skill?
It is an agent skill that tells an AI agent how to install dependency-cruiser in a TypeScript repository and write rules that keep each package's implementation in subfolders hidden behind its root entry-point files. It also adds a lint:boundaries check and documents the convention for future agents.
What do I need to use the setup-ts-deep-modules skill?
You need Node.js, a package manager (pnpm, yarn, bun or npm), and a TypeScript repository. The skill installs dependency-cruiser as a devDependency itself. It is designed for repos that use a src/packages or packages folder layout.
Is the setup-ts-deep-modules skill free and what is its licence?
The listing states that the skill is licensed under MIT. The skill installs dependency-cruiser, which is a separate open-source tool linked from the skill's source. Check the licence files in the ZIP for the exact terms.
Where do I put the skill so Claude Code can use it?
Unzip it into ~/.claude/skills/ to make it available in all your projects, or into a project's .claude/skills/ folder to limit it to one repo. In the Claude apps, upload it under Settings, then Capabilities, then Skills.
What if the boundary check does not fail on a deep import?
The skill treats this as a failed setup. It says the rules are not wired correctly and must be fixed before finishing. Check that .dependency-cruiser.cjs has the correct PACKAGES_ROOT and that lint:boundaries runs on the packages folder.
Is this skill a good fit for a project that is not TypeScript?
No. The listing says it is not for projects that are not TypeScript or do not use a packages folder layout, because the rules are path-based and assume this structure. It is also not a good fit for repos that already use a different boundary tool or a heavily customised dependency-cruiser config.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use this skill if you have a TypeScript repo with a src/packages or packages layout, and you want agents and developers to import packages only through their entry points, with a check that proves the rules work. Skip it if your project is not TypeScript, has no packages folder, or already relies on another boundary tool or a heavily customised dependency-cruiser config, since the skill may overwrite or conflict with that setup.
Download the skill