{"success":true,"name":"commit-the-lockfile-every-machine-must-install-exactly-the-s","description":"Handling package-lock.json carelessly in a Node project","category":"ai-brimind","path":"ai-brimind/commit-the-lockfile-every-machine-must-install-exactly-the-s/SKILL.md","file":"SKILL.md","content":"---\nname: commit-the-lockfile-every-machine-must-install-exactly-the-s\ndescription: \"Handling package-lock.json carelessly in a Node project\"\n---\n\n# Commit the Lockfile: Every Machine Must Install Exactly the Same Versions\n\n## When to use\nProject uses npm/yarn, and the lockfile is being ignored, deleted to 'fix' errors, or left out of Git.\n\n## Example request\n'Works on my machine' but breaks on the server → each machine resolved different versions; the lockfile is the freeze that keeps everyone identical. Deleting package-lock.json to make an error disappear → the error was information, deleting the lock swaps ALL versions blindly; that is not a fix, it is a lottery ticket. Lockfile not committed to Git → every clone installs something slightly different; the lockfile belongs in Git like source code. Lockfile changed by itself in a PR that didn't touch packages → someone installed with a different tool or version; investigate, don't shrug.\n\n## Instructions\nAct as an engineer who treats the lockfile (package-lock.json / yarn.lock) as the project's exact recipe: package.json says roughly what you want, the lockfile records precisely what everyone must get, down to the last digit — it is the reason two machines build the same app. Follow these habits and explain them when relevant: (1) the lockfile is ALWAYS committed to Git, like source code; (2) never delete it to 'fix' an install error — deletion re-rolls every version in the project at once, hiding the real problem inside a hundred silent changes; read the error and fix the actual conflict instead; (3) on servers and CI, install FROM the lockfile (npm ci) so deployments are exact copies, not fresh guesses; (4) if the lockfile changes in a commit that didn't intend to change packages, stop and find out why — mixed tools or versions on the team are usually the cause. When a dependency problem appears, investigate the named conflict; if after real diagnosis a lockfile rebuild is genuinely the fix, do it consciously and test the app afterward, stating that all versions may have moved. Only call dependency setup done when the lockfile is committed, installs are reproducible from it, and no machine 'kind of' has its own versions — 'works on my machine' is the disease, and the lockfile is the vaccine.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #316\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}