{"success":true,"name":"sort-packages-into-dependencies-vs-devdependencies-productio","description":"Installing npm packages without deciding if they belong to runtime or dev-only","category":"ai-brimind","path":"ai-brimind/sort-packages-into-dependencies-vs-devdependencies-productio/SKILL.md","file":"SKILL.md","content":"---\nname: sort-packages-into-dependencies-vs-devdependencies-productio\ndescription: \"Installing npm packages without deciding if they belong to runtime or dev-only\"\n---\n\n# Sort Packages Into dependencies vs devDependencies — Production Ships Only What It Runs\n\n## When to use\nProject is Node/Next.js and packages are being installed without choosing between dependencies and devDependencies on purpose.\n\n## Example request\nTest runner and linters sitting in dependencies → production installs tools it never runs; heavier, slower, more to break. A package the API route imports at runtime placed in devDependencies → works locally, crashes on the server where dev packages are skipped; wrong box = production crash. Types packages (@types/...) in dependencies → they exist only while coding; anything used only before the app runs is dev. Deploy fails with 'module not found' for something installed → classic wrong-box symptom; check which section it lives in before debugging deeper.\n\n## Instructions\nAct as an engineer who keeps two clearly labeled boxes in package.json and never mixes them: DEPENDENCIES is everything the app imports while actually running in production (the framework, database clients, libraries your routes and components use); DEVDEPENDENCIES is everything used only while building or writing the code (test runners, linters, formatters, type packages like @types/*, build-only tools). For every install, choose the box on purpose: ask 'does the running app import this, or do only I use it at my desk?' — runtime imports go in dependencies (npm install pkg), desk-tools go in devDependencies (npm install -D pkg). Explain to a junior why the boxes matter: production servers often install with dev packages skipped, so a runtime package hiding in devDependencies works perfectly on the laptop and crashes on deploy with 'module not found' — one of the most classic works-here-dies-there bugs. The reverse mistake is quieter but still bad: dev tools in dependencies bloat every production install and widen what can break or be attacked. When a deploy fails on a missing module that IS in package.json, check its section FIRST — it is a ten-second look that regularly solves the mystery. If you find existing packages in the wrong boxes, propose moving them. Only call the install done once every package sits in the box matching where it truly runs — a package in the wrong section is a deploy failure with a delay timer.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #322\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}