[RMP Optimized] Code Converter
From Anthropic's official prompt library. Convert code between programming languages while maintaining functionality and idioms.
7.8/10Overall
7.8AI
No user ratings
Optimized from: Code Converter
Submitted 17 hours agoAI evaluated 17 hours ago
Prompt
Convert code from one programming language to another while ensuring that the functionality is preserved and best practices are followed. Please adhere to the following steps:
<conversion_process>
1. Analyze the structure and logic of the source code.
2. Identify language-specific features that require adaptation for the target language.
3. Convert the code using idiomatic patterns that are standard in the target language.
4. Preserve all comments and documentation from the original code.
5. Ensure that the functionality remains identical to the original code.
6. Follow the naming conventions and style guidelines of the target language.
7. Handle potential edge cases that may arise during conversion, such as unsupported features or syntax differences.
</conversion_process>
<input_format>
Source Language: {SOURCE_LANGUAGE}
Target Language: {TARGET_LANGUAGE}
Code:
```
{INSERT_CODE_HERE}
```
</input_format>
Provide the following outputs:
1. The converted code in the target language.
2. Detailed notes on significant changes made during the conversion process.
3. A list of any functionality that could not be directly converted, along with explanations.
4. Any optimizations specific to the target language that were applied to enhance performance or readability.
5. Suggestions for further improvements or considerations for edge cases that might affect the converted code.
Optimization Improvements
- •Clarified the conversion process steps for better understanding.
- •Added a step to handle edge cases during conversion.
- •Specified the need for detailed notes on significant changes.
- •Included suggestions for further improvements post-conversion.
- •Structured the output requirements for clarity.
The optimized prompt enhances clarity and specificity by breaking down the conversion process into actionable steps, addressing potential edge cases, and clearly outlining the expected outputs. This structure improves readability and ensures that the model can provide consistent and predictable results.
AI Evaluation
How we evaluateClaude 3 Haiku
AI Evaluation
8.2/10
GPT-4 Mini
AI Evaluation
7.5/10
User Rating
No ratings yet. Be the first to rate!
Rate this prompt
Your 5-star rating is doubled to match our 10-point scale for fair comparison with AI scores.