Unused Dependencies Audit & Removal

Audit and remove unused package.json dependencies with build validation.

1|Updated Nov 26, 2025
One-click install
npx skills add https://github.com/Baneeishaque/ai-suite --skill unused-dependencies-audit-removal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Unused Dependencies Audit & Removal
Source: https://github.com/Baneeishaque/ai-suite/tree/main/.agents/skills/unused_dependencies_audit
Command: npx skills add https://github.com/Baneeishaque/ai-suite --skill unused-dependencies-audit-removal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Audit all npm/Yarn/pnpm dependencies to identify packages declared in package.json but not actually imported in the codebase. Analyze source code for import/require statements, cross-reference against declared dependencies, and remove unused packages one-by-one while validating the build integrity.

Core Features & Use Cases

  • Comprehensive source scanning to identify unused dependencies declared in package.json
  • Cross-reference imports with dependencies and perform safe, one-by-one removals with build validation
  • Atomic commits and manual review for high-risk or ambiguous packages; reduces install size and maintenance burden
  • Use Case: A large JS/TS project with hundreds of dependencies can drop unused packages to speed up installs and reduce attack surface

Quick Start

Run the audit to identify unused dependencies, then remove them one-by-one followed by a build validation.

Frequently Asked Questions about Unused Dependencies Audit & Removal

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find and remove unused dependencies in package.json?

To remove unused dependencies, the Skill scans your codebase for import and require statements, cross-references them against package.json, and deletes unused packages one-by-one. It regenerates lockfiles and validates the build to ensure no regressions occur.

Does the unused dependencies audit work with Yarn and pnpm?

Yes, the unused dependencies audit supports multiple package managers including npm, Yarn, and pnpm. It cross-references imports across the codebase and regenerates the corresponding lockfiles after safely removing each unused package.

What is the safest way to prune unused npm packages without breaking the build?

The safest way to prune unused npm packages is through one-by-one removals paired with build validation. This approach performs atomic commits and allows manual review for high-risk or ambiguous packages, ensuring your working build command confirms integrity.

How does cross-reference logic identify unused dependencies in a JavaScript project?

Cross-reference logic identifies unused dependencies by analyzing import and require statements across your source code and matching them against the packages declared in package.json. Packages not referenced in any import statements are flagged as unused.

Why do I need a working build command to audit unused dependencies?

A working build command is required to validate build integrity after each one-by-one dependency removal. This ensures that removing an unused package does not introduce regressions, confirming that the remaining dependencies and codebase still compile and function correctly.

What are the limitations of automated unused dependency removal?

Automated removal limitations include ambiguous packages that require manual review and high-risk dependencies needing atomic commits. The process relies entirely on static import and require analysis, meaning dynamically imported or referenced packages might still need human oversight.