---
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
title: pnpm
canonical_url: https://skilld.dev/gh/alpha-innovation-labs/opennexus-rs/pnpm
last_updated: 2026-10-06T18:42:02.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install alpha-innovation-labs/opennexus-rs/pnpm`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/pnpm`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/alpha-innovation-labs/opennexus-rs/pnpm) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/pnpm`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/pnpm --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/pnpm --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# pnpm Workspace Rules (Hardlink + Bun Runtime)

This file defines the required pnpm workspace conventions for this repo.

## Core Principles

1. Use `pnpm` as the only dependency manager and lockfile authority.
2. Use Bun for all runtime script execution (`bun --cwd <package-dir> run <script>`).
3. Keep workspace code inside `src/` for every app and package.
4. Treat `apps/` as runnable runtime projects.
5. Treat `packages/` as reusable libraries with non-runnable code.
6. All installed dependencies in `node_modules` must 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)

1. Execute scripts with Bun from the target workspace package.
2. Standard form: `bun --cwd <package-dir> run <script>`.
3. Do not use `node`, `npm`, or `pnpm run` as the runtime execution interface.
4. Keep `pnpm` focused on install/add/remove/update and workspace dependency graph operations.

## Dependency Storage Policy (Hardlink Mandatory)

1. `package-import-method=hardlink` is required.
2. `node-linker=isolated` is required.
3. `symlink=true` is required.
4. Do not use hoisted layouts or copied `node_modules` trees.
5. Do not introduce tooling that vendors full dependency sources into workspace packages.

Required `.npmrc` baseline:

```ini
package-import-method=hardlink
node-linker=isolated
symlink=true
```

## Apps vs Packages Rules

1. `src/apps/*` may define runnable scripts such as `dev`, `start`, or platform runtime commands.
2. `src/packages/*` must not be treated as deployable runtime apps.
3. Library packages should expose buildable/importable artifacts and typed APIs.
4. If a package needs executable tooling, keep it explicit and separate from app runtime concerns.

## Frontend Package Visualization (Storybook)

1. Any frontend/UI library under `src/packages/*` must provide Storybook coverage for visual components.
2. Stories should live with source (for example `src/**/*.stories.tsx`) or another clearly documented package-local convention.
3. Storybook development and build commands must be executed with Bun runtime commands.

## Validation Checklist

1. `pnpm-workspace.yaml` includes intended `src/apps/*` and `src/packages/*` workspaces.
2. Each workspace package has a `src/` folder.
3. `.npmrc` enforces hardlink + isolated linker + symlink settings.
4. Runtime commands are invoked via Bun command form.
5. UI libraries in `src/packages/*` include Storybook stories for visual review.
