how do you prevent package dependency bloat when building with AI?
by•
when asking AI tools to solve specific coding challenges, their default solution often involves suggesting new third-party libraries or npm packages rather than using existing utility functions in the repo.
over time, small utility packages add up, increasing bundle size and creating additional security maintenance tasks for the team.
how do you guide AI coding tools to prefer native project patterns over suggesting external packages?
14 views
Replies
Two things have worked for me as a solo dev. First, the rule lives in the repo, not in the prompt: my CLAUDE.md tells the agent to check the codebase and the standard library first, and that adding a package needs a reason I can actually see. If I only say it in chat, the next session has forgotten it. Second, when an agent does propose a package, I make it answer one question first: what existing code does this replace, or what does it save? A debounce helper or a date formatter almost never survives that test, because both are a few lines with the platform APIs. The bloat I regret was never one big dependency — it was twenty small ones I stopped noticing.