Token导航 LogoToken导航

Agent Skill · 研究检索

dead-code-sweep(死代码扫描)

dead-code-sweep 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

dead-code-sweep 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 72,083。

总安装 190周安装 8GitHub Stars 35下载 67核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:dead-code-sweep(死代码扫描)
来源仓库:https://github.com/petekp/claude-code-setup
仓库路径:skills/dead-code-sweep
安装命令:
npx skills add https://github.com/petekp/claude-code-setup --skill dead-code-sweep
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/petekp/claude-code-setup --skill dead-code-sweep

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找、检索和筛选相关信息。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。适合根据关键词或任务场景快速定位候选结果。可结合来源仓库和原始 README 核验具体用法。安装前建议确认权限范围和维护状态。

dead-code-sweep 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/dead-code-sweep

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/petekp/claude-code-setup --skill dead-code-swe…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

dead-code-sweep 怎么安装?

在终端执行 npx skills add https://github.com/petekp/claude-code-setup --skill dead-code-sweep。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

dead-code-sweep 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

dead-code-sweep 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/petekp/claude-code-setup --skill dead-code-sweep 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

dead-code-sweep 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

dead-code-sweep 用的人多吗?

公开数据是累计安装 190 次,近一周安装 8 次,下载 67 次,GitHub 35 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

dead-code-sweep 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
dead-code-sweep

死代码扫描 · 本页

19035执行命令未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Dead Code Sweep

Systematic identification and removal of dead code, redundant implementations, and orphaned artifacts in codebases — particularly those maintained by coding agents with limited context windows.

Why Agent-Maintained Codebases Accumulate Cruft

Coding agents operate within narrow context windows. When refactoring, they often:

  • Re-implement functionality without finding and removing the original
  • Leave compatibility shims for interfaces that no longer exist
  • Abandon helper functions after inlining their logic
  • Create new files without deleting the ones they replace
  • Duplicate type definitions across module boundaries
  • Leave imports for symbols they stopped using mid-refactor

This cruft compounds. Each orphaned artifact misleads the next agent (or human), who wastes context budget reading code that does nothing.

Workflow

Phase 1: Scope and Inventory

Determine the analysis boundary.

If the user provides a scope (directory, file pattern, module), constrain all analysis to that scope.

If no scope is provided, analyze the full codebase. Start by reading the project structure:

  1. Identify the primary language(s) and framework(s)
  2. Map entry points (main files, route definitions, exported modules, test runners)
  3. Note the build system and dependency configuration
  4. Check for monorepo structure — analyze each package as a unit

Produce a brief inventory:

Language(s): TypeScript, Python
Entry points: src/index.ts, src/cli.ts
Build: esbuild via package.json scripts
Packages: 1 (single package)
Estimated LOC: ~4,200

Phase 2: Detection

Launch parallel sub-agents to scan for different categories of dead code. Read references/cruft-patterns.md for the full catalog of detection patterns.

Organize detection into these parallel tracks:

TrackWhat It Finds
Orphaned filesFiles not imported, required, or referenced by any other file
Unused exportsExported symbols (functions, classes, types, constants) never imported elsewhere
Redundant implementationsMultiple functions/classes doing the same thing under different names
Stale compatibility codeShims, adapters, wrappers, and re-exports that bridge interfaces that no longer differ
Dead branchesConditional paths that can never execute (always-true/false guards, unreachable returns)
Orphaned testsTest files testing functions or modules that no longer exist
Orphaned dependenciesPackages in dependency manifests not imported anywhere in source

For each track, the sub-agent should:

  1. Read references/cruft-patterns.md for detection strategies specific to that track
  2. Search the codebase using Grep and Glob
  3. Verify each candidate by tracing references — a symbol is only dead if zero live code paths reach it 3b. Search CI scripts and shell test fixtures for path references to the candidate: rg <filename> -- scripts/ tests/.github/. Files consumed as ratchet-check arguments or Bats test fixtures are NOT dead even if zero source files import them.
  4. Record findings with file path, line range, and evidence

Verification is critical. Common false positives to watch for:

  • Symbols used via dynamic dispatch, reflection, or string-based lookups
  • Framework-magic exports (e.g., Next.js page components, pytest fixtures, Rails conventions)
  • Public API surface intended for external consumers
  • Conditional imports behind feature flags or environment checks
  • Decorator-registered or plugin-registered handlers
  • CLI entry points referenced in package.json bin fields
  • CSS class names referenced in templates or JSX as dynamic strings
  • CI scripts and shell test fixtures that reference files by path — e.g., check_file_contains "name" "path/to/file" in scripts/ci/, or cat "$PROJECT_ROOT/path/to/file" in tests/**/*.bats. These are string arguments, not imports, so import-tracing tools miss them entirely.

When uncertain, mark as "needs review" rather than "confirmed dead."

Phase 3: Report

Consolidate all findings into a structured report at .claude/dead-code-report.md.

Organize findings by confidence level, then by category:

# Dead Code Sweep Report

**Scope:** [full codebase | specific path]
**Date:** [date]
**Estimated removable lines:** [count]

## Confirmed Dead (high confidence)

### Orphaned Files
- `src/utils/old-parser.ts` — Not imported anywhere. Superseded by `src/parser/index.ts`.
- ...

### Unused Exports
- `formatDate()` in `src/helpers.ts:42-58` — Exported but zero imports across codebase.
- ...

[...other categories...]

## Needs Review (uncertain)

### Possibly Dynamic
- `handleLegacyEvent()` in `src/events.ts:91` — No static imports, but may be registered dynamically.
- ...

For each finding, include:

  • File path and line range
  • What it is (function, class, file, type, constant, dependency)
  • Why it appears dead (no imports, no references, superseded by X)
  • Confidence (confirmed / needs review)

Phase 4: Cleanup with Approval

Present the report summary to the user and ask for approval before removing anything.

Use AskUserQuestion to present findings by category:

Found 12 confirmed dead items and 3 needing review.

Confirmed dead by category:
- 3 orphaned files (~280 lines)
- 5 unused exports (~120 lines)
- 2 redundant implementations (~90 lines)
- 2 orphaned dependencies

Which categories should I clean up?

Options: Remove all confirmed / Select categories / Review each item / Skip cleanup

For each approved category:

  1. Remove the dead code
  2. Clean up any imports that referenced the removed code
  3. Remove empty files left after cleanup
  4. Remove orphaned dependencies from the manifest
  5. Run the project's lint/typecheck/build commands to verify nothing broke

If any removal causes a build or type error, immediately revert that specific removal and move the item to "needs review."

After cleanup, update the report with what was removed and what was kept.

Detection Principles

Trace from entry points, not from suspects

Start from known entry points and trace what's reachable, rather than starting from a suspect symbol and trying to prove it's used. The reachability approach has fewer false negatives.

Respect the module boundary

A symbol exported from a package's public API may be consumed by external code not visible in this repository. When analyzing libraries or packages with external consumers, only flag internal (non-public-API) dead code as "confirmed." Flag public API dead code as "needs review."

Look for clusters, not just individuals

Agent-generated cruft tends to cluster. When one dead function is found, examine its neighbors — the agent likely abandoned the entire section during a refactor. A dead file often has sibling dead files created in the same commit.

Use git history as a signal

When available, check when suspect code was last meaningfully modified. Code untouched across several refactor commits is more likely dead. Use git log --follow to trace renames and detect superseded files.

Check CI and test infrastructure, not just source code

Files may have zero source-code references but be consumed by CI scripts (scripts/ci/, .github/workflows/), shell test fixtures (tests/**/*.bats), or verification tooling (.verifier/). These references appear as string arguments to shell functions — invisible to import tracing. Always run rg <filename> -- scripts/ tests/.github/ before classifying a file as orphaned.

平台分布

Codex

35.44%
按下载量换算24

Claude

32.03%
按下载量换算21

Cursor

17.6%
按下载量换算12

Gemini CLI

8.68%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/petekp/claude-code-setup --skill dead-code-sweep 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills