compare-codebases
What it does
It explains how to pair the functions in two codebases and report what each has that the other lacks. It is for developers checking how two projects relate or how far a port has come.
When to use it
- ✓When a team wants to know which functions one version of an app has that the other lacks.
- ✓When a developer wants to check whether the iOS and Android versions of an app match.
- ✓When a developer needs to find which function in one folder corresponds to a function in another.
Skill link
https://github.com/kucherenko/jscpd/blob/master/skills/compare-codebases/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Compare our iOS and Android code folders and tell me which functions the Android app is missing.”
5 new skills a week. 1 minute to read.
How it works
The skill runs a comparison that matches functions by what they do rather than by name. It then explains the matched and unmatched functions in plain terms.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
compare-codebases
jscpd --compare A B pairs every function of folder A with the function of folder B that does the same job, and lists the functions of each folder that have no counterpart. The two folders may be in one language or in two (Python and TypeScript, Kotlin and Swift, Java and Rust). This skill explains how the comparison works and how to run one well. For porting code with the comparison as the progress measure, use the code-migration skill; for the rest of jscpd, the jscpd skill.
How the comparison works
jscpd finds the functions of JavaScript, TypeScript, JSX, TSX, Vue, Svelte, Astro, Python, Rust, Go, Java, Kotlin, C#, C, C++, PHP, Ruby, Scala and Swift files in both folders. It turns the code of each function into a vector with a code embedding model that runs inside jscpd (CodeRankEmbed by default), so two functions that do the same job point the same way even when their languages, names and structure differ. Functions of one folder are never compared with each other.
Functions pair in two steps:
- By code. Two functions pair when each is the other's closest match in the other folder, their cosine similarity reaches the model's threshold (0.4125 across languages and 0.6375 within one language, with CodeRankEmbed), and the similarity stands out from the function's other matches. A function close to the best one also pairs when it reaches a higher bar, so a feature written twice on one side gets two pairs. A pair stays only when it is the best match of at least one of its two functions, so a lookalike from another class does not join a function and its counterpart; a tie goes to the file of the same name. Functions shorter than
--min-tokens(30 with--compare) or--min-lines(5) stay out of this step, because a short function resembles too many others. - By name. A function left over pairs with a function of the other folder under the same name, once case, underscores, spaces and punctuation are ignored (
encodeBinary,encode_binary,_encode_binary; the test titlerounds centsandrounds_cents), when their similarity reaches themediumlevel (0.5625 across languages with CodeRankEmbed). A name pair skips the closest-match and stand-out checks of the first step, so it needs more than that step's threshold; otherwise everyloadandinitof two codebases would pair. Size does not matter here, so a short port is found. A name pair has to stay within modules the first step linked. A module is the folder right under the deepest folder all files of a side share (notificationinandroid/notification/…), and a file that sits higher than the rest, such as a build script, does not move that folder up. Two modules link when one holds the most of the other's pairs, counted for code and for tests separately. SocheckPermissionsof one plugin does not pair with its namesake in another.
Each pair gets a level on the scale of the model, because a cosine that is high for one model is low for another:
| Level | With CodeRankEmbed, across languages | Meaning |
|---|---|---|
high |
0.7125 and up | almost always the same function |
medium |
0.5625 to 0.7125 | usually the same function, restructured |
low |
0.4125 to 0.5625 | read both: related code pairs here too |
jscpd measures tests and code apart, in two blocks of the report, and pairs a test only with a test. It tells a test by the conventions of its language:
- a test file such as
*_test.go,test_*.py,*.test.ts,*.spec.js,*Tests.swiftor*_spec.rb; - a test folder such as
tests/,__tests__/,spec/,src/test/(where Java, Kotlin and Scala keep their tests),MyAppTests/orMyApp.Tests.Integration/, the compared folder's own name included; - a Rust function in a
#[cfg(test)]module or under#[test]; - a JavaScript or TypeScript test case such as
it('rounds cents', () => …).
When neither side has a test that counts (see below), the report has one block and no headings.
Totals count the functions of at least --min-tokens tokens and --min-lines lines; smaller ones appear only as partners. Declarations without a body (TypeScript overloads, the functions of a .d.ts file, interface and abstract methods) take no part. Anonymous functions (callbacks, closures) take no part either, except JavaScript and TypeScript test cases. A test case such as it('rounds cents', () => …) goes by its title, and so do those written with test,
FAQ
Does it need the same language?
No. The two folders can be in different languages, such as Python and TypeScript.
Does it match functions by name?
No. It matches functions by what they do, using a code embedding model.
Does it compare functions inside one folder?
No. It compares functions across the two folders only.
Details
Original description by the author
Compare two folders function by function with jscpd --compare, in the same language or across languages, and explain the result. Use when asked how two codebases relate, which functions one implementation has and the other lacks, how far a port has come, whether the iOS and Android versions of an app match, or which function in one folder corresponds to a function in the other.
repo: kucherenko/jscpd
Popularity
- GitHub stars
- 6.5k
- Ranking position
- #14189
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
code-migration
6.5kHelps your agent port code from one language or framework to another, one function at a time, with tests first and progress measured against the original.
codebase-refactoring
6.5kHelps your agent improve a codebase's health by fixing duplicated code, removing dead code and simplifying the most complex files, in that order.
dry-refactoring
6.5kHelps your agent remove copy-pasted code from a project by merging repeated blocks into shared functions, starting with the largest repeats.
jscpd
6.5kHelps your agent find copy-pasted code in a project, in exact, renamed or near-copy forms, and measure how much of the code is duplicated.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.