name: pnpm description: This skill should be used every time you work on pnpm workspace structure, dependency management, or runtime command execution in this repository. compatibility: opencode
pnpm Workspace Rules (Hardlink + Bun Runtime)
This file defines the required pnpm workspace conventions for this repo.
Core Principles
- Use
pnpmas the only dependency manager and lockfile authority. - Use Bun for all runtime script execution (
bun --cwd <package-dir> run <script>). - Keep workspace code inside
src/for every app and package. - Treat
apps/as runnable runtime projects. - Treat
packages/as reusable libraries with non-runnable code. - All installed dependencies in
node_modulesmust come from pnpm links/hardlinks, never copied vendor trees.
Workspace Layout
src/
apps/
<app-name>/
src/
package.json
packages/
<pkg-name>/
src/
package.json
pnpm-workspace.yaml
.npmrc
pnpm-lock.yaml
Folder Semantics
src/apps/*: runtime entrypoints and deployable applications.src/packages/*: shared libraries, utilities, SDKs, design systems, and other non-runnable modules.src/: required location for implementation code in both apps and packages.
Runtime Policy (Bun Mandatory)
- Execute scripts with Bun from the target workspace package.
- Standard form:
bun --cwd <package-dir> run <script>. - Do not use
node,npm, orpnpm runas the runtime execution interface. - Keep
pnpmfocused on install/add/remove/update and workspace dependency graph operations.
Dependency Storage Policy (Hardlink Mandatory)
package-import-method=hardlinkis required.node-linker=isolatedis required.symlink=trueis required.- Do not use hoisted layouts or copied
node_modulestrees. - Do not introduce tooling that vendors full dependency sources into workspace packages.
Required .npmrc baseline:
package-import-method=hardlink
node-linker=isolated
symlink=true
Apps vs Packages Rules
src/apps/*may define runnable scripts such asdev,start, or platform runtime commands.src/packages/*must not be treated as deployable runtime apps.- Library packages should expose buildable/importable artifacts and typed APIs.
- If a package needs executable tooling, keep it explicit and separate from app runtime concerns.
Frontend Package Visualization (Storybook)
- Any frontend/UI library under
src/packages/*must provide Storybook coverage for visual components. - Stories should live with source (for example
src/**/*.stories.tsx) or another clearly documented package-local convention. - Storybook development and build commands must be executed with Bun runtime commands.
Validation Checklist
pnpm-workspace.yamlincludes intendedsrc/apps/*andsrc/packages/*workspaces.- Each workspace package has a
src/folder. .npmrcenforces hardlink + isolated linker + symlink settings.- Runtime commands are invoked via Bun command form.
- UI libraries in
src/packages/*include Storybook stories for visual review.