# Code Migration

Ports code function by function, tests first, and checks implementation parity.

- Repository: https://github.com/kucherenko/jscpd (6480 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add kucherenko/jscpd --skill code-migration -g -a claude-code -y`
Codex: `npx skills add kucherenko/jscpd --skill code-migration -g -a codex -y`
Cursor: `npx skills add kucherenko/jscpd --skill code-migration -g -a cursor -y`
Gemini CLI: `npx skills add kucherenko/jscpd --skill code-migration -g -a gemini-cli -y`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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](#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](#parity-between-two-implementations).

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](../compare-codebases/SKILL.md) skill explains how the comparison pairs functions and how to check its result; the [jscpd](../jscpd/SKILL.md) 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:

```bash
npx jscpd --semantic-download
```

jscpd caches the vectors, so a repeat run embeds only the functions whose code changed and takes seconds.

The rest: https://github.com/kucherenko/jscpd/blob/HEAD/skills/code-migration/SKILL.md
