AniUI Academy

AI keeps adding packages. Does your frontend need them?

Before accepting an AI-generated install command, check whether your project already solves the problem or a built-in browser feature is enough.

Anish Lawrence3 min read

You ask AI to display a date nicely. Its answer starts with an installation command, followed by a new import and a helper function.

The result might work. But before adding the package, ask what it gives you that your project does not already have.

Start with the task

Describe the behavior you need before choosing a package. A small request may have a straightforward solution already available.

Imagine a blog card that needs to display a publication date as “4 November 2026.” You need readable text, with a clear decision about language and time zone.

JavaScript provides Intl.DateTimeFormat for language-sensitive date and time formatting. It lets you choose formatting options without adding a separate library for that task.

That does not make every date library unnecessary. It means you have an existing option to consider before installing one.

Ask AI to explain the simplest suitable approach and identify any requirements it cannot meet.

Check your existing project

Before accepting a new dependency, look for a package or shared function that already handles the same job.

Your application might already have a date formatter used by invoices, notifications, and account pages. Creating another approach for blog cards could make dates look inconsistent.

The same problem appears with buttons, forms, icons, and network requests. A suggestion can be reasonable on its own while fitting poorly with the code around it.

Tell the assistant to inspect the existing project first. Point it toward relevant components or utilities when you know where they are.

For a small task, reusing an established solution can make the result easier for the rest of the team to understand and maintain.

Libraries can earn their place

A package is useful when its capabilities and maintenance save you more work than adopting it creates.

Displaying a publication date is different from building a booking calendar. The calendar may need date selection, keyboard interaction, unavailable dates, and detailed rules about valid bookings.

Those requirements deserve a broader evaluation. Writing everything yourself also creates code that someone must test, document, and maintain.

Ask what the proposed library actually covers. A date formatting library and an accessible calendar component solve different problems, even though both involve dates.

The goal is to choose a tool that fits the requirement. A dependency needs a reason, and avoiding one needs a reason too.

Review the whole change

An installation command is only the beginning. Read how the package is used and what changes it introduces.

For frontend code, check whether it becomes part of the browser download and whether that cost matters for the feature. Installed package size and the amount shipped to users are different measurements.

Also look at the code around the import. Did a simple display task turn into several new files and configuration changes? Can your teammates explain the approach?

Verify that the package exists, that the documentation matches the version, and that its maintenance looks suitable for your project.

You do not need a lengthy investigation for every small decision. You do need enough information to understand what you are adding.

Ask before installing

Have AI explain why a dependency is needed, what alternatives exist, and how the choice fits your application.

A useful request could be: “Display the publication date using our existing utilities or browser APIs. If you recommend a new package, explain which requirement makes it necessary.”

Then check the behavior. Try a missing date, a different language, and the time zone your application is supposed to use. A successful installation does not confirm the feature is correct.

My take: AI can help you compare options and implement the result. Giving it permission to suggest a package should still leave room to question that suggestion.

Keep the solution easy to understand, reuse what already works, and add dependencies when their benefits are clear.

Thanks for reading. #AI #FrontendDevelopment #JavaScript #WebDevelopment

Related reading

Discussion

Sign in to post
Sign in to join the conversation.Sign in

No comments yet. Be the first to say something.