code-translation
Installation
SKILL.md
Code Translation
Function-level translation between languages. The goal is observably equivalent behavior — same inputs → same outputs, same side effects, same error behavior. Not line-by-line transliteration; idiomatic code in the target.
For whole modules/packages, → module-level-code-translator (handles imports, file structure, cross-function concerns).
The three layers
- Syntax — the easy part.
for x in xs↔for (auto& x : xs). Mechanical. - Semantics — the dangerous part.
3 / 2is1in Python 2,1.5in Python 3,1in C. Integer overflow, null semantics, string encoding. - Idiom — the quality part.
[x*2 for x in xs if x > 0]→ Java stream, not a for-loop with an ArrayList. Optional but expected.