$ recombobulate _
home / tips / ask-claude-to-audit-your-project-for-unused-dependencies
0

Ask Claude to Audit Your Project for Unused Dependencies

bagwaa @bagwaa · Mar 26, 2026 · Performance
ask-claude-to-audit-your-project-for-unused-dependencies

Dependency creep is real — every refactor leaves a package behind. Claude can cross-reference your dependency list against your source files and flag the suspicious ones.

# Pipe depcheck output to Claude for analysis
npx depcheck --json | claude "Explain each unused dependency listed here.
For each one, tell me whether it's safe to remove in a Next.js project 
that uses Tailwind, Radix UI, and Prisma. Flag any that might be 
implicit peer deps or build-time tools."

Claude understands that some packages (PostCSS plugins, Babel presets, type definition packages) never appear in import statements but are still required. It won't just tell you to delete everything.

For PHP projects using Composer:

cat composer.json | claude "Review this composer.json for a Laravel app.
Flag any packages that look like they might be unused or redundant.
I'm on Laravel 11 and PHP 8.3. Also flag any packages that have 
known security advisories as of early 2024."

You can also make it more targeted by including your app structure:

find app/ -name "*.php" | xargs grep "^use " | sort -u | \
  claude "Here are all the namespace imports in my Laravel app. 
  Cross-reference against my composer.json and flag any vendor 
  packages that are never imported: $(cat composer.json)"

Fewer dependencies means faster installs and a smaller attack surface — run the audit.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Filter Test Output with a PreToolUse Hook to Cut Token Costs

A PreToolUse hook can intercept test runner commands and filter output to show only failures, cutting thousands of tokens from Claude's context.

bagwaa @bagwaa · 3 hours ago
0
Move Specialised CLAUDE.md Instructions into Skills to Shrink Context

CLAUDE.md loads into every message. Move workflow-specific instructions into skills that load on demand to reduce token costs across your session.

bagwaa @bagwaa · 3 hours ago
0
Use prompt.id to Trace All Activity from a Single User Prompt

Every event emitted while processing a single prompt shares a prompt.id UUID, letting you trace the complete chain of API calls and tool executions.

bagwaa @bagwaa · 3 hours ago