- For navigating/exploring the workspace, invoke the
nx-workspaceskill first - it has patterns for querying projects, targets, and dependencies - When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through
nx(i.e.nx run,nx run-many,nx affected) instead of using the underlying tooling directly - Prefix nx commands with the workspace's package manager (e.g.,
pnpm nx build,npm exec nx test) - avoids using globally installed CLI - You have access to the Nx MCP server and its tools, use them to help the user
- For Nx plugin best practices, check
node_modules/@nx/<plugin>/PLUGIN.md. Not all plugins have this file - proceed without it if unavailable. - NEVER guess CLI flags - always check nx_docs or
--helpfirst when unsure
- For scaffolding tasks (creating apps, libs, project structure, setup), ALWAYS invoke the
nx-generateskill FIRST before exploring or calling MCP tools
- USE for: advanced config options, unfamiliar flags, migration guides, plugin configuration, edge cases
- DON'T USE for: basic generator syntax (
nx g @nx/react:app), standard commands, things you already know - The
nx-generateskill handles generator discovery internally - don't call nx_docs just to look up generator syntax
Project guidance for any AI coding agent or contributor. It is tool-neutral —
Claude Code reads it via CLAUDE.md (which imports this file); other agent tools
(Cursor, Codex, Aider, Zed, …) read AGENTS.md directly.
React Mosaic (react-mosaic-component) is a tiling window manager for React
16–19: a drag-and-drop tree of resizable, rearrangeable panels. Full TypeScript,
Apache-2.0, currently 7.0.0-beta0. It's an Nx monorepo built with Vite + tsup
(see the Nx guidelines above for how to run tasks).
- Library (primary focus):
libs/react-mosaic-component/ - Docs site + live demo (Docusaurus):
apps/website/
- The tree is immutable. Never mutate a
MosaicNodein place — go throughupdateTreeand thecreate*Updatehelpers. In-place mutation is the #1 cause of "my change isn't showing up". - Use the utilities, not hand-rolled traversal.
util/mosaicUtilities.tsandutil/mosaicUpdates.tsare well-tested and handle the edge cases. - Narrow with type guards (
isSplitNode,isTabsNode) before touching node-specific fields; anything else is a leaf. - Change state through context actions (
mosaicActions/mosaicWindowActions), not by rewriting the tree yourself. - Paths are numeric index arrays (
[0, 1]), not strings. - Read before you edit, match the surrounding patterns, and add a co-located
*.spectest with every change — cover empty, single-node, and deeply-nested trees.
- TypeScript strict, no
any(useunknown); explicit param/return types; components are generic over the panel key<T>. - Functional components + hooks; no side effects in render; stabilize
callbacks with
useCallback; JSDoc on public APIs. - Naming: PascalCase components/types, camelCase utilities, UPPER_SNAKE_CASE constants. One component per file, named after it.
- Styles: LESS with BEM; theme via CSS variables; optional Blueprint theme.
- Anything user-facing must be exported from
libs/react-mosaic-component/src/index.ts. - Commits: conventional-commit format, focused and atomic. Branch off
master; PRs reference the issue, describe the change, and attach screenshots for any UI change.
- Architecture — the MosaicNode tree, key files, the utilities & component API, theming, performance, legacy migration.
- Development — commands, testing, the build system, git/PR workflow, CI, and troubleshooting.
npm install # install
npm start # docs site + hot-reloading demo
npm test # all tests
npm run lint # lint
npm run build:lib # build the library
npm run build-lib:check # type-check only (tsc --noEmit)