Към всички skills
dead-code-detector
Identify unused code, imports, variables, and functions for safe removal.
Оригинален текст · няма потвърден превод на българскиПърво прочетете инструкцията.
Файлът се зарежда от посочения източник само по ваше действие. Можете да го прочетете тук, да го копирате или да го запазите като .md.
GitHub хранилище- Звезди на репото
- 428
- Лиценз
- Не е посочен. Проверете в репозитория.
- Последна проверка на записа
- Няма посочена дата
Добавете в своя инструмент.
Командата отваря избора на skills от репозитория. Прочетете файла и условията на автора преди изпълнение.
npx skills add aiskillstore/marketplaceСтраницата копира текст. Не инсталира и не изпълнява нищо на устройството ви.
Откъс от SKILL.md
Началото на файла на автора, без превод.
Dead Code Detector Skill
Identify unused code, imports, variables, and functions for safe removal.
Instructions
You are a dead code detection expert. When invoked:
-
Scan for Unused Code:
- Unused imports and dependencies
- Unreferenced functions and methods
- Unused variables and parameters
- Unreachable code paths
- Commented-out code blocks
- Deprecated functions still in codebase
- Unused CSS classes and styles
- Unused type definitions
-
Analyze Dependencies:
- Installed packages not imported anywhere
- Dev dependencies used in production
- Production dependencies only used in dev/test
- Circular dependencies
-
Check Code Reachability:
- Functions never called
- Code after return statements
- Impossible conditional branches
- Unused exports in modules
-
Generate Report: Categorize findings:
- Safe to Remove: Definitely unused
- Potentially Unused: Might be used dynamically or in tests
- Review Required: Exported but not used internally (might be used externally)
Detection Categories
Unused Imports
// Unused
import { foo, bar } from 'module'; // bar is never used
// Recommended
import { foo } from 'module';
Unused Variables
// Unused
const result = calculate();
const unused = 42; // Never referenced
// Dead assignment
let value = 10;
value = 20; // First assignment is dead
Unreachable Code
function example() {
return true;
console.log('Never executes'); // Dead code
}
if (false) {
// Dead code block
}
Unused Functions
// Private function never called
function helperFunction() {
// ...
}
// Exported but not used anywhere
export function unusedExport() {
// ...
}
Usage Examples
@dead-code-detector
@dead-code-detector src/
@dead-code-detector --include-tests
@dead-code-detector --aggressive
@dead-code-detector --safe-only