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.
Log in to leave a comment.
A PreToolUse hook can intercept test runner commands and filter output to show only failures, cutting thousands of tokens from Claude's context.
CLAUDE.md loads into every message. Move workflow-specific instructions into skills that load on demand to reduce token costs across your session.
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.