extract-nx-lib

Extract a leaf library from the bitwarden-clients Nx monorepo.

Updated Mar 29, 2024
One-click install
npx skills add https://github.com/addisonbeck/nix --skill extract-nx-lib
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: extract-nx-lib
Source: https://github.com/addisonbeck/nix/tree/main/bobert/skills/extract-nx-lib
Command: npx skills add https://github.com/addisonbeck/nix --skill extract-nx-lib

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Orchestration playbook for extracting a leaf library from the bitwarden-clients Nx monorepo. Encodes all patterns, team composition, decision frameworks, and gotchas for taking a candidate file from libs/common (or another broad library) into its own @bitwarden/<name> Nx leaf library with a re-export shim and at least one updated consumer. Use when asked to extract a class, utility, or type from bitwarden-clients into a standalone Nx leaf lib using Task Group A.

Core Features & Use Cases

This skill provides orchestration guidance for extracting a leaf library from the bitwarden-clients Nx monorepo. A leaf library is a small, self-contained domain with zero or near-zero dependencies on other @bitwarden/* packages — it sits at the bottom of the dependency graph.

The implementation covers candidate intake, research/design decisions, scaffolding of a new Nx leaf library, barrel export checks, ADR documentation, and a coordinated PR workflow to minimize risk during isolation.

Quick Start

Run the extraction workflow to scaffold a new leaf library and move the target file into libs.

Frequently Asked Questions about extract-nx-lib

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

FAQPage Schema
How do I extract a leaf library from an Nx monorepo?

Extracting a leaf library from an Nx monorepo involves isolating a self-contained concept with minimal dependencies into a standalone package. The process includes scaffolding the new library, adding a re-export shim, and updating consumers to import from the new package.

What is a leaf library in an Nx monorepo?

A leaf library in an Nx monorepo is a small, self-contained domain package with zero or near-zero dependencies on other internal packages. It sits at the bottom of the dependency graph to ensure minimal coupling within the workspace.

How do I scaffold a new Nx library and move files from a common lib?

Scaffolding a new Nx library and moving files from a common library requires generating the standalone package, relocating the target file, and establishing a re-export shim. You then execute a two-chunk commit plan to minimize risk during isolation.

Do I need ADRs and codeowners when isolating a standalone Nx package?

Yes, ADRs and codeowners are required when isolating a standalone Nx package. The extraction workflow ensures Architecture Decision Records, barrel-export checks, and codeowners are produced and followed to maintain governance during library extraction.

What is the best way to update consumers when extracting an Nx library?

The best way to update consumers when extracting an Nx library is to use a re-export shim and a coordinated PR workflow. This ensures existing imports transition smoothly to the new @bitwarden package while minimizing risk during the two-chunk commit isolation.

When should I not extract a file into a standalone Nx leaf library?

You should not extract a file into a standalone Nx leaf library if the target concept has heavy dependencies on other internal packages. Leaf libraries are specifically designed for small, self-contained domains with zero or near-zero dependencies.