# Knip

> Knip is an open-source agent skill for developer tools. Runs knip to find and clean up unused files, dependencies and exports. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/ScaleDockHQ/better-supabase/tree/main/.agents/skills/knip
- **Repository:** https://github.com/scaledockhq/better-supabase
- **GitHub stars:** 5
- **License:** MIT
- **Skill name:** knip
- **Collection:** https://github.com/ScaleDockHQ/better-supabase
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill has the agent run knip, a static analysis tool for JavaScript and TypeScript projects, to locate dead code, unused files, unused dependencies and unused exports. It walks through a configuration-first process: the agent checks the project's package.json and any existing knip config, reads the configuration hints knip prints, adjusts settings such as plugins and entry patterns, and re-runs until false positives drop before removing anything.

The skill gives guidance on deletion safety. Clearly orphaned files and unused dependencies can be removed directly, while files that may be entry points, dynamically imported, or part of a public API should be confirmed with the user first. It also covers a production-only mode, optional auto-fix flags, and troubleshooting steps for knip errors. It notes that unused imports and variables inside files are outside knip's scope and belong to a linter such as ESLint or Biome.

Knip must be available in the project, either globally through npx or installed as a dev dependency using the package manager that matches the lockfile. The skill is written for codebases that use Node-based tooling.

## When your agent uses it

> Run knip to find and remove unused files, dependencies, and exports. Use for cleaning up dead code and unused dependencies.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/ScaleDockHQ/better-supabase/tree/HEAD/.agents/skills/knip)
- [License: MIT](https://github.com/ScaleDockHQ/better-supabase/tree/HEAD/.agents/skills/knip)

## Features

- **Configuration-first workflow:** Adjusts knip settings and reads configuration hints before acting on reported issues.
- **Prioritized cleanup order:** Works through unused files, dependencies, devDependencies, exports and types in a set sequence.
- **Deletion safety levels:** Separates high-confidence removals from changes that need user confirmation first.
- **Configuration best practices:** Guides use of plugins, entry patterns and ignoreExportsUsedInFile while avoiding broad ignore patterns.
- **Production mode and auto-fix:** Covers the --production flag and the --fix options, including optional file removal.
- **Error handling guidance:** Lists steps to take when knip exits with an error or fails to load a file.

## Good for

- Find unused npm dependencies in a TypeScript project
- Remove dead files that nothing imports
- Clean up unused exports across a codebase
- Tune knip config to reduce false positives
- Run knip in production mode to skip test and config files

## Install

### Claude Code

This skill ships in the `better-supabase` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add ScaleDockHQ/better-supabase
/plugin install better-supabase@better-supabase
```

Or copy only this skill to `~/.claude/skills/knip`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/knip &&
cp -R "$tmp/.agents/skills/knip" ~/.claude/skills/knip &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/knip` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/knip` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/knip &&
cp -R "$tmp/.agents/skills/knip" ~/.agents/skills/knip &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/knip` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/knip` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/knip &&
cp -R "$tmp/.agents/skills/knip" ~/.cursor/skills/knip &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/knip` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/ScaleDockHQ/better-supabase.git --path .agents/skills/knip
```

Or copy the folder to `~/.gemini/skills/knip` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/knip`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/knip &&
cp -R "$tmp/.agents/skills/knip" ~/.copilot/skills/knip &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/knip` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git
```

Then copy `better-supabase/.agents/skills/knip` into your agent's skills folder as `knip`. Agents that support SKILL.md read one folder per skill.

## FAQ

### How do I install the knip tool this skill uses?

The skill checks whether knip runs through npx and otherwise suggests installing it as a dev dependency with npm, pnpm, yarn or bun, matching the lockfile in the project.

### Does Knip remove unused imports or variables?

No. The skill states that knip does not handle unused imports or variables inside files and recommends ESLint or Biome for that.

### Will the agent delete files automatically?

Only high-confidence orphaned files are treated as safe to remove. Entry points, config files and public API files require asking the user first, and file deletion needs the --allow-remove-files flag.

### Which commands does Knip run?

It runs npx knip, npx knip --production, npx knip --fix and npx knip --reporter json, among others.

### How do I install Knip in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/knip to use it in all your projects, or to .claude/skills/knip in one project. Or install the better-supabase plugin, which includes it: /plugin marketplace add ScaleDockHQ/better-supabase, then /plugin install better-supabase@better-supabase.

### Does Knip run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Knip?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Knip?

The closest alternatives to Knip are Dead code cleanup edho ferdian, Antfu, Code simplifier, Vue ci and Kb lint.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Dead code cleanup edho ferdian](https://ai-powered.com/skills/dead-code-cleanup-edho-ferdian): Dead code cleanup edho ferdian is an open-source agent skill for developer tools.
- [Antfu](https://ai-powered.com/skills/antfu): Antfu is an open-source agent skill for developer tools.
- [Code simplifier](https://ai-powered.com/skills/code-simplifier): Code simplifier is an open-source agent skill for developer tools.
- [Vue ci](https://ai-powered.com/skills/vue-ci): Vue ci is an open-source agent skill for developer tools.
- [Kb lint](https://ai-powered.com/skills/kb-lint): Kb lint is an open-source agent skill for knowledge and memory.
- [Fix merge conflicts](https://ai-powered.com/skills/fix-merge-conflicts): Fix merge conflicts is an open-source agent skill for developer tools.
- [Readable code](https://ai-powered.com/skills/readable-code): Readable code is an open-source agent skill for developer tools.
- [Dependency cycle audit](https://ai-powered.com/skills/dependency-cycle-audit): Dependency cycle audit is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/knip
