一键导入
audit-dead-code
Audit for unused exports, dead code, unused dependencies, and deprecated code
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Audit for unused exports, dead code, unused dependencies, and deprecated code
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Fill missing type, title, and description frontmatter on documents using structured AI output
Download a web page by URL and save it as clean markdown with images
Audit for accessibility — keyboard navigation, ARIA labels, contrast, focus indicators
Produce a full dependency health report (SBOM, vulnerabilities, staleness, upgrades, licenses)
Audit error handling UX — error boundaries, silent failures, loading states, empty states
Audit for unnecessary re-renders — Zustand subscriptions, missing memoization, inline callbacks
| name | audit-dead-code |
| description | Audit for unused exports, dead code, unused dependencies, and deprecated code |
| user-invocable | true |
Find unused code and problematic dependencies. This is a research-only audit — do not modify any code.
A file with zero importers anywhere is dead regardless of what it exports.
.ts/.tsx in src/, run
grep -rln "<basename-without-ext>" src and exclude the file itself and
*.test.*. Zero hits ⇒ orphan candidate.import('...<basename>'), lazy routes) — see §"Avoiding False Positives".For files that DO have importers, find individual exports never imported:
export function, export const, export interface, export type, export default declarationsExclude: src/components/ui/ (shadcn/ui — may be used on-demand), .d.ts files, test files.
@deprecated JSDoc tags and #[deprecated] Rust attributesstartMessageIndex retained behind startMessageId, or a v1 ai-store kept
as a migration/fallback).openTabs → openDocuments rename verified at 0 stragglers).return statements followed by code on subsequent linesif (false) or feature flags that are permanently offpackage.json dependencies and devDependenciessrc/ and config filesCommon false positives to exclude:
Tailwind plugins (used in config, not imported)
Vite plugins (used in vite.config.ts)
Type packages (@types/* — used implicitly)
PostCSS plugins
Tauri CLI packages
Transitively-redundant direct deps: A dependency can have ZERO direct
imports yet still resolve because a parent package re-bundles it. For each
dep with zero src/ imports, check pnpm-lock.yaml to see whether it is
already a transitive dep of a package you DO import directly. If so, flag the
direct entry as redundant — removal is safe because it still resolves
transitively. Verify with pnpm install + pnpm typecheck after removal.
This is common when a meta-package (a starter-kit, a framework bundle) absorbs
what used to be separate add-on packages across a major version bump (e.g.
@tiptap/extension-underline/-link/-list-keymap absorbed by a newer
@tiptap/starter-kit).
Phantom-feature deps: A dependency with zero references in BOTH src/ and
src-tauri/ (no Cargo dep, no capability grant) often signals a feature that
was planned but never wired. Cross-check the docs/roadmap — if the docs say
the feature "never shipped" or "was removed," the dep is a false signal that
the capability is present. Flag for removal (e.g. a
@tauri-apps/plugin-global-shortcut left behind by a Quick Capture feature
that never shipped).
A file whose ONLY references come from test files (including vi.mock(...) and
dynamic import() inside specs) ships nothing — but its tests pass forever
regardless of app correctness, giving a false coverage signal.
src-tauri/Cargo.toml dependenciesuse <crate> or <crate>:: across .rs files.plugin(<crate>::init()) line, verify the plugin's IPC commands
are actually reachable — check capabilities/*.json for a matching
<plugin>:allow-* grant AND check the renderer imports
@tauri-apps/plugin-<name>. A plugin that is initialized but neither granted
nor imported is dead weight that widens the attack surface the capability
lock-down is closing — flag it for removal (e.g. a tauri_plugin_fs::init()
line with no fs:allow-* grant and zero renderer imports).Common false positives: proc-macro crates (used via #[derive]), serde
features, build dependencies, and crates whose only use is a #[derive] or a
sidecar/managed-state registration.
If pnpm outdated or cargo outdated is available, run it and report:
Check if any direct dependency pulls in a disproportionately large dependency tree. Look at pnpm ls --depth=1 or cargo tree --depth=1 for packages with many transitive deps.
A plain "imports of " grep produces false dead-code calls in this repo. Before flagging anything, run these guards:
import('...')
string literals and lazy-route registrations, not just static import lines.
A file can be live yet have zero static importers.#[tauri::command] fn is NOT dead
just because no Rust code calls it — it is invoked from the frontend by name
string via invoke('command_name'). Confirm "unused command" by checking the
generate_handler![] list in lib.rs AND grepping the frontend for the
command-name string. NOTE: counting #[tauri::command] vs generate_handler!
entries can differ by a small delta purely from the multiline handler list —
treat a 1-off delta as a grep artifact, not a dead command, until name-matched.useStore(s => s.field)) will not show up as an import of the
field name. Grep the field name as a property access across the codebase, and
do not flag persisted-store fields kept for migration (see the migration-fallback
guard above) as dead.index.ts barrel is
reachable under the barrel path, not the original file path. Resolve barrels
before declaring zero importers.### Unused Exports
| Export | File | Type |
| --- | --- | --- |
| `formatDate` | `src/lib/utils.ts:45` | function |
### Unused Dependencies
| Package | In | Notes |
| --- | --- | --- |
| `lodash` | package.json | No imports found |
personaId field still referenced in 3 filesFiles: src/stores/ai-store.ts:12, src/hooks/useAIOperations.ts:45, src/stores/project-metadata-store.ts:8
The personaId field is marked @deprecated (replaced by agentName in the addressable agents migration) but is still referenced in 3 files. These references are migration-related and may be intentional, but should be verified.