knip

knip is a skill for Claude Code, Codex from artivilla/agents-config. It costs 28 tokens per session (669 once invoked), scanned A, original, MIT.

A code-cleanup workflow built around Knip, a tool that detects unused files, packages, exports, and types in a project.

In plain words
What is it for?
Use it to scan a codebase, review unused files and package dependencies, remove high-confidence dead code, and configure the scan when framework-related false positives appear.
Why use it?
Unused code and dependencies make a project harder to understand and maintain, and can add unnecessary build or security concerns.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: names the AskUserQuestion tool.

Good fit Use it to scan a codebase, review unused files and package dependencies, remove high-confidence dead code, and configure the scan when framework-related false positives appear.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/artivilla/agents-config/knip
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add artivilla/agents-config --skill knip
Clone the repo
git clone --depth 1 https://github.com/artivilla/agents-config

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for knip

README.md
[![agentmods](https://agentmods.dev/badge/skills/artivilla/agents-config/knip.svg)](https://agentmods.dev/skills/artivilla/agents-config/knip)
Your own site
<a href="https://agentmods.dev/skills/artivilla/agents-config/knip"><img src="https://agentmods.dev/badge/skills/artivilla/agents-config/knip.svg" alt="Measured on agentmods" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 669 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.00669
Opus 5 $0.00014 $0.00334
Sonnet 5 $0.00006 $0.00134
Haiku 4.5 $0.00003 $0.00067

Measured 7d ago against content hash 72f6fc930e90, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

knip scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/knip/SKILL.md · 81 lines

How it starts

The opening of the file, as written. The whole thing — 81 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Knip Code Cleanup

Run knip to find and remove unused files, dependencies, and exports from this codebase.

Setup

  1. Check if knip is available:

    • Run npx knip --version to test
    • If it fails or is very slow, check if knip is in package.json devDependencies
    • If not installed locally, install with npm install -D knip (or pnpm/yarn equivalent based on lockfile present)
  2. If no knip.json or knip.jsonc config exists and knip reports many false positives, consider creating a minimal config based on the frameworks detected in package.json

Execution

  1. Run npx knip to get initial report
  2. Review the output categories:
    • Unused files - files not imported anywhere
    • Unused dependencies - packages in package.json not imported
    • Unused devDependencies - dev packages not used
    • Unused exports - exported functions/variables not imported elsewhere
    • Unused types - exported types not used

Cleanup Strategy

Auto-delete (high confidence):

  • Unused exports that are clearly internal (not part of public API)
  • Unused type exports
  • Unused dependencies (remove from package.json)
  • Unused files that are clearly orphaned (not entry points, not config files)

For these, proceed with deletion without asking. Use --fix --allow-remove-files for automated fixes, or manually delete/edit as needed.

Ask first (needs clarification):

  • Files that might be entry points or dynamically imported
  • Exports that might be part of a public API (index.ts, lib exports)
  • Dependencies that might be used via CLI or peer dependencies
  • Anything in paths like src/index, lib/, or files with "public" or "api" in the name

Use the AskUserQuestion tool to clarify before deleting these.

Workflow

  1. Run knip, capture full output
  2. Categorize each issue as auto-delete or needs-clarification
  3. Ask about uncertain items in a single batch question
  4. Perform all deletions (use Edit tool to remove exports, Bash to remove files/deps)
  5. Re-run knip to verify cleanup is complete
  6. Repeat until no issues remain or only intentionally-ignored items exist

Read the full file on GitHub · 81 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 81 lines · 28 tokens per session scan A 72f6fc930e90

Subscribe to this mod's changes

knip is a skill published in the GitHub repository artivilla/agents-config (0 stars, last pushed 3mo ago), licensed MIT. It adds 28 tokens to every session and 669 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories