nx-package-restructure

Restructure Nx monorepo packages into grouped directories while preserving project graphs.

Updated Jan 1, 2026
One-click install
npx skills add https://github.com/ViewableGravy/better-ecs --skill nx-package-restructure
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nx-package-restructure
Source: https://github.com/ViewableGravy/better-ecs/tree/main/.github/skills/nx-package-restructure
Command: npx skills add https://github.com/ViewableGravy/better-ecs --skill nx-package-restructure

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the complexity of reorganizing packages within an Nx monorepo, ensuring that project dependencies, build configurations, and workspace linking remain valid throughout the restructuring process.

Core Features & Use Cases

  • Monorepo Package Management: Facilitates the strategic movement and splitting of packages into logical groups (e.g., foundation, features, tooling).
  • Dependency Integrity: Maintains the integrity of Nx project graphs, TypeScript project references, and workspace package linking.
  • Use Case: When migrating from a flat packages/* structure to a more organized packages/foundation/*, packages/features/* layout, this Skill provides a step-by-step guide to update configurations and dependencies.

Quick Start

Use the nx-package-restructure skill to migrate the 'engine' package to the 'packages/foundation' directory.

Frequently Asked Questions about nx-package-restructure

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

FAQPage Schema
How do I restructure Nx monorepo packages into grouped directories?

Restructuring Nx monorepo packages involves moving packages into grouped directories like foundation, features, and tooling. The process provides a step-by-step guide to update configurations and dependencies while relocating or splitting packages.

How do I maintain TypeScript project references when moving Nx packages?

To maintain TypeScript project references when moving Nx packages, you must update workspace linking and configuration paths. The process ensures that TypeScript references and the Nx project graph remain valid throughout package relocation.

Why does my Nx project graph break when I move packages to a new directory?

Your Nx project graph breaks when moving packages because internal dependencies and workspace linking paths become invalid. Addressing common failure modes in Nx graph processing during package relocation ensures the project graph stays valid.

Can I migrate an Nx package to a new folder without breaking Vite configuration?

Yes, you can migrate an Nx package to a new folder without breaking Vite configuration. The restructuring process specifically addresses common failure modes in Vite configuration to ensure build tooling remains valid.

What is the best way to split Nx packages into foundation and features groups?

The best way to split Nx packages into foundation and features groups is to follow a strategic migration guide. This ensures you update dependencies and configurations correctly when moving from a flat packages structure to a grouped layout.