一键导入
remove-unused-code
Scan the codebase for unused files, dependencies, and exports using Knip and clean them up
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scan the codebase for unused files, dependencies, and exports using Knip and clean them up
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Update project documentation after feature changes. Uses conversation context and optional dev pointers to update repo guide, README, extension description, and in-app help modal. Invoke after implementing user-visible changes.
Audit a codebase scope for tech debt, generate a prioritized refactoring plan. Covers dead code, complexity hotspots, DRY violations, dependency health, type safety gaps, test coverage, architecture/coupling issues, security smells, and naming/readability problems. Outputs an actionable plan at the requested detail level — from high-level subtasks to precise file-and-function changes for immediate execution.
| name | remove-unused-code |
| description | Scan the codebase for unused files, dependencies, and exports using Knip and clean them up |
Identify and remove unused files, dependencies, exports, and types.
check:unused runs Knip twice (production then full):
Production pass (knip --production): Traces from production entry points only. Test files excluded from project scope. Checks unused files and dependencies only — export/type analysis is disabled (deferred to full pass where test context is available).
Full pass (knip): Includes test files as entries. Checks everything — unused exports, types, dead imports, etc.
Why two passes: Without the production pass, code imported only by tests appears "used." The production pass narrows scope to surface truly dead production code.
pnpm check:unused # both passes (fail-fast)
pnpm check:unused:prod # production pass only
pnpm check:unused:full # full pass only
pnpm check:unused
If the combined script stops at the production pass, run check:unused:prod and check:unused:full separately to see both.
Knip reports these categories:
package.json but never importedpackage.jsonKnip can report false positives. Grep for each item before removing.
When false positives are found, add a /** @knipignore */ JSDoc comment above the export. The knip config uses tags: ["-knipignore"] to exclude tagged items.
pnpm remove <package>export keyword; if truly unused, deletepnpm add <package>pnpm check:unused # should be clean
pnpm test # tests still pass
pnpm typecheck # types still check
SC API types in src/shared/types.ts are exported as a complete set even if not all are consumed yet. These use @knipignore tags. Do not remove them — they document the full API surface.
Some dependencies are tools not imported in source code (e.g., universal-ai-config) or are re-exported from another package (e.g., @voidzero-dev/vite-plus-test from vite-plus). These are listed in ignoreDependencies in knip.ts.
Knip may flag items in ignoreDependencies as unnecessary. Do not remove them without verifying — they may be needed for reasons knip can't detect (CLI tools, bundled re-exports, global type augmentations).