code-migration
Ce qu’il fait
Ce guide propose une méthode pour migrer une application ou une bibliothèque vers un autre langage, en vérifiant chaque fonction au fil du travail. Il s'adresse aux développeurs qui réécrivent des logiciels, par exemple une application Java portée en Kotlin.
Quand l’utiliser
- ✓Quand une équipe veut porter une bibliothèque d'un langage de programmation vers un autre.
- ✓Quand un développeur doit voir quelles fonctions ont déjà été portées et lesquelles restent à faire.
- ✓Quand une équipe veut vérifier que deux versions d'une même application ont toujours le même comportement.
Lien du skill
https://github.com/kucherenko/jscpd/blob/master/skills/code-migration/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Aidez-moi à porter cette bibliothèque Python vers TypeScript, une fonction à la fois, et à suivre ce qui reste à faire.”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
Le skill utilise un outil de comparaison pour associer chaque fonction source à son équivalent. Il demande à l'IA de porter d'abord les tests, puis le code qu'ils vérifient, et utilise les résultats pour suivre la progression.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis GitHub.
code-migration
jscpd --compare SOURCE TARGET pairs every function of one folder with the function of the other folder that does the same job, in any pair of languages, and lists the functions that have no counterpart. This skill uses it to measure a port: what is ported, what is left, and whether the port you just wrote was recognized.
A port runs in two phases: the tests first, then the code they check. A coverage report of the source's tests tells which tests exercise which function, so each function is ported together with the tests that prove it works. See Plan: tests first, then code.
Two words are used throughout:
- source: the implementation you port from, such as the iOS app, the Python library, or the JavaScript package;
- target: the implementation you port to, such as the Android app, the Rust crate, or the TypeScript rewrite.
Neither has to be old or new. The source may stay in production and keep changing, and the target may already hold features the source lacks. For two implementations that both live on (ios/ and android/), the same report shows parity; see Parity.
jscpd finds functions in JavaScript, TypeScript, JSX, TSX, Vue, Svelte, Astro, Python, Rust, Go, Java, Kotlin, C#, C, C++, PHP, Ruby, Scala and Swift. The compare-codebases skill explains how the comparison pairs functions and how to check its result; the jscpd skill covers the rest of the tool.
Setup
--compare pairs functions with a code embedding model that runs inside jscpd. Download it once (548 MB, CodeRankEmbed). Ask the user before you start the download:
npx jscpd --semantic-download
jscpd caches the vectors, so a repeat run embeds only the functions whose code changed and takes seconds.
Pick the two paths and keep them fixed for the whole port: the source first, the target second. Two paths are required, and they must not overlap (app/ and app/android/ is refused). The target may be empty at the start.
One run measures both phases: the report has a Code block and a Tests block (a code and a tests section in JSON), and a test pairs only with a test. jscpd tells a test by the conventions of its language: test files such as *_test.go, test_*.py, *.test.ts or *Test.java, folders such as tests/, __tests__/ or src/test/, Rust tests in #[cfg(test)] modules, and JavaScript test cases such as it('rounds cents', () => …). Phase 1 reads the Tests block, phase 2 the Code block.
Keep vendored and generated code out
--compare counts and embeds every function in both paths. Vendored dependencies (vendor/ from cargo vendor or go mod vendor, third_party/), installed packages (node_modules/, .venv/), build output (target/, build/, dist/) and generated code are not part of the port, yet a vendored crate tree alone holds thousands of functions. With them in a path, the first run embeds all of them and takes tens of minutes instead of seconds, and the percentages describe the dependencies instead of the port.
jscpd skips what .gitignore excludes, but only inside a git repository. Before the first run:
Check both paths for such folders. A target you create for the port gets them as soon as you build it or vendor its dependencies, so check again after the first build.
Suggest a
.gitignoreto the user that lists the folders the target's language and tools produce, plus the report folder. For a Rust addon built with napi-rs:/target/ /vendor/ node_modules/ *.node .jscpd-compare/If the target is not in a git repository, tell the user that jscpd reads the
.gitignoreonly aftergit init.Until the
.gitignoreworks, pass the same folders with--ignore, and keep the globs the same for every run:npx jscpd --compare node-lib/ rust-lib/ --ignore "**/vendor/**,**/target/**,**/node_modules/**"
The totals line shows when something slipped through. Suspect vendored or generated code in a path when the target has far more functions than the source, or when a run embeds hundreds of functions after a small change.
Measure
Run the console report for yourself and for the user. Here a Python billing library is being ported to TypeScript:
npx jscpd --compare billing-py/ billing-ts/
71% 5 of 7 functions in billing-py/ have a counterpar
Questions fréquentes
Comment suit-il la progression ?
Il utilise un rapport de comparaison qui indique les fonctions ayant un équivalent dans l'autre base de code et celles qui n'en ont pas.
Pourquoi écrire les tests d'abord ?
Chaque fonction est portée avec les tests qui prouvent son bon fonctionnement, ce qui permet de vérifier la nouvelle version au fur et à mesure.
Peut-il comparer deux applications qui restent toutes deux en usage ?
Oui. Le même rapport peut montrer à quel point deux implémentations en service concordent.
Détails
Description originale de l’auteur
Move code from one implementation to another function by function, tests first and code second, and check two implementations of one app for parity, with jscpd --compare as the progress measure and a coverage map binding each function to its tests. Use when porting a library or app to another language or framework (Java to Kotlin, JavaScript to Rust, a Python library to TypeScript, an iOS app to Android), when asked what is left to port, or when comparing the Android and iOS versions of an app.
repo: kucherenko/jscpd
Popularité
- Étoiles GitHub
- 6.5k
- Position au classement
- #14187
- Licence
- MIT
- Mis à jour
- 02/11/2026
Commentaires
- …
Autres skills de ce dépôt
codebase-refactoring
6.5kAide votre agent à améliorer la santé d'une base de code en corrigeant le code dupliqué, en supprimant le code mort et en simplifiant les fichiers les plus complexes, dans cet ordre.
compare-codebases
6.5kAide votre agent à comparer deux dossiers de code fonction par fonction, même entre langages, pour voir quelles fonctions correspondent et lesquelles manquent.
dry-refactoring
6.5kAide votre agent à supprimer le code copié-collé d'un projet en regroupant les blocs répétés dans des fonctions communes, en commençant par les répétitions les plus importantes.
jscpd
6.5kAide votre agent à trouver le code copié-collé d'un projet, sous forme exacte, renommée ou approximative, et à mesurer la part de code dupliquée.
Skills similaires
diffs
394kPermet à votre agent de produire un diff réel et partageable de vos modifications, sous forme de lien ou d'image, plutôt qu'un résumé écrit à la main.
coding-agent
394kAide votre agent à confier une tâche de programmation plus importante à Codex, Claude Code ou OpenCode comme travailleur en arrière-plan, puis à suivre sa progression.
gh-issues
394kAide votre agent à trouver des tickets GitHub, choisir ceux à traiter et ouvrir des pull requests avec des correctifs, y compris le suivi des commentaires de relecture.