compare-codebases
Что он делает
Навык объясняет, как сопоставить функции в двух кодовых базах и сообщить, что есть в каждой и чего нет в другой. Он нужен разработчикам, которые проверяют, как связаны два проекта или насколько продвинулся перенос.
Когда использовать
- ✓Когда команде нужно узнать, какие функции есть в одной версии приложения и отсутствуют в другой.
- ✓Когда разработчик хочет проверить, совпадают ли версии приложения для iOS и Android.
- ✓Когда разработчику нужно найти, какая функция в одной папке соответствует функции в другой.
Ссылка на скилл
https://github.com/kucherenko/jscpd/blob/master/skills/compare-codebases/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Сравните наши папки с кодом для iOS и Android и скажите, каких функций не хватает Android-приложению.”
5 новых скиллов в неделю. 1 минута чтения.
Как это работает
Навык запускает сравнение, которое сопоставляет функции по тому, что они делают, а не по имени. Затем он объясняет совпавшие и несовпавшие функции простыми словами.
Технический текст (оригинальный SKILL.md)
Оригинальный текст автора на английском, прямо с 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,
Частые вопросы
Нужен ли один и тот же язык?
Нет. Две папки могут быть на разных языках, например Python и TypeScript.
Сопоставляет ли он функции по имени?
Нет. Он сопоставляет функции по их назначению, используя модель эмбеддингов кода.
Сравнивает ли он функции внутри одной папки?
Нет. Он сравнивает функции только между двумя папками.
Подробности
Оригинальное описание автора
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
Популярность
- Звёзды на GitHub
- 6.5k
- Место в рейтинге
- #14189
- Лицензия
- MIT
- Обновлён
- 02.11.2026
Комментарии
- …
Другие скиллы из этого репозитория
code-migration
6.5kПомогает агенту переносить код с одного языка или фреймворка на другой по одной функции за раз, с тестами в первую очередь и прогрессом, измеряемым относительно оригинала.
codebase-refactoring
6.5kПомогает агенту улучшить состояние кодовой базы: устранить дублирование кода, удалить мёртвый код и упростить самые сложные файлы, именно в этом порядке.
dry-refactoring
6.5kПомогает агенту убрать из проекта скопированный код, объединяя повторяющиеся блоки в общие функции, начиная с самых больших повторов.
jscpd
6.5kПомогает агенту находить в проекте скопированный код в точной, переименованной или почти одинаковой форме и измерять, какая доля кода дублирована.
Похожие скиллы
diffs
394kПозволяет агенту создать настоящее сравнение правок в виде ссылки или файла изображения, которым можно поделиться, вместо ручной сводки.
coding-agent
394kПомогает агенту передать большую задачу по коду в Codex, Claude Code или OpenCode как фоновому исполнителю, а затем проверять ее ход.
gh-issues
394kПомогает агенту находить задачи GitHub, выбирать, над какими работать, и открывать запросы на слияние с исправлениями, включая ответы на комментарии рецензентов.