# Convert code to another language or framework

Idiomatic translation of code between languages or frameworks, with notes on differences.

- Topic: Software Development
- Framework: RTF
- Level: Standard
- Tags: Coding, Write, Code, Fill-in Template
- Source: https://www.thinkwithprompt.com/prompts/convert-code-to-another-language-or-framework

## Prompt

```text
Convert this code from [SOURCE LANGUAGE/FRAMEWORK] to [TARGET LANGUAGE/FRAMEWORK].

**Code:**
[PASTE]
**Target version and constraints:** [e.g. Python 3.12, no external libraries]

Rules:
- Write idiomatic code for the target, not a line-by-line transliteration.
- Preserve behavior exactly, including edge cases and error handling.
- Use standard-library or well-maintained equivalents for dependencies; name them.

Return the converted code, a table mapping key constructs (source → target), behavior differences to watch for (integer division, nulls, async, string encoding), and tests to verify the conversion.
```

## What to fill in

- SOURCE LANGUAGE/FRAMEWORK
- TARGET LANGUAGE/FRAMEWORK
- PASTE
- e.g. Python 3.12, no external libraries

Free to copy and use. From ThinkWithPrompt (https://www.thinkwithprompt.com/), a library of 2,663 curated AI prompts.
