Code Translation

高级development最低上下文:64K

Translates code between programming languages while preserving logic, idioms, and best practices of the target language. Handles differences in type systems, error handling, concurrency models, and standard library APIs. Produces idiomatic target code, not line-by-line transliteration.

使用场景

  • Migrating Python scripts to TypeScript
  • Porting Java libraries to Kotlin or Go
  • Converting JavaScript to TypeScript with proper types
  • Translating shell scripts to Python for cross-platform support
  • Rewriting legacy code in modern language equivalents

示例提示词

Translate the following code from [source language] to [target language].

Requirements:
- Use idiomatic patterns of the target language (not line-by-line translation)
- Preserve all business logic and edge case handling
- Use appropriate target language equivalents for:
  - Error handling (exceptions vs Result types vs error codes)
  - Concurrency (async/await, goroutines, threads)
  - Collections and data structures
- Add type annotations where the target language supports them
- Note any behavioral differences between source and target

Source code ([source language]):
```
[paste code here]
```

推荐模型

兼容工具

claude-codecursorgithub-copilotkiroany

模态

输入: code, text
输出: code, text

相关 Skills

作者

OpenModels Community

@openmodelsrun