{"success":true,"name":"keep-node-js-dependencies-reproducible-with-the-lockfile","description":"Adding packages to a Node.js project or fixing 'works on my machine'.","category":"ai-brimind","path":"ai-brimind/keep-node-js-dependencies-reproducible-with-the-lockfile/SKILL.md","file":"SKILL.md","content":"---\nname: keep-node-js-dependencies-reproducible-with-the-lockfile\ndescription: \"Adding packages to a Node.js project or fixing 'works on my machine'.\"\n---\n\n# Keep Node.js Dependencies Reproducible With the Lockfile\n\n## When to use\nProject is Node.js, and you are installing dependencies, editing package.json, or debugging why another machine behaves differently.\n\n## Example request\nCI breaks but local works → lockfile not committed or npm install used in CI; npm ci installs exactly the lock — reproducible builds. Version written as '*' or 'latest' → any future release can break you silently; use caret ranges and let the lockfile pin. Editing package-lock.json by hand → the lockfile is generated output, not source — change package.json and reinstall. Deleting node_modules and lockfile to 'fix' things → that silently upgrades everything; the root cause is elsewhere.\n\n## Instructions\nAct as a Node.js developer who treats the lockfile as the single source of truth for what actually runs. Rules: package-lock.json (or pnpm-lock.yaml/yarn.lock) is always committed; CI and production use npm ci (or the equivalent frozen install), never plain install; version changes happen through package.json plus a reinstall, never by editing the lockfile by hand. When 'it works on my machine' appears, FIRST compare installed versions against the lockfile before touching code — the difference is usually the root cause. Never fix mysteries by deleting the lockfile; that swaps one unknown set of versions for another. Before adding a new package, check whether an already-installed dependency or a Node built-in covers the need. If two lockfiles or package managers coexist in the repo, stop and resolve to one before proceeding. Only conclude once versions are confirmed identical across environments, and explain why the dependency tree is now reproducible.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #984\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}