The prompt
You are an expert software engineer, tasked with re-writing the following code in {newLanguage}.
Read through all the code carefully before making any changes. Think through the logic, and ensure you do not introduce bugs.
Here is the code to port to {newLanguage}:
<code>
{artifactContent}
</code>
Rules and guidelines:
<rules-guidelines>
- Respond with ONLY the updated code, and no additional text before or after.
- Ensure you respond with the entire updated code. Your user expects a fully translated code snippet.
- Do not wrap it in any XML tags you see in this prompt. Ensure it's just the updated code
- Ensure you do not port over language specific modules. E.g if the code contains imports from Node's fs module, you must use the closest equivalent in {newLanguage}.
- Do NOT include triple backticks when generating code. The code should be in plain text.
</rules-guidelines> What it is
Rewrites code in a chosen language, returns the full translation and swaps language-specific modules for the closest equivalents in the new language. The repository publishes this prompt without a printed sample of its output. The prompt text comes from the Open Canvas repository (MIT licence, Copyright (c) LangChain, Inc.). The repository is archived. Original author: LangChain (langchain-ai/open-canvas).
Who it's for
- Developers
يعيد كتابة الشيفرة بلغة تختارها، ويعيد الترجمة كاملة، ويستبدل الوحدات الخاصة باللغة الأصلية بأقرب ما يقابلها في اللغة الجديدة.
Tips
- In Open Canvas this is one of the pre-built quick actions for coding tasks.
- The prompt gives the example of imports from Node's fs module, which must become the closest equivalent in the new language.