Add Npm Dependency logo

Add Npm Dependency

CommunityPopular
elirantutia
add-npm-dependency

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.

Overview

Publisherelirantutia
Repositoryvibeyard
Skill nameadd-npm-dependency
Stars
1.4K
Forks
173
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by elirantutia on GitHub. Read the source before you install it.

Installation

Install the Add Npm Dependency AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/elirantutia/vibeyard/tree/main/.claude/skills/add-npm-dependency
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/elirantutia/vibeyard.git /tmp/vibeyard
mkdir -p .claude/skills
cp -r /tmp/vibeyard/.claude/skills/add-npm-dependency .claude/skills/add-npm-dependency
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Add Npm Dependency in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Add Npm Dependency on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Add Npm Dependency is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Adding an npm Library

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.

Golden Rule: install the latest, caret-pinned

Always install the newest published version. Never hand-edit package.json to set or downgrade a version.

bash
npm install <pkg>@latest          # runtime dependency
npm install -D <pkg>@latest       # dev / build-only tool (types, bundlers, test libs)
  • This records a caret range ^x.y.z — the repo convention (every dep in package.json uses ^). Leave it as a caret range.
  • package-lock.json is committed and gets updated by the install. Both package.json and package-lock.json are part of your change — stage both.
  • Use npm only (the lockfile is package-lock.json — not yarn, not pnpm).
  • Node v24 is pinned in .nvmrc; engines.node is >=18. Run nvm use first if needed.

Step 1 — Decide which build target consumes the package

This determines every gotcha that follows.

TargetSource dirsHow it's builtWhat's allowed
Renderersrc/renderer/**Bundled by esbuild into one IIFE (build:renderer)Plain JS/TS deps only. No Node built-ins, no native modules.
Mainsrc/main/**, src/shared/**tsc → CommonJS (dist/main/)Any Node dep, including native modules. Resolved via require at runtime against node_modules — not bundled.
Preloadsrc/preload/**, src/shared/**tsc → CommonJS (dist/preload/)Runs in Node/Electron context; same rules as main.
  • A pure JS/TS library used in the UI (like marked, dompurify, gridstack, @xterm/*) just gets imported in renderer code and esbuild bundles it. Nothing else to do (except CSS — see Step 2).
  • A library that touches the filesystem, spawns processes, or has a .node binary belongs in main/preload only.

Step 2 — CSS / static assets gotcha (esbuild has NO CSS loader)

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.)

Step 3 — Native module gotcha (.node binaries)

Examples already in the repo: better-sqlite3, node-pty.

  • Must be a regular dependency (never imported from the renderer — main/preload only).
  • npm install triggers the postinstall hook → electron-builder install-app-deps, which rebuilds the .node binary against the pinned Electron ABI. If the module fails to load at runtime ("NODE_MODULE_VERSION mismatch"), re-run npm install and check the postinstall output.
  • If the binary can't load from inside the asar archive, add the package to electron-builder's asarUnpack in package.json (precedent: **/node_modules/better-sqlite3/**).
  • Native modules must compile on macOS, Linux, and Windows — CI builds all three. Flag the cross-platform risk to the user; see src/main/platform.ts for the platform-detection helpers.

Step 4 — Types

  • If the package ships its own type declarations, you're done.
  • Otherwise add the community types as a devDependency: npm install -D @types/<pkg>@latest (precedent: @types/better-sqlite3, @types/dompurify, @types/picomatch).

Step 5 — Verify (required, not optional)

There is no hot reload — every change needs a rebuild.

bash
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:

  • Renderer / UI / CSS dep: npm start, and visually confirm the feature renders and styles load.
  • Native / main dep: launch the app and exercise the feature that uses it.

Step 6 — Packaging sanity check

electron-builder packages only dist/main/**, dist/preload/**, dist/renderer/**:

  • Renderer deps are safe — they're bundled into dist/renderer/index.js.
  • Main/preload deps resolve from the packaged production node_modules at runtime, so they must be in dependencies (not devDependencies). Keep build-only tooling (bundlers, types, test libs) in devDependencies.

Do / Don't

Do:

  • npm install <pkg>@latest, leave the caret range, commit package.json + package-lock.json.
  • Pick the right target (renderer vs main/preload) before importing.
  • Add the CSS copy step + <link> for any styled renderer library.
  • Run npm run build and npm test before declaring done.

Don't:

  • Pin an exact version or hand-edit a version in package.json.
  • Import Node built-ins or native modules from the renderer.
  • Forget the scripts/copy-assets.js step for CSS (esbuild won't bundle it).
  • Put a native module in devDependencies or assume it works without the postinstall rebuild.

$ARGUMENTS

Frequently asked questions

What does the Add Npm Dependency AI skill do?

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.

Why use Add Npm Dependency on TypingMind?

Because you install it once and use it with any model. Add Npm Dependency is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Add Npm Dependency in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/elirantutia/vibeyard/tree/main/.claude/skills/add-npm-dependency. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Add Npm Dependency?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Add Npm Dependency?

As many as you like. As long as a model supports skills, you can use Add Npm Dependency with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Add Npm Dependency AI skill free?

Yes. It is published on GitHub by elirantutia under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇