Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

Refactor prompt string formatting

Abi Raja33443165a5d8
diff --git a/AGENTS.md b/AGENTS.md
index b7166e49..e3b00e64 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -18,3 +18,8 @@ Testing policy:
- Frontend: `cd frontend && yarn lint`
If changes touch both, run both sets.
+
+## Prompt formatting
+
+- Prefer triple-quoted strings (`"""..."""`) for multi-line prompt text.
+- For interpolated multi-line prompts, prefer a single triple-quoted f-string over concatenated string fragments.
diff --git a/backend/prompts/update/from_file_snapshot.py b/backend/prompts/update/from_file_snapshot.py
index 744a202f..a8a43fbc 100644
--- a/backend/prompts/update/from_file_snapshot.py
+++ b/backend/prompts/update/from_file_snapshot.py
@@ -14,16 +14,17 @@ def build_update_prompt_from_file_snapshot(
) -> Prompt:
path = file_state.get("path", "index.html")
request_text = prompt.get("text", "").strip() or "Apply the requested update."
- bootstrap_text = (
- f"Selected stack: {stack}.\n\n"
- "You are editing an existing file.\n\n"
- f'<current_file path="{path}">\n'
- f'{file_state["content"]}\n'
- "</current_file>\n\n"
- "<change_request>\n"
- f"{request_text}\n"
- "</change_request>"
- )
+ bootstrap_text = f"""Selected stack: {stack}.
+
+You are editing an existing file.
+
+<current_file path="{path}">
+{file_state["content"]}
+</current_file>
+
+<change_request>
+{request_text}
+</change_request>"""
return [
cast(
ChatCompletionMessageParam,