knip
/knip
Uruchamia Knip, by znaleźć nieużywane pliki, zależności, eksporty i typy w projektach TypeScript i JavaScript, oraz konfiguruje knip.json lub knip.ts.
- Autor
- acaprino ↗
- Repozytorium
- alfio-claude-plugins ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 27.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 3
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 27.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Uruchamia Knip, by znaleźć nieużywane pliki, zależności, eksporty i typy w projektach TypeScript i JavaScript, oraz konfiguruje knip.json lub knip.ts.
Oryginalny opis (EN)
Run Knip to find unused files, dependencies, exports and types in TypeScript and JavaScript projects. TRIGGER WHEN: cleaning up TypeScript/JavaScript dead code, finding unused npm dependencies or exports, or configuring knip.json/knip.ts. DO NOT TRIGGER WHEN: the target is a Python codebase (use python-dead-code).
Jak działa
- Reference router
- 1. Installation and CLI Usage
- 2. Configuration
- 3. Interpreting Results and Adoption Order
Podgląd SKILL.md
---
name: knip
description: >
Run Knip to find unused files, dependencies, exports and types in TypeScript and JavaScript projects.
TRIGGER WHEN: cleaning up TypeScript/JavaScript dead code, finding unused npm dependencies or exports, or configuring knip.json/knip.ts.
DO NOT TRIGGER WHEN: the target is a Python codebase (use python-dead-code).
---
<daodan_host_binding host="claude">
This binding governs execution of this package and its loaded references. It takes
precedence over executable examples written for another host. Use only registered
tools and their actual input schema; an example never creates a tool, argument,
permission, model alias or nested worker capability. Preserve the generated worker
allowlist, dependency closure, scope and delivery contracts.
Claude binding: repository tools are Read/Glob/Grep and Write/Edit; shell execution
uses Bash and network fetch uses WebFetch. Pass the executable string in Bash's
command field, and use its registered timeout/background schema. Worker dispatch
uses the available native Agent mechanism and its registered agent-selection and
prompt fields. Do not turn a prose role label into an invented role argument.
Inherit the session model unless the declared workflow and active schema permit an
override. Load installed skills by qualified ID; named roles use their owning
plugin's agent identity, while workflow entries use /<plugin>:<workflow>.
Required foreign providers use Claude's marketplace/install commands:
claude plugin marketplace add <source>, then claude plugin install <provider>@<marketplace>.
A provider that is installed but disabled is enabled with
claude plugin enable <provider>@<marketplace>; check `claude plugin list --json`
before the first phase, and stop with that command when any plugin of this
package's dependency closure, direct or transitive, is off.
A declared package MCP server is configured through the generated MCP manifest;
still check its tools are actually available in the active session.
The executing agent and its coordinator own continuation, recovery, verification
and delivery. Skills supply knowledge and method instructions; they are not
executors or a runtime persistence mechanism.
Resolve each component by kind and exact installed identity. A role is dispatched
as a worker, a skill loads instructions, and a workflow starts its declared method.
Kernel owner-qualified skill references are logical provider identities: resolve
them to the actual host registry name and verified installed provider path. Do not
invent a registry string by adding an owner's prefix when the host does not use it.
Do not load an agent identity as a skill or execute a workflow name as a shell
command. Declared required foreign providers remain mandatory. If a required
provider or capability (including required MCP access or isolation) is unavailable,
stop its dependent phase and report the missing capability. Optional external
providers follow the method's declared selection and absence behavior; their
absence alone does not block the base workflow. Report any explicitly requested
but unavailable provider contribution as unfulfilled and continue independent
work. Do not install a different host's plugin or
substitute unrelated skills to claim coverage.
Shell execution alone does not establish interactive stdin. Before a capture or
checkpoint, use an available session-control mechanism. When stdin is unavailable,
keep user-driven capture in a supported background process with bounded output and
an explicit stop signal controlled by the coordinator after the user's completion
message. Close owned browser/process resources on completion or cancellation.
Continue working within the current authorization while the requested result is
achievable. After a tool error, inspect its cause, correct the relevant input or
implementation, retry when justified and verify the outcome; never repeat a
failing action blindly. Do not close the turn with a promise or a partial result
when an authorized next step can still produce or verify the requested result.
Stop only for a documented real impediment, a missing required capability, an
unresolved human decision or the caller's stop request. At that boundary, report
completed results, remaining work and the concrete prerequisite for continuation;
continue any independent work that the blocker does not prevent.
A tool's successful exit, a worker stop or an idle session is not the deliverable.
Return final text naming observed findings, artifact paths, executed checks and
blockers. An empty worker result is missing delivery: inspect or resume that worker
when permitted, or record failure. Verify required artifacts and candidate gates
before marking the requested outcome complete.
This is an execution binding, not a rewrite of source examples. Preserve programming
language fences, domain code and host APIs that are the subject of marketplace-ops
or agent-sdk-builder. A host-as-subject API is not a tool provided to this session.
Compiled binding and static checks do not prove an installed host executed a run.
</daodan_host_binding>
# Knip Dead Code Detection
Knip finds unused files, dependencies, exports, types, and enum/class members across JavaScript and TypeScript repositories (including monorepos), backed by 80+ framework and tool plugins.
## Reference router
| Task | Reference |
|---|---|
| Framework/test-runner plugin overrides, monorepo workspace config, JSDoc/`@public` ignores, CI pipelines, or troubleshooting false positives | `references/plugins-ci-and-troubleshooting.md` |
## 1. Installation and CLI Usage
> Examples use `npx`; equivalent commands work with `pnpm dlx`, `bunx`, or `yarn dlx`.
```bash
npm install --save-dev knip
# Scan entire project
npx knip
# Focused scans
npx knip --dependencies
npx knip --exports
npx knip --files
# Production mode (production entry points and dependencies only)
npx knip --production
# Exclude exports used within the same file
npx knip --exclude-exports-used-in-file
# Machine-readable JSON output or config debugging
npx knip --reporter json
npx knip --debug
```
## 2. Configuration
Knip works zero-config on standard projects by reading `package.json` (`main`, `exports`, `bin`, `scripts`) and framework/test configs (`next.config.*`, `vite.config.*`, `vitest.config.*`, `tsconfig.json`).
### `knip.json` or `knip.ts` (Explicit Configuration)
```typescript
// knip.ts
import type { KnipConfig } from 'knip';
const config: KnipConfig = {
entry: ['src/index.ts', 'src/cli.ts', 'scripts/**/*.ts'],
project: ['src/**/*.{ts,tsx}', 'scripts/**/*.ts'],
ignore: [
'**/*.test.ts',
'**/*.spec.ts',
'**/__tests__/**',
'**/__mocks__/**',
'dist/**',
'build/**',
'coverage/**',
'.next/**',
],
ignoreDependencies: [
'@types/*',
'typescript',
'tslib',
],
ignoreBinaries: ['npm-check-updates', 'semantic-release'],
ignoreExportsUsedInFile: true,
};
export default config;
```
## 3. Interpreting Results and Adoption Order
| Issue Type | Meaning | Action |
|---|---|---|
| Unused file | File not reachable from any entry point | Delete file or add to `entry` |
| Unused dependency | Package in `package.json` never imported | Remove from `package.json` |
| Unused export | Exported value never imported externally | Remove `export` keyword or delete |
| Unused type | Exported type/interface never imported | Make internal or delete |
| Unused enum/class member | Member never referenced | Remove member |
| Duplicate export | Same symbol re-exported multiple ways | Consolidate exports |
Recommended adoption sequence on an existing codebase:
1. `npx knip --dependencies --max-issues 0` (highest signal, lowest false-positive rate)
2. `npx knip --exports --exclude-exports-used-in-file`
3. `npx knip --files` and full `npx knip --production`
Pliki w paczce (3)
- SKILL.md 8 KB
- SKILL.toml 1 KB
- references/plugins-ci-and-troubleshooting.md 8 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · acaprino/alfio-claude-plugins | 100 | MIT |
| acaprino/alfio-claude-plugins | 100 | MIT |
| acaprino/alfio-claude-plugins | 100 | MIT |
| acaprino/alfio-claude-plugins | 100 | MIT |
| acaprino/alfio-claude-plugins | 100 | MIT |
| TerminalSkills/skills | 100 | Apache-2.0 |
| acaprino/alfio-claude-plugins | 100 | MIT |
| artivilla/agents-config | 100 | MIT |
Identyczna treść występuje jeszcze w 1 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.
Migawka bazy z 13.11.2026 · wersja paczki 8f4c465ea920 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100knip-dead-code
Wykrywa martwy kod w JS i TS za pomocą Knip: nieużywane pliki, zależności, eksporty i typy, przy porządkowaniu kodu i kontroli zależności w CI. - 100knip-deadcode
Podaje dobre praktyki wykrywania martwego kodu narzędziem Knip w projektach JavaScript i TypeScript: konfiguracja, analiza nieużywanego kodu, integracja z CI i porządkowanie. - 90skif
Sprawdza zależności w monorepo JavaScript i TypeScript narzędziem skif: reguły manifestów, polityki wersji, nieużywane pakiety i pliki oraz poprawki. - 100plan-dead-code
Planuje audyt martwego kodu z bazą Knip: nieużywane pliki, eksporty i zależności, duplikacje, pozostałości debugowania, wyciszenia, osierocone zasoby i rozjazdy zmiennych środowiskowych, niczego nie usuwając. - 100fec-refactor-clean
Bezpiecznie usuwa martwy kod frontendu: nieużywane eksporty, stare komponenty i trasy oraz zależności znalezione przez knip, depcheck, ts-prune, TypeScript i ESLint. - 100dead-code-analyzer
Analizuje bazę kodu pod kątem martwego kodu, duplikatów i zależności cyklicznych narzędziami knip, jscpd i madge, a następnie odsiewa fałszywe alarmy.