codebase-hygiene
БесплатноБез исполняемых скриптовНе проверенFind unused code and dependencies (knip) and duplicated code (jscpd) in the desktop app, then review the findings with the user and clean up what they…
от dannysmith★ 22 звезды на GitHubОб этом скилле
Codebase Hygiene
Two tools, run from tdn-desktop/ (paths below are relative to it), together or separately depending on the request:
- knip (
bun run knip): unused files, dependencies and exports. Config inknip.json. - jscpd (
bun run jscpd): duplicated code insrc/andsrc-tauri/src/. Config in.jscpd.json. It exits non-zero whenever it finds any duplication (the threshold is 0), and writesjscpd-report/, which is gitignored; delete it afterwards.
Both produce false positives. Treat their output as leads to investigate, not a list of things to delete. Nothing is removed or refactored without the user's approval, except dependencies with zero usage anywhere.
knip: what not to remove
- Code reached from Rust: listeners for Tauri events (
listen(...)insrc/hooks/use-main-window-event-listeners.ts,src/services/vault/init.tsand the quick pane) and anything named insrc-tauri/emit(...)calls, such as the vault-changed event. Grepsrc-tauri/srcfor the name before calling something unused. - Generated bindings:
src/lib/bindings.tsis written by tauri-specta. Unused commands or types there mean the Rust command is unused; remove it on the Rust side, and the bindings regenerate. @tauri-apps/*packages: each JS plugin pairs with a Rust crate. Remove a plugin from both sides or neither, and checksrc-tauri/capabilities/.- Barrel files (
index.ts): they export their directory's public API on purpose, which is why knip ignores them. src/components/ui/: shadcn components, ignored by knip, so dependencies only they use (likenext-themesinsonner.tsx) show as unused. Ask the user before removing a component or its dependency; they're cheap to re-add through the shadcn CLI.
If knip reports live code as unused, the config is wrong. Fix knip.json before trusting anything else it says.
jscpd: judging duplication
Duplication is only worth removing when one copy changing without the other would be a bug.
- Usually extract: business logic or data transformation over ~15 lines, anything in 3+ places, and duplicated logic in
src/lib/,src/services/or Rust command handlers. - Usually keep: short patterns, React component boilerplate, test setup, Rust error-handling idioms, deliberately parallel code (the per-view
use-*-orderhooks, the kanban boards), and type definitions kept separate for decoupling.
Put extracted code where docs/developer/architecture-guide.md says: pure logic in src/lib/, hooks in src/hooks/, shared Rust helpers next to their callers.
Process
- Run the tool(s) and read the surrounding code for every finding. Don't judge from the report alone.
- Present the findings grouped by confidence: what you'd remove or extract and why, what's probably intentional, and what you can't tell.
- Make only the changes the user approves. For duplication they decide to keep, add a short comment explaining why, if the reason isn't obvious.
- Run
bun run check:all.
Установить codebase-hygiene в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл codebase-hygiene?
Find unused code and dependencies (knip) and duplicated code (jscpd) in the desktop app, then review the findings with the user and clean up what they approve. Use when the user asks to clean up dead code, unused dependencies or exports, or to review duplication.
Как установить скилл codebase-hygiene?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл codebase-hygiene запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic