explaingit

kucherenko/jscpd

5,626TypeScriptAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A code scanner that finds copy-pasted duplicate blocks across your whole codebase, supporting over 150 languages and producing HTML or text reports.

Mindmap

mindmap
  root((jscpd))
    What it does
      Find copy-pasted code
      150+ languages
      Duplication reports
      API server mode
    Tech Stack
      TypeScript
      npm
      LevelDB
    Use Cases
      Refactoring guide
      CI quality gate
      Embed in tools
      AI assistant skill
    Audience
      Developers
      Code quality teams
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Scan a project folder to get a report of every duplicated code block so you know what to refactor.

USE CASE 2

Add jscpd to a CI pipeline to automatically fail builds when copy-paste duplication exceeds a threshold.

USE CASE 3

Embed the core detection library into your own code quality tool without bundling the full CLI.

USE CASE 4

Use the jscpd agent skill to let Claude or Copilot detect duplicates and refactor them automatically.

Tech stack

TypeScriptJavaScriptnpmLevelDB

Getting it running

Difficulty · easy Time to first run · 5min

Installed via npm, no external services or infrastructure required to run a basic scan.

Open-source license allows free use, though the specific license is not detailed in the explanation.

In plain English

jscpd is a tool that scans your source code and finds blocks that have been copied and pasted from one place to another. Copy-pasted code is a common problem in software projects because it creates duplicate logic that must be updated in multiple places whenever something changes. This tool helps developers identify those duplicates so they can consolidate the code into a single reusable piece. The tool supports over 150 programming languages and file formats, so it works on almost any codebase regardless of what language it is written in. You point it at a folder or file pattern, and it produces a report listing every duplicated block it found, along with where each copy appears. Reports can be formatted as HTML, as a badge for a README, or as plain text for use in automated pipelines. There is also a server mode that exposes an API endpoint so other tools can send code snippets and receive duplication results. For developers who use AI coding assistants such as Claude or Copilot, jscpd includes an agent skill that teaches the assistant how to run the tool and then refactor the detected duplicates. This can be added with a single command and gives the assistant context about what jscpd does and how to interpret its output. The library is split into several packages so you can use just the core detection logic in your own tool without pulling in the full command-line interface. The detection algorithm is based on Rabin-Karp, a well-established method for finding repeated substrings efficiently. For very large repositories where memory is a concern, a LevelDB-backed storage option is available. jscpd is installed via npm, the standard package manager for JavaScript and TypeScript projects. It is actively maintained, used by several well-known code quality platforms, and available under an open-source license.

Copy-paste prompts

Prompt 1
Run jscpd on my project folder and explain the duplication report it produces. Which files have the most copy-pasted code and what should I refactor first?
Prompt 2
I want to add jscpd to my GitHub Actions CI pipeline so the build fails if duplication is above 5%. Write me the workflow step and the jscpd config to do that.
Prompt 3
How do I use the jscpd agent skill so that my AI coding assistant can detect and refactor copy-pasted code in my project?
Prompt 4
I have a large monorepo and jscpd is running out of memory. How do I switch to the LevelDB-backed storage mode?
Prompt 5
Show me how to use the jscpd npm package programmatically in a Node.js script to detect duplication and get results as a JavaScript object.
Open on GitHub → Explain another repo

← kucherenko on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.