--- name: dead-code description: This skill should be used when the user asks to find dead code, unused code, orphaned exports, "what code is never used", "find unused functions/classes/types", or wants to clean up code that is exported but never imported. --- # Dead Code Finder Find exported code that is never imported or used anywhere in the codebase, using the Constellation `code_intel` tool (from the `constellation` MCP server). ## How to Run If the user wants to filter by symbol kind (function, class, type, interface, variable), pass it as `filterByKind`; otherwise call with no filter: ```javascript // Unfiltered scan const result = await api.findOrphanedCode({}); return result; ``` ```javascript // Filtered by kind const result = await api.findOrphanedCode({ filterByKind: ["function"] }); return result; ``` ## Presenting Results **If orphaned code is found:** 1. **Summary**: Total count of orphaned exports, broken down by kind (function, class, etc.) 2. **Files with Most Orphans**: Group results by file, sorted by count (show top 20) 3. **For Each File**: List the orphaned symbol names, kinds, and orphan reasons (each result includes `reason` and a `confidence` score; `lineEnd` is present when known) **Recommendations to include:** - Review each orphaned export to confirm it's truly unused - Some may be entry points or dynamically imported - Consider removing confirmed dead code to reduce maintenance burden - Focus on files with multiple orphans first Before actually deleting a candidate, confirm with `api.traceSymbolUsage({ symbolName, filePath })` (see the `impact-analysis` skill). **If no orphans found**, congratulate the user on a clean codebase. **If error**, explain the error and provide guidance from the error response. The `constellation-troubleshooting` skill covers error codes in depth.