lib-layers-new

Guides creating, renaming, and removing Nx workspace libraries with generator, tags, and aliases.

1|Updated Jan 14, 2024
One-click install
npx skills add https://github.com/Eyhenij/rt-tools --skill lib-layers-new-eyhenij
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lib-layers-new
Source: https://github.com/Eyhenij/rt-tools/tree/main/.claude/skills/lib-layers-new
Command: npx skills add https://github.com/Eyhenij/rt-tools --skill lib-layers-new-eyhenij

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Creating or removing libraries in an Nx monorepo by hand leads to broken test runs, stale build graphs, and inconsistent tags and aliases. This Skill encodes the exact procedure so every lib follows the workspace's layered architecture rules. ## Core Features & Use Cases - Generator-based creation: Uses node tools/generate-domain-lib.mjs instead of bare nx g so project.json, tsconfig.json, vitest.config.mts (with passWithNoTests), and the barrel are laid out correctly. - Manual wiring checklist: Covers the ESLint boundary tag, the tsconfig.base.json alias, and the lib README that must be added by hand. - Safe removal and moves: Explains why git rm -r must be followed by rm -rf, and why a moved lib requires npx nx reset to clear the stale project graph cache. - Use Case: When adding a new domain layer to an Nx workspace, follow this Skill to scaffold the lib, register its tag and alias, then verify with npm run check:layers. ## Quick Start Ask the assistant to create a new library in the Nx workspace following the lib-layers pattern and verify it with the layers check.

Frequently Asked Questions about lib-layers-new

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a new library in an Nx monorepo correctly?

Run the custom generator `node tools/generate-domain-lib.mjs` instead of bare `nx g`. It lays out project.json, tsconfig.json, vitest.config.mts with passWithNoTests, and the barrel, then add the ESLint boundary tag, tsconfig alias, and README by hand.

Why does nx run-many -t test fail with 'No test files found'?

A lib created with bare `nx g` gets a vitest config without `passWithNoTests`, so a lib with no tests yet fails the shared test run. The custom generator includes this option, preventing the failure.

How do I safely remove a library from an Nx workspace?

Run `git rm -r` on the lib path followed by `rm -rf` on the same path, because git rm leaves node_modules/.vite behind and the layout check sees a ghost domain. Then remove its tag, alias, and any boundary rights lines referencing it.

Why is my moved Nx library not detected after mv?

The Nx project graph caches the old path, so a directory moved with `mv` is not recounted and the run silently skips it. Run `npx nx reset` after moving to rebuild the graph cache.

When should I not create a new library for shared code?

Do not create a lib when there is nothing to fill its feature, data-access, or api layers with. Shared mechanics belong in the family base lib on the frontend or the util layer on the backend, not in a new domain.