find-orphans for Openclaw

A powerful analysis tool that identifies and helps remove orphaned files, unused components, and dead code to streamline project architecture.

wangzhiming1999
v1.0.0
Apr 21, 2026
0
763
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install find-orphans

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install find-orphans using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is find-orphans?

The find-orphans skill provides a systematic approach to cleaning up legacy code and historical technical debt within a project. By analyzing project structures across various frameworks like React, Vue, and Next.js, it identifies files that are no longer referenced or integrated into the main application lifecycle.

This utility is essential for maintaining high code quality and lean project sizes. As part of the Openclaw Skills ecosystem, it ensures that developers can safely prune their codebases without accidentally breaking dynamic imports or critical configuration files.

find-orphans Use Cases

  • Preparing for a major project refactoring or code audit
  • Reducing project bundle size by removing unused assets and styles
  • Cleaning up legacy code after a feature migration
  • Identifying components that are imported but never rendered in the UI
  • Finding utility functions that have become obsolete after API changes

How find-orphans Works

  1. Project Analysis: Reads package.json to identify the framework, build tools, and entry points.
  2. Source Collection: Scans the directory using Glob patterns to find all source files while excluding build artifacts and node_modules.
  3. Reference Extraction: Uses Grep to extract all import and require statements, building a comprehensive map of referenced files.
  4. Orphan Comparison: Subtracts entry points and referenced files from the total file set to identify orphans.
  5. Component & Utility Check: Performs granular checks for unused exports, private functions, and unreferenced barrel exports.
  6. Safety Verification: Cross-references findings with dynamic import patterns and configuration entry points to prevent false positives.
  7. Reporting: Generates a detailed cleanup report with a statistical summary and suggested deletion list.

find-orphans Setup

To use this Openclaw Skills capability, ensure your environment is configured for project analysis. You can trigger the skill by asking the agent to find unused code.

# Example of initiating a cleanup through the CLI
openclaw run find-orphans --path ./src

find-orphans Data Schema & Taxonomy

The skill organizes its findings into a structured report and can generate an automated cleanup script.

Data Category Description
Statistical Summary Total scanned files, orphan count, and estimated lines of code to be removed.
High Confidence Files and components with zero references, safe for immediate deletion.
Manual Review Files with dynamic imports or potential feature flag dependencies.
Cleanup Script A generated .sh script using git rm for safe version-controlled removal.

find-orphans Advanced Features

  • Support for dynamic route detection in frameworks like Next.js and Vue Router
  • Detection of unused CSS/SCSS files and unreferenced assets in the assets folder
  • Identification of duplicate utility functions with similar signatures for consolidation
  • Integration with other Openclaw Skills like /simplify or /refactor-safely for comprehensive maintenance
  • Automatic generation of a safety backup branch before executing deletions

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*