
An AI coding assistant adds a small feature and updates the dependency file. The feature works, the tests pass, and the change looks ready. But the new package deserves a separate review: what software is entering the project, and what can it do when installed or run?
Our previous guide explained how to test AI-generated code without repeating its mistakes. Dependency review adds another check. Functional tests can show that an export button produces a file; they do not establish that every package involved is appropriate to trust.
Start by asking whether the dependency is needed
Imagine a dashboard that needs to export a short list of records. An assistant proposes a new library. Before installing it, ask what requirement the library satisfies. Does the project already have an approved exporter? Is the feature more complicated than it first appears? Which formats, character encodings and large-file cases matter?
This is an illustrative review scenario, not a report of a real incident. The aim is to make the dependency decision explicit. Writing everything yourself can create maintenance and correctness problems too. A well-maintained library may be the sensible choice, but it should solve a defined need.
A useful instruction for the assistant is: “List each proposed dependency, the requirement it serves, its official documentation and the alternatives already present in this repository. Do not install anything yet.” Treat its answer as a research starting point.
Verify the package identity independently
Check the exact registry name, including any organisation scope, against the project’s official documentation. Follow the documentation’s installation instructions to the registry entry and repository. A familiar-looking name alone is weak evidence that you have found the intended software.
Inspect the release history, supported runtime versions, maintenance activity and licence. Check whether the API in the proposed code exists in the specific release being considered. A package can be genuine while the assistant’s example uses an outdated or nonexistent function.
npm’s package-selection guidance offers signals for assessing packages. Use those signals together rather than treating popularity as a security guarantee. If the registry entry and official project documentation disagree, pause and resolve the discrepancy before installation.
Review the dependencies behind the dependency
A direct dependency is one your project requests. A transitive dependency is software brought in by another dependency. One new line in a manifest can therefore introduce many packages.
Read both the manifest change and the lockfile change. For an npm application, package-lock.json records the resolved dependency tree and is intended to be committed to source control. That gives reviewers a concrete record of the versions selected.
Ask the assistant to explain unexpected additions, removals or version changes. If a small export feature also changes the authentication library, separate those changes or explain why they are necessary. Keeping the review focused makes unrelated risk easier to spot.
Where available, GitHub’s dependency review shows changes to direct and indirect dependencies and information about known vulnerabilities. Its availability depends on the repository and security configuration. A team can still review manifests and lockfiles without that particular interface.
Treat installation as an execution boundary
Downloading a dependency and running its code are different decisions, but an install process can cross both boundaries. Review installation scripts and the permissions of the environment before letting a coding assistant install new software.
For an npm project with a reviewed lockfile, npm ci --ignore-scripts is one option for an initial clean installation that suppresses package scripts. The npm ci documentation explains that the command requires a lockfile, fails when it conflicts with the manifest, and removes an existing node_modules directory. Use a disposable development checkout, not a working environment you need to preserve.
Suppressing scripts can leave legitimate dependencies incompletely built. It also does not make later execution safe: explicitly requested commands such as npm test still run their intended scripts. Review the necessary build steps before enabling them, and follow the documentation for your installed npm version.
Keep production credentials, customer data and unnecessary network access out of this initial environment. A successful installation is only one observation in the review, not permission to give the package broader access.
Understand what an audit result actually says
npm audit checks dependencies for known vulnerabilities. It sends dependency information to the configured registry, so use your organisation’s approved registry and data-handling policy when working with private projects.
A clean report does not prove that the software is harmless, correctly configured or suitable for your application. It means the particular check found no reported vulnerabilities within its coverage. Record that limited conclusion rather than calling the entire change “secure.”
Review proposed fixes too. npm audit fix performs an installation and can change the dependency tree. Do not let an assistant apply a broad repair, delete the lockfile or force major upgrades merely to make a warning disappear. Understand the affected version, choose a remediation, review the resulting diff and rerun the relevant checks.
Leave a review record someone else can use
For the dashboard example, the pull request should make these questions easy to answer:
- What feature requires the new library, and why was an existing option insufficient?
- Where were the exact package identity, version and API verified?
- What direct and transitive dependencies changed?
- Which installation or build scripts were reviewed, and where were they run?
- What did vulnerability checks report, and what remains unresolved?
- Which feature and integration tests ran against the selected versions?
Ask for evidence such as the reviewed diff and actual command results, not just an assistant’s confidence. If a check could not run, mark it as incomplete. Assign someone to monitor future advisories and updates after the dependency is accepted.
AI-assisted development can make adding software remarkably easy. A short dependency review keeps that convenience connected to a deliberate engineering decision: the team knows what it added, why it needs it, and what evidence supports using it.