No slash command · from typescript-plugin
Detects unused files, dependencies, exports, and types in JS/TS projects using Knip. Helps clean up codebases and enforce dependency hygiene in CI.
Ships in typescript-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Knip is a comprehensive tool for finding unused code, dependencies, and exports in JavaScript and TypeScript projects. It helps maintain clean codebases and catch dead code before it accumulates.
Knip finds statically unreachable code. Reach for a different tool for unused CSS (PurgeCSS), runtime dead code paths, bundle-size trimming (bundler tree-shaking), or duplicate dependencies (npm-dedupe).
What is Knip?
# Project-local (recommended)
bun add --dev knip
# Verify installation
bunx knip --version
# Run Knip (scans entire project)
bunx knip
# Show only unused dependencies
bunx knip --dependencies
# Show only unused exports
bunx knip --exports
# Show only unused files
bunx knip --files
# Production mode (only check production dependencies)
bunx knip --production
# Exclude specific issue types
bunx knip --exclude-exports-used-in-file
# Output JSON (for CI)
bunx knip --reporter json
# Debug mode (show configuration)
bunx knip --debug
Knip automatically detects:
main, exports, bin)No configuration needed for standard projects.
{
"$schema": "https://unpkg.com/knip@latest/schema.json",
"entry": ["src/index.ts", "src/cli.ts"],
"project": ["src/**/*.ts"],
"ignore": ["**/*.test.ts", "scripts/**"],
"ignoreDependencies": ["@types/*"],
"ignoreBinaries": ["npm-check-updates"]
}
// knip.ts
import type { KnipConfig } from 'knip';
const config: KnipConfig = {
entry: ['src/index.ts', 'src/cli.ts'],
project: ['src/**/*.ts', 'scripts/**/*.ts'],
ignore: ['**/*.test.ts', '**/*.spec.ts', 'tmp/**'],
ignoreDependencies: [
'@types/*', // Type definitions
'typescript', // Always needed
],
ignoreExportsUsedInFile: true,
ignoreWorkspaces: ['packages/legacy/**'],
};
export default config;
# Fastest check - only dependencies
bunx knip --dependencies
# Exit with error if any unused dependencies
bunx knip --dependencies --max-issues 0
Use in CI to enforce strict dependency hygiene.
# Check for unused exports
bunx knip --exports
# Allow exports used in same file
bunx knip --exports --exclude-exports-used-in-file
Use for libraries to ensure clean public API.
# Check production code only
bunx knip --production
# Check everything (including dev dependencies)
bunx knip
No unused files
No unused dependencies
2 unused exports
src/utils.ts:
- calculateTax (line 42)
- formatDate (line 58)
src/types.ts:
- UserRole (line 12)
| Type | Description | Action |
|---|---|---|
| Unused file | File not imported anywhere | Delete or add to entry points |
| Unused dependency | Package in package.json not used | Remove from dependencies |
| Unused export | Exported but never imported | Remove export or make private |
| Unused type | Type/interface exported but unused | Remove or make internal |
| Unused enum member | Enum member never referenced | Remove member |
| Duplicate export | Same export from multiple files | Consolidate exports |
| Context | Command |
|---|---|
| Quick scan | bunx knip |
| Dependencies only | bunx knip --dependencies |
| Exports only | bunx knip --exports |
| CI strict mode | bunx knip --max-issues 0 |
| Production check | bunx knip --production |
| JSON output | bunx knip --reporter json |
| Debug config | bunx knip --debug |
| Changed files | bunx knip --changed --base main |
| Flag | Description |
|---|---|
--dependencies | Check only unused dependencies |
--exports | Check only unused exports |
--files | Check only unused files |
--production | Production dependencies only |
--max-issues N | Fail if more than N issues |
--reporter json | JSON output for CI |
--reporter compact | Compact output |
--debug | Show configuration details |
--changed | Check only changed files |
--changed --base main | Changed files since main |
--workspace NAME | Check specific workspace |
--exclude-exports-used-in-file | Ignore same-file exports |
For detailed examples, advanced patterns, and best practices, see REFERENCE.md.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub laurigates/claude-plugins --plugin typescript-plugin18 skills in this plugin
/biome-toolingBiome all-in-one JS/TS formatter and linter, 15-20x faster than ESLint/Prettier. Use when setting up formatting/linting or migrating from ESLint+Prettier./bun-addBun add: install a package, add dev dependency, pin exact version, or target a workspace. Use when the user wants to add/install a specific package with bun./bun-buildBun build: bundle or compile JS/TS to production bundle or standalone binary. Use when the user wants to bundle, compile, or build for browser/bun/node target.Other plugins' skills for the same job