ワンクリックで
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).