agentsclimarketplace

Orphan file finder

Skill dcs-soni/skills/orphan-file-finder

A collection of custom Claude Code Skills to supercharge your development workflow.From the repository description

Install
npx -y skills add dcs-soni/skills --skill orphan-file-finder

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
  • runs commandsInstructs the agent to run 2 commands, including `python scripts/find_orphans.py <directory>` and 1 more.

SKILL.md

2.7 KB, 559 tokens by cl100k_base, as published. Nobody here has run it

Orphan File Finder

Detects "orphan" source files—those with no inbound references—to surface potentially unused code.

Why This Matters

  • Reduce Technical Debt: Unused files rot over time and mislead developers.
  • Shrink Bundle Size: Dead code might still be bundled or deployed.
  • Security: Forgotten endpoints or scripts can be attack vectors.

Quick Start

Orphan File Cleanup:
- [ ] Step 1: Scan codebase for orphans
- [ ] Step 2: Review and whitelist entry points
- [ ] Step 3: Archive or delete verified dead files

Workflow

Step 1: Scan for Orphans

Analyze the dependency graph to find files with 0 inbound imports:

python scripts/find_orphans.py <directory>

What it does:

  1. Indexes all source files (.js, .ts, .py).
  2. Parses imports to build a directed graph.
  3. Reports files that no other file imports.

Step 2: Review & Verify

The script output splits findings into:

  • Potential Orphans: Files with no imports.
  • Likely Entry Points: Files matching patterns like index.js, main.py, server.ts.

Example output:

Found 12 potential orphan files.

Likely Entry Points (whitelist these?):
- src/index.ts
- src/cli.ts

Potential True Orphans:
- src/legacy/OldHelper.ts
- src/utils/Deprecated.js

Step 3: Archive or Delete

Once verified:

  1. Move to a _archive/ folder if unsure.
  2. Or delete: rm src/legacy/OldHelper.ts

Configuration

Auto-Whitelisted Patterns:

  • index.js/ts/jsx/tsx
  • main.py/js/ts
  • server.js/ts
  • app.js/ts
  • cli.js/py
  • setup.py
  • manage.py (Django)
  • vite.config.*, webpack.config.*

Supported Import Styles:

  • JS/TS: import ... from, require(...), export ... from
  • Python: import module, from module import ...

Utility Scripts

ScriptPurpose
find_orphans.pyBuilds dependency graph and identifies disconnected nodes

Related Skills

  • stale-todo-finder — Clean up old comments while cleaning up old files.
  • codebase-onboarding — Understanding the graph helps with onboarding.

What ships with it: 2 files

10.3 KB alongside SKILL.md, 1 of them executable

scripts/

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.