dead-code-cleanuplisted
Install: claude install-skill AkaraChen/2code
# Dead Code Cleanup
## Frontend (TypeScript/React)
### 1. Run knip
```bash
bunx knip
```
Reports: unused exports, unused files, unused dependencies, unused types, configuration hints.
### 2. Verify each finding
Grep before removing — especially for:
- **Tauri plugin deps** (e.g. `@tauri-apps/plugin-*`): May be used only from Rust backend. If no JS imports exist but `lib.rs` registers the plugin, the npm package is safe to remove.
- **Unused exports**: If the symbol is used internally in the same file, just remove `export` instead of deleting.
### 3. Apply fixes
- Remove `export` keyword from internally-used-only symbols
- Delete entirely unused functions/types
- `bun remove <pkg>` for unused dependencies
- Remove empty directories
### 4. Iterate until `bunx knip` is clean
## Backend (Rust/Tauri)
### 1. Find unused Tauri commands
Compare `generate_handler![]` entries in `lib.rs` against actual frontend imports:
1. List all commands from `generate_handler![]`
2. Map to camelCase TypeScript names in `src/generated/commands.ts`
3. Grep `src/` (excluding `src/generated/`, `src/paraglide/`) for each name
4. Zero imports = unused command
### 2. Trace the dead code chain
For each unused command, trace downward through each architectural layer:
```
handler → service → repo → model
```
At each level, grep to verify no other callers exist before removing:
```bash
grep -r "service::module::fn_name" src-tauri/src/
```
### 3. Remove in order
1. Delete handler functions