‹ 首页

dead-code

@parcadei · 收录于 1 周前 · 上游提交 5 个月前

Find unused functions and dead code in the codebase

适合你,如果代码库越来越大,想清理无用代码保持整洁

/ 下载安装
dead-code.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add parcadei/continuous-claude-v3/dead-code
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- parcadei/continuous-claude-v3/dead-code
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify parcadei/continuous-claude-v3/dead-code
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
3859GitHub stars
~349上下文体积 · 单文件
镜像托管

怎么用

商店整理自技能原文 · 版本 d07ff4b · 表述以原文为准
它做什么

Claude 会使用 TLDR 静态分析工具扫描代码库,找出未使用的函数和死代码,并列出它们的文件名和行号。

什么时候触发

当你要求 Claude 查找未使用的函数或死代码时触发。

装好后可以这样说
Claude 会运行 tldr dead . 扫描整个项目。
Claude 会扫描指定目录。
技能原文 SKILL.md作者撰写 · MIT · d07ff4b

Dead Code Detection

Find unused functions and dead code using TLDR static analysis.

Quick Start
# Scan entire project
tldr dead .

# Scan specific directory
tldr dead src/

# Specify entry points (functions to exclude from analysis)
tldr dead . --entry main cli test_

# Specify language
tldr dead . --lang python
tldr dead . --lang typescript
Output Format
Dead code analysis:
  Total functions: 150
  Dead functions: 12

Unused functions:
  - old_helper (src/utils.py:42)
  - deprecated_func (src/legacy.py:15)
  - _unused_method (src/api.py:230)
Cross-Platform

Works on Windows, Mac, and Linux (including WSL).

# Windows (PowerShell)
tldr dead .

# Mac/Linux
tldr dead .
Entry Points

Functions matching entry patterns are excluded from dead code analysis:

  • main, cli - Application entry points
  • test_*, *_test - Test functions
  • setup, teardown - Fixtures
  • @app.route, @api.endpoint - Framework handlers
# Custom entry points
tldr dead src/ --entry main api_handler background_job
Integration

This skill replaces the session-start-dead-code hook with on-demand analysis.

| Approach | Pros | Cons | |----------|------|------| | Hook (removed) | Automatic | Slowed startup by 3s | | Skill (this) | On-demand, fast | Manual invocation |

Related Commands
# Impact analysis (who calls this?)
tldr impact func_name .

# Architecture layers
tldr arch src/

# Full codebase structure
tldr structure . --lang python
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。