Chuyển đến nội dung
Skillpedia
Lập trình chung8.1k · #12568

dead-code-cleanup

Skill này làm gì

Skill này giúp AI của bạn tìm mã chết và đề xuất những gì có thể gỡ bỏ. Dành cho lập trình viên muốn giảm mớ hỗn độn, kích thước bundle hoặc nợ kỹ thuật.

Khi nào nên dùng

  • ✓Khi bạn yêu cầu xóa mã không dùng hoặc giảm kích thước dự án.
  • ✓Khi bạn muốn tìm file không thể truy cập, export không dùng hoặc gói còn sót lại.
  • ✓Khi bạn lên kế hoạch dọn dẹp và cần một danh sách xếp theo độ tin cậy.

Liên kết skill

https://github.com/repowise-dev/repowise/blob/main/plugins/claude-code/skills/dead-code-cleanup/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/repowise-dev/repowise/blob/main/plugins/claude-code/skills/dead-code-cleanup/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tìm mã chết trong dự án này an toàn để xóa, và cho tôi biết vì sao mỗi mục có vẻ không dùng.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill yêu cầu Repowise các phát hiện mã chết, sắp xếp theo độ tin cậy. Nó chỉ đề xuất xóa các mục được đánh dấu an toàn, đưa các mục độ tin cậy thấp hơn như việc cần điều tra, và yêu cầu bạn xác nhận trước khi xóa bất cứ thứ gì.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Dead Code Cleanup with Repowise

Repowise detects dead code through graph analysis — no LLM needed, works even with a template-rendered wiki.

When the user asks about dead/unused code

Call get_dead_code() to get findings sorted by confidence tier. Useful parameters:

  • safe_only=true — only findings confirmed safe to delete (confidence >= 0.7)
  • kind="unreachable_file" — files with no importers
  • kind="unused_export" — public symbols nobody uses
  • kind="zombie_package" — monorepo packages with no consumers
  • directory="src/old/" — limit to a specific directory
  • tier="high" — only high-confidence findings (>= 0.8)
  • min_confidence=0.7 — raise the floor (default is 0.5) for a release-ready cleanup
  • group_by="directory" or group_by="owner" — roll up to see where the dead code concentrates and who owns the most of it

How to present findings

  • Only suggest deletion for findings with safe_to_delete: true
  • For lower-confidence findings, present them as "candidates to investigate" not "things to delete"
  • Dynamically-loaded code (plugins, handlers, adapters) may appear as dead code but isn't — Repowise filters common patterns but edge cases exist

Before deleting anything

  1. Confirm with the user. Present the file/symbol name, confidence score, and why Repowise thinks it's dead.
  2. Call get_risk(targets=["path/to/file"]) to double-check dependents.
  3. Recently-modified "dead" code is more likely a false positive — flag this if the finding has recent git activity.

Safe deletion order

  1. Unreachable files first (whole file removal, cleanest)
  2. Unused internal symbols next
  3. Unused exports last (highest false-positive risk due to potential dynamic imports)
Câu hỏi thường gặp

Nó có tự xóa mã không?

Không. Skill yêu cầu bạn xác nhận từng lần xóa trước.

Nó có thể sai về plugin hoặc mã động không?

Có. Mã được nạp động có thể trông như không dùng, nên skill cảnh báo rằng có một số trường hợp biên.

Nó kiểm tra gì trước khi xóa?

Nó kiểm tra các phụ thuộc vào file trước bằng bước kiểm tra rủi ro, trước khi đề xuất gỡ bỏ.

Chi tiết

Mô tả gốc của tác giả

Use when the user asks about cleanup, removing unused code, refactoring, reducing bundle size, or identifying dead code in a Repowise-indexed codebase (.repowise/ directory exists). Also activates when discussing technical debt, code hygiene, or repository maintenance.

repo: repowise-dev/repowise

Độ phổ biến

Sao GitHub
8.1k
Vị trí xếp hạng
#12568
Giấy phép
AGPL-3.0
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự