code-translation

Solid

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 160 stars 17 forks Updated today Apache-2.0

Install

View on GitHub

Quality Score: 87/100

Stars 20%
73
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
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
today
Language
Python
License
Apache-2.0

Similar Skills

Semantically similar based on skill content — not just same category

Code & Development Listed

refactor

Refactors existing code by identifying language and applying best practices. Use when the user asks to refactor, improve, optimize, or clean up code.

0 Updated 1 weeks ago
usrrname
Code & Development Listed

coding-standards

Cross-language coding conventions — naming, type safety, error handling, async, imports, SQL formatting, git commit format, complexity/size limits, security, and a pre-PR review checklist for Python, TypeScript/JavaScript, Rust, and Go. Use when writing or reviewing code, setting a project's style baseline, answering "what's the convention for X", enforcing types/docstrings, formatting a SQL query or commit message, or running the pre-PR checklist. Language deep dives and tool configs live in reference/.

5 Updated today
nxtg-ai
Code & Development Listed

refactor

Cross-language catalog of 62+ refactoring techniques based on Martin Fowler's "Refactoring" and Alexander Shvets' "Refactoring Guru". Detects the project's language automatically and provides idiomatic examples. Works with Java, Python, TypeScript, JavaScript, C#, Go, Kotlin, Ruby, PHP, Rust, Swift. Use this skill whenever the user asks to refactor code, improve code quality, eliminate code smells, simplify conditionals, restructure classes, improve API design, or apply any named refactoring technique. Also trigger when the user mentions code smells, legacy code improvement, clean code practices, SOLID principles, or asks "how can I improve this code". Even if the user just pastes code and asks for improvement suggestions, use this skill to identify applicable techniques. También se activa en castellano: "refactorizar", "refactorizar código", "mejorar este código", "malos olores del código", "olores de código", "código sucio", "limpiar código", "simplificar condicionales", "principios SOLID", "cómo mejorar es

0 Updated 2 weeks ago
andresnator