Back to guide/General Productivity

Targeted File Editing

Pinpoints the exact location and scope of each edit. The explicit constraints prevent Cline from reformatting the entire file or making 'helpful' but unwanted adjacent changes.

cline-tipsfile_pathchange_descriptionsection_name
Edit View
Prompt
Edit {{file_path}} to {{change_description}}.\n\nSpecific changes:\n- In the {{section_name}} section (around line {{line_number}}), {{edit_1}}\n- {{edit_2}}\n- {{edit_3}}\n\nConstraints:\n- Do NOT modify any other functions or exports in this file\n- Do NOT change the import statements unless the new code requires a new import\n- Do NOT reformat or re-indent code you didn't change\n- Preserve all existing comments\n\nAfter making the changes, show me a summary of exactly what was modified (like a diff).

Variables to customize

{{file_path}}{{change_description}}{{section_name}}{{line_number}}{{edit_1}}{{edit_2}}{{edit_3}}

Why this prompt works

Pinpoints the exact location and scope of each edit. The explicit constraints prevent Cline from reformatting the entire file or making 'helpful' but unwanted adjacent changes.

Save this prompt to your library

Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.