ui-dev
This skill MUST be used whenever the task involves UI development, renderer code changes, adding or modifying components,…
This skill MUST be used whenever the task involves adding, installing, or upgrading an npm package/library/dependency in this project. Use when the user asks to "add a library", "install <package>", "use <package>", "add a dependency", "bump/upgrade a package", or any change to
Claude Code
$ npx -y skills add elirantutia/vibeyard --skill add-npm-dependency --agent claude-code
Codex
$ npx skills add elirantutia/vibeyard --skill add-npm-dependency -a codex -y
Cursor
$ npx skills add elirantutia/vibeyard --skill add-npm-dependency -a cursor -y
Gemini CLI
$ npx skills add elirantutia/vibeyard --skill add-npm-dependency -a gemini-cli -y
GitHub Copilot
$ npx skills add elirantutia/vibeyard --skill add-npm-dependency -a github-copilot -y
OpenCode
$ npx skills add elirantutia/vibeyard --skill add-npm-dependency -a opencode -y
Windsurf
$ npx skills add elirantutia/vibeyard --skill add-npm-dependency -a windsurf -y
name: add-npm-dependency description: This skill MUST be used whenever the task involves adding, installing, or upgrading an npm package/library/dependency in this project. Use when the user asks to "add a library", "install <package>", "use <package>", "add a dependency", "bump/upgrade a package", or any change to package.json dependencies. Covers the latest-version policy, esbuild renderer bundling, manual CSS copy, native module rebuilds, and the three build targets.
This is an Electron app with **three separate build targets** (main, preload, renderer) and a few non-obvious bundling rules. Adding a dependency the wrong way silently breaks CSS, native modules, or the renderer bundle. Follow this guide every time.
**Always install the newest published version. Never hand-edit `package.json` to set or downgrade a version.**
npm install <pkg>@latest # runtime dependency npm install -D <pkg>@latest # dev / build-only tool (types, bundlers, test libs)
This determines every gotcha that follows.
| Target | Source dirs | How it's built | What's allowed | |--------|-------------|----------------|----------------| | **Renderer** | `src/renderer/**` | Bundled by **esbuild** into one IIFE (`build:renderer`) | Plain JS/TS deps only. **No Node built-ins, no native modules.** | | **Main** | `src/main/**`, `src/shared/**` | `tsc` → CommonJS (`dist/main/`) | Any Node dep, including native modules. Resolved via `require` at runtime against `node_modules` — **not bundled**. | | **Preload** | `src/preload/**`, `src/shared/**` | `tsc` → CommonJS (`dist/preload/`) | Runs in Node/Electron context; same rules as main. |
esbuild only has the `.ts` loader configured. **It will not bundle any CSS the package ships.** If the library needs a stylesheet to work (the way `gridstack` and `@xterm/xterm` do):
1. Add a copy step in `scripts/copy-assets.js` — copy from `node_modules/<pkg>/.../file.css` to `dist/renderer/vendor/<file>.css`. Mirror the existing **gridstack** precedent in that file. 2. Add a `<link rel="stylesheet" href="vendor/<file>.css">` to `src/renderer/index.html` (gridstack/xterm links are already there as examples).
If you skip this, the JS bundles fine but the component renders unstyled. (CLAUDE.md documents this: "esbuild has no CSS loader" — gridstack CSS is copied manually.)
Examples already in the repo: `better-sqlite3`, `node-pty`.
There is **no hot reload** — every change needs a rebuild.
npm run build # must pass: tsc main + tsc preload + esbuild renderer + copy-assets npm test # Vitest suite
Then confirm the dependency actually works end to end:
electron-builder packages only `dist/main/**`, `dist/preload/**`, `dist/renderer/**`:
**Do:**
**Don't:**
$ARGUMENTS
This skill MUST be used whenever the task involves UI development, renderer code changes, adding or modifying components,…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.