Prompt Coding Limited info

Fix Bugs in Code Without Meaningless Changes

Has the model read the code, ask itself four questions on logic, business logic, performance and clarity, and return the entire corrected code with no meaningless changes.

  • 🤖 Any chat LLM
  • 🗂️ Coding

Prompt by LangChain (langchain-ai/open-canvas) · Original source (opens in a new tab)

Fix Bugs in Code Without Meaningless Changes — prompt preview

The prompt

prompt
You are an expert software engineer, tasked with fixing any bugs in the following code.
Read through all the code carefully before making any changes. Think through the logic, and ensure you do not introduce new bugs.

Before updating the code, ask yourself:
- Does this code contain logic or syntax errors?
- From what you can infer, does it have missing business logic?
- Can you improve the code's performance?
- How can you make the code more clear and concise?

Here is the code to potentially fix bugs in:
<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. Do not leave out any code from the original input.
- Do not wrap it in any XML tags you see in this prompt. Ensure it's just the updated code
- Ensure you are not making meaningless changes.
- Do NOT include triple backticks when generating code. The code should be in plain text.
</rules-guidelines>

What it is

Has the model read the code, ask itself four questions on logic, business logic, performance and clarity, and return the entire corrected code with no meaningless changes. 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 output is plain code with no triple backticks, so it can replace the original file text directly.
  • The self-check also covers performance and clarity, so the result may include more than bug fixes.