code-translation

Featured

Convert code between programming languages while preserving functionality and semantics. Use when: (1) Translating functions, classes, or modules between languages (Python, JavaScript/TypeScript, Java, Go, Rust, C/C++), (2) Migrating entire projects to a different language, (3) Need idiomatic translation that follows target language conventions, (4) Converting between different paradigms (OOP to functional, etc.), (5) Porting legacy code to modern languages. Provides language-specific patterns, idiomatic translation guides, and project migration strategies.

Code & Development 252 stars 23 forks Updated 3 weeks ago Apache-2.0

Install

View on GitHub

Quality Score: 87/100

Stars 20%
80
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Code Translation Convert code between programming languages while preserving functionality, adapting to target language idioms and best practices. ## Translation Workflow ### 1. Analyze Source Code Understand what the code does: - Core functionality and algorithms - Dependencies and external libraries - Language-specific features used - Performance characteristics ### 2. Choose Translation Strategy **Direct Translation**: Literal conversion maintaining structure - **Use for**: Simple algorithms, data transformations, utility functions - **Pros**: Faster, easier to verify correctness - **Cons**: May not be idiomatic in target language **Idiomatic Translation**: Adapt to target language patterns - **Use for**: Production code, public APIs, long-term maintenance - **Pros**: Native-feeling code, better performance, maintainable - **Cons**: Takes longer, requires deep language knowledge **Recommended**: Start with direct translation, then refine to idiomatic. ### 3. Translate Code Perform the translation following language patterns and conventions. ### 4. Verify Correctness Ensure translated code behaves identically to source: - Port existing tests - Add behavioral tests - Compare outputs on same inputs ## Quick Translation Examples ### Python → JavaScript **Source (Python)** ```python def calculate_total(items): """Calculate total price with tax.""" subtotal = sum(item['price'] * item['quantity'] for item in items) tax = subtotal * 0.08 return sub...

Details

Author
ArabelaTso
Repository
ArabelaTso/Skills-4-SE
Created
6 months ago
Last Updated
3 weeks ago
Language
Python
License
Apache-2.0

Similar Skills

Semantically similar based on skill content — not just same category