Token导航 LogoToken导航

Agent Skill · 研究检索

find-dead-code(找到死代码)

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

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

总安装 665周安装 28GitHub Stars 292下载 233核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/tobihagemann/turbo --skill find-dead-code

这个 Skill 是做什么的

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

find-dead-code 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。

安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。当前顶部介绍为空,需参考原始 SKILL.md 获取详细功能说明。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

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

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

find-dead-code 怎么安装?

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

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

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

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

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

find-dead-code 是免费的吗?

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

find-dead-code 用的人多吗?

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

find-dead-code 安全吗?

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

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

值得选的地方

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

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

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

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 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调用外部服务未明确有提醒
find-dead-code

找到死代码 · 本页

665292需要联网未明确通过

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

SKILL.md 原文

Find Dead Code

Identify dead code in a codebase. Core rule: code only used in tests is still dead code. Only production usage counts.

Step 1: Detect Languages, Scope & Test Boundaries

Determine the project structure:

  1. Check for config files: package.json, tsconfig.json, pyproject.toml, setup.py, Package.swift, .xcodeproj, Cargo.toml, go.mod, pom.xml, build.gradle
  2. Glob for source files: **/*.ts, **/*.py, **/*.swift, **/*.go, **/*.rs, **/*.java
  3. Identify source roots — where production code lives (e.g., src/, lib/, Sources/)
  4. Partition the codebase into analysis units by top-level source directories (e.g., src/auth/, src/api/, src/utils/, lib/models/). Each directory becomes one subagent's scope in Step 3.

If the user specified a scope, restrict analysis to that scope.

Test File Patterns

Establish which files are test files. Code referenced ONLY from these locations is dead.

LanguageTest file patterns
TS/JS*.test.{ts,tsx,js,jsx}, *.spec.{ts,tsx,js,jsx}, __tests__/**, __mocks__/**, *.stories.{ts,tsx,js,jsx}
Pythontest_*.py, *_test.py, tests/**, test/**, conftest.py
Swift*Tests.swift, *Test.swift, Tests/**, *UITests.swift, XCTestCase subclasses
Go*_test.go, testdata/**
Rusttests/**, benches/**, #[cfg(test)] modules (inline test modules within source files)
Java/Kotlinsrc/test/**, *Test.java, *Tests.java, *Spec.java, *Test.kt
Generalfixtures/**, __fixtures__/**, mocks/**, testutils/**, testhelpers/**, spec/**

Also exclude: test runner configs (jest.config.*, vitest.config.*, pytest.ini), storybook files, benchmark files.

Step 2: Quick Wins — CLI Tools (Optional)

If a CLI tool is installed, run it as a fast first pass for zero-reference dead code.

LanguageToolCheckRun
TS/JSknipnpx knip --versionnpx knip --no-exit-code
Pythonvulturevulture --versionvulture <src_dirs> --min-confidence 80
Swiftperipherywhich peripheryperiphery scan --skip-build
Godeadcodewhich deadcodedeadcode./...
Rustcompiler warnings—`cargo build 2>&1 \grep "dead_code"`

Important limitation: CLI tools count test imports as real usage. They cannot detect code that is only used in tests. They only find symbols with literally zero references anywhere. Step 3 is required for test-only detection.

If no CLI tool is installed, skip to Step 3. Do not ask the user to install anything.

Step 3: Test-Only Analysis — Parallel Subagents (Core)

This is the primary analysis. Use the Agent tool to launch one subagent per top-level source directory from Step 1 in a single assistant message so they run concurrently. Each Agent call uses model: "opus" and does not set run_in_background. Expect one Agent tool call per directory, capped at 8 by the Rules section. State the count explicitly when emitting the calls.

Subagent Strategy

Each subagent receives:

  1. Its assigned directory to scan for exported symbols
  2. The test file patterns from Step 1
  3. The full project root path so it can grep across the entire codebase

Subagent Task

Each subagent performs these steps on its assigned directory:

a) Find exported/public symbols:

LanguageExported symbol patterns
TS/JSexport function, export const, export let, export var, export class, export interface, export type, export enum, export default, module.exports
PythonTop-level def and class in non-_-prefixed modules, module-level constants (FOO =...), symbols in __all__, public functions (no _ prefix)
Swiftpublic func, public var, public let, public class, public struct, public enum, public protocol, open class, open func, open var
GoCapitalized identifiers: func FooBar, type FooBar struct, var FooBar, const FooBar (Go uses capitalization for public visibility)
Rustpub fn, pub struct, pub enum, pub trait, pub const, pub static, pub type, pub mod
Java/Kotlinpublic class, public static, public void, public fields, val/var properties, fun (top-level), @Bean, @Component, @Service annotated classes

b) For each symbol, grep across the entire codebase for references, excluding:

  • The definition file itself
  • Generated/vendored directories (node_modules/, dist/, build/, vendor/, __pycache__/, .tox/, .build/, DerivedData/, target/)

c) Classify each reference as test or production based on the test file patterns.

CRITICAL — same-module references count as production usage. A symbol called by another production file within the same module/package is alive. Do not report symbols as "dead" when they have zero *external* callers but are used internally. Only report symbols with zero production references from *any* file. "Unnecessarily public" (could be internal/unexported) is a visibility issue, not dead code — do not include it.

d) Report structured results for each symbol:

  • Symbol name, type (function/class/const/etc.), definition file and line range
  • Number of production references (with file paths) — including same-module references
  • Number of test references (with file paths)
  • Classification: dead (zero prod refs anywhere), test-only (only test refs), alive (has prod refs)

Merging Results

After all subagents complete, collect and merge their results. Deduplicate any symbols that appear in multiple reports (e.g., re-exports).

Step 4: Filter, Classify & Evaluate

Apply these filters to the merged results from Steps 2 and 3:

  1. Framework entry points: Skip symbols used by convention — React components in barrel files, Django views in URL configs, Go init() and main() functions, Go interface implementations, Rust main(), Rust trait implementations, #[derive(...)] generated code, CLI handlers registered in main, magic/lifecycle methods (__init__, __repr__), serialization methods (to_json, from_dict), interface/protocol implementations
  2. Re-export chains: Trace barrel files (index.ts, __init__.py) before declaring a symbol dead. A symbol re-exported through a barrel may have indirect consumers.
  3. Dynamic usage: Flag symbols that might be used via reflection (getattr, importlib, reflect package in Go, proc_macro in Rust), string-based lookups, or decorator/attribute registration as "likely dead" rather than "definite"
  4. Cross-package references: In monorepos, verify a symbol isn't imported by a sibling package before declaring it dead
  5. Design docs / specs / roadmaps: If the project has spec files, roadmaps, or TODO files (e.g., .turbo/specs/, ROADMAP.md, TODO.md), cross-reference test-only findings against them. Test-only APIs may be planned features awaiting integration — flag as investigate rather than delete

Classify each finding:

  • Definite dead: zero references outside its definition file
  • Test-only dead: references exist, but ALL are in test files
  • Likely dead: uncertain due to dynamic usage, framework conventions, or complex re-export chains

Evaluate Findings

Run the /evaluate-findings skill on the classified results to verify each finding against the actual code and weed out false positives. Read the full definition file for each finding — not just the flagged symbol. The surrounding code may reveal that the feature is already implemented differently (e.g., a public ping() method may be test-only while a private keepalive loop in handleConnect() does the real work).

Proceed with the evaluation results in the next section.

Recommend Action

For each surviving finding, assign a recommendation:

SignalRecommendation
No tests, no production usagedelete
Has tests but no production usage, and no spec/roadmap referencedelete (method + test assertions)
Has tests but no production usage, referenced in spec/roadmap/TODOinvestigate (planned feature, not dead)
Partially wired up, unclear intent, or needs domain contextinvestigate

For findings marked investigate, run the /investigate skill to determine whether the code is a planned feature, an unwired integration, or truly dead.

Common Dead Code Patterns

Watch for these high-yield patterns that tools and simple grep often miss:

  1. Test-only state accessors: Public properties/methods that expose internal state solely for test assertions (e.g., isEnabled, count, currentItems). The module's production consumers use behavior (events, callbacks, side effects) — only tests peek at the internal state. When removing these, the corresponding test assertions must also be removed or rewritten to use behavior-based verification.
  2. Unused data model fields: Properties on serializable types (Codable structs, dataclasses, POJOs) that are decoded but never read by any production code. When removing a field from a serializable type, also update all data files that encode it (JSON, YAML, XML, database schemas, migration files).
  3. Vestigial enum cases: Enum cases defined but never constructed or matched against in production code.
  4. Orphaned convenience methods: Public wrappers that call through to another public method with slightly different parameters, where all callers use the underlying method directly.

Adjacent Findings

While scanning for dead code, note (but do not act on) these related issues for the user:

  • Bugs near dead code: Dead code often neighbors buggy code — a missing call, a wiring gap, or an incomplete integration
  • Unwired features: Code that is "almost alive" — defined, tested, but not connected to the rest of the system. Distinguish from truly dead code.

Step 5: Present Findings

Group results by confidence level:

Definite Dead (zero references outside definition)

FileSymbolTypeLine RangeRecommendation

Test-Only Dead (referenced only in tests)

FileSymbolTypeTest files referencing itRecommendation

Likely Dead (verify manually)

FileSymbolTypeReason for uncertaintyRecommendation

Include:

  • Total count per category
  • Estimated removable lines
  • Suggested removal order (leaf dependencies first)

Rules

  • If more than 8 top-level source directories are identified, ask the user to narrow scope or group related directories into fewer subagent batches.
  • If no dead code is found, report that explicitly and note any scope limitations or analysis caveats.

平台分布

Codex

34.73%
按下载量换算81

Claude

32.9%
按下载量换算77

Cursor

19.51%
按下载量换算45

Gemini CLI

8.83%
按下载量换算21

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

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

继续浏览同类 Skills