본문으로 건너뛰기
Skillpedia
일반 코딩6.5k · #14187

code-migration

하는 일

앱이나 라이브러리를 다른 언어로 옮기는 방법을 제시하며, 각 함수를 옮길 때마다 확인합니다. Java 앱을 Kotlin으로 옮기는 것처럼 소프트웨어를 다시 작성하는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓팀이 한 프로그래밍 언어의 라이브러리를 다른 언어로 옮기려 할 때.
  • ✓개발자가 이미 옮긴 함수와 남은 함수를 확인해야 할 때.
  • ✓팀이 같은 앱의 두 버전이 동작에서 여전히 일치하는지 확인하려 할 때.

스킬 링크

https://github.com/kucherenko/jscpd/blob/master/skills/code-migration/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/kucherenko/jscpd/blob/master/skills/code-migration/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 Python 라이브러리를 함수 하나씩 TypeScript로 옮겨 주세요. 남은 작업도 정리해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

스킬은 비교 도구로 원본 함수와 대응하는 함수를 짝짓습니다. AI에게 먼저 테스트를 옮기고, 그다음 그 테스트가 확인하는 코드를 옮기라고 안내하며, 그 결과로 진행 상황을 추적합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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:

  1. 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.

  2. Suggest a .gitignore to 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 .gitignore only after git init.

  3. Until the .gitignore works, 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
자주 묻는 질문

진행 상황은 어떻게 추적하나요?

비교 보고서를 사용해 어떤 함수가 다른 코드베이스에서 짝을 찾았고 어떤 함수가 찾지 못했는지 보여 줍니다.

테스트를 먼저 작성하는 이유는 무엇인가요?

각 함수는 그 동작을 증명하는 테스트와 함께 옮겨지므로, 새 버전을 키워 나가면서 확인할 수 있습니다.

둘 다 계속 사용 중인 두 앱도 비교할 수 있나요?

네. 같은 보고서로 두 가지 실행 중인 구현이 얼마나 일치하는지 보여 줄 수 있습니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
6.5k
순위
#14187
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬