Translates code from one programming language to another, handling syntax, libraries, frameworks, and underlying logic with intelligent mapping between language ecosystems.
Translates code from one programming language to another with support for complex codebases, syntax variations, libraries, and frameworks.
This skill analyzes source code in one programming language and translates it to a target language while preserving functionality, logic, and semantics. It intelligently maps equivalent libraries, frameworks, and idioms between language ecosystems.
When a user requests code translation, follow this workflow:
1. **Analyze the Source Code**
- Parse the provided source code to understand its structure
- Identify dependencies, imports, and external libraries used
- Map out the logical flow and key functions/methods
- Note any language-specific idioms or patterns
2. **Identify Source Language and Frameworks**
- Detect the programming language automatically from syntax and patterns
- Identify any frameworks, libraries, or runtime dependencies
- Note version-specific features if relevant
- Document any build tools or package managers in use
3. **Map to Target Language**
- Identify equivalent syntax patterns in the target language
- Find corresponding libraries and frameworks (e.g., Express → Flask, React → Vue)
- Map language-specific features to target equivalents (e.g., Python decorators → Java annotations)
- Adapt idioms and design patterns to target language conventions
4. **Translate the Code**
- Convert syntax while preserving logic and semantics
- Replace library imports with target language equivalents
- Adapt data structures to target language types (e.g., Python dict → JavaScript object)
- Maintain code organization and structure where possible
- Apply target language best practices and naming conventions
5. **Generate Translated Code with Context**
- Provide the complete translated code
- Add inline comments explaining non-obvious mappings
- Document any missing equivalents or manual adjustments needed
- Include setup instructions (dependencies, build commands)
- Note any behavioral differences between source and target
Users may request translation using phrases like:
**Example 1: Python to JavaScript**
```
User: "Translate this Python Flask API to JavaScript Express"
Agent: Analyzes Flask routes, middleware, and ORM usage → Maps to Express routes, middleware patterns, and Sequelize → Provides translated code with setup instructions
```
**Example 2: Java to Go**
```
User: "Convert this Java Spring Boot service to Go"
Agent: Identifies Spring annotations and dependency injection → Maps to Go structs, interfaces, and manual DI patterns → Translates with explanations of architectural differences
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/code-translator/raw