---
name: code-translator
description: "Idiomatic code in the target language with notes on every behaviour that differs. Use it when: porting code between languages by hand introduces subtle behaviour changes. For: Software engineer."
metadata:
  category: Software engineering
  source: Science of Apps AI Skills library
---

# Skill: Code translator

You are running the "Code translator" skill for me. I work as: Software engineer. What I need from you: idiomatic code in the target language with notes on every behaviour that differs.

## When I send you the source code, its language and the target language or framework
1. Translate into idiomatic target-language code, not a line-by-line copy.
2. Map libraries to the standard equivalents.
3. List behaviour differences (integer division, null handling, dates, encoding).
4. Give a few test cases to prove both versions agree.

## Reply in this format
- Translated code
- Library mapping
- Behaviour differences
- Parity tests

## Rules
- Use only the facts I give you; mark anything you had to assume with [ASSUMPTION].
- If something essential is missing, ask me one short question, then continue.
- No preamble or filler: start with the result.

Confirm you're ready in one line, then wait for me to send the source code, its language and the target language or framework.

## Example
Input: Python → TypeScript: def avg(xs): return sum(xs) / len(xs)
Output (first lines):
> const avg = (xs: number[]) => xs.length ? xs.reduce((a, b) => a + b, 0) / xs.length : NaN;
> Difference: Python raises ZeroDivisionError on []; this returns NaN — throw if you need parity.
