Code Converter

Idiomatic code translation between Python, TypeScript, and Go that preserves logic and adapts language-specific patterns.

Install
cmdop skills install agensi-code-converter

Code Converter is a skill that translates source code across Python, TypeScript, JavaScript, and Go while maintaining idiomatic integrity rather than performing a literal character-for-character substitution. It analyzes code logic and remaps constructs to the target language’s natural patterns: Python list comprehensions become TypeScript .map() calls, Go structs are transformed into Python classes, and naming conventions such as snake_case and camelCase are adapted automatically.

When converting to TypeScript, the skill generates proper types instead of falling back to ‘any’, keeping the output type-safe. Standard library calls are remapped to their target-language equivalents — for example, Python’s os.path maps to the Node.js path module, and json maps to the JavaScript JSON global. Async/await patterns and error-handling idioms are also translated according to the conventions of the destination language.

Comments and documentation are preserved through the conversion so that existing inline documentation carries over rather than being discarded. This makes it suitable for porting a library, migrating a microservice, or onboarding into an unfamiliar language by studying a converted version of familiar code.

The skill is scoped to the four listed languages. It is not intended for lower-level languages such as C, Rust, or Java, and it does not perform runtime testing or guarantee that the output is production-ready without human review.

Use cases

  • Migrate a Python microservice to Go while preserving logic and adapting error-handling idioms
  • Port a JavaScript utility library to TypeScript with generated type annotations instead of 'any'
  • Translate a Go struct-based data model into Python classes for use in a data pipeline
  • Convert Python scripts that use os.path and datetime to their Node.js equivalents
  • Onboard into an unfamiliar language by converting familiar code and studying the idiomatic output
  • Automate renaming of snake_case identifiers to camelCase when moving between Python and TypeScript

When to use it

  • Porting existing code between Python, TypeScript, JavaScript, and Go
  • When idiomatic output matters and a literal translation would produce unreadable code
  • When TypeScript type safety is required and 'any' is not acceptable
  • When standard library mappings need to be handled automatically alongside logic translation

When not to use it

  • Target or source language is outside the supported set (Python, TypeScript, JavaScript, Go)
  • The code requires runtime validation or automated testing of the converted output
  • The conversion involves languages such as C, Rust, or Java
  • Production deployment without human review of the translated output is expected