<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Santhosh raj</title>
    <description>The latest articles on DEV Community by Santhosh raj (@santhosh_raj_6fab171a020d).</description>
    <link>https://dev.to/santhosh_raj_6fab171a020d</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3068640%2F7bb93cd3-4708-4d20-8120-7494a2826577.png</url>
      <title>DEV Community: Santhosh raj</title>
      <link>https://dev.to/santhosh_raj_6fab171a020d</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/santhosh_raj_6fab171a020d"/>
    <language>en</language>
    <item>
      <title>Did You Know? How AI Agents Write/Edit Code like a developer?</title>
      <dc:creator>Santhosh raj</dc:creator>
      <pubDate>Sun, 18 May 2025 14:39:01 +0000</pubDate>
      <link>https://dev.to/santhosh_raj_6fab171a020d/did-you-know-how-ai-agents-writeedit-code-like-a-developer-16f8</link>
      <guid>https://dev.to/santhosh_raj_6fab171a020d/did-you-know-how-ai-agents-writeedit-code-like-a-developer-16f8</guid>
      <description>&lt;p&gt;Have you ever wondered how the latest software engineering agents can write or edit code so precisely?&lt;/p&gt;

&lt;p&gt;These AI-powered tools are transforming the way developers work by automating complex edits with accuracy and speed.&lt;/p&gt;

&lt;p&gt;A fantastic example of this capability is the example script from the OpenAI’s Cookbook — &lt;a href="https://cookbook.openai.com/examples/gpt4-1_prompting_guide#reference-implementation-apply_patchpy" rel="noopener noreferrer"&gt;https://cookbook.openai.com/examples/gpt4-1_prompting_guide#reference-implementation-apply_patchpy&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This Python utility script applies human-readable patches to text files, showcasing how SE agents can handle code changes like a pro.&lt;/p&gt;

&lt;p&gt;Unlike traditional patching tools that depend on line numbers (which can break when code shifts), this script uses context-based patching. It looks at surrounding lines or markers to pinpoint where changes should go, making it ideal for dynamic codebases.&lt;/p&gt;

&lt;p&gt;It supports three actions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ADD (insert new code)&lt;/li&gt;
&lt;li&gt;DELETE (remove code)&lt;/li&gt;
&lt;li&gt;UPDATE (modify code).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example in Action&lt;/strong&gt;&lt;br&gt;
Here’s a real-world snippet where we update a logging call across three files in one go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*** Begin Patch
*** Update File: logger.py
@@ def log_event(event):
-    logger.info(f"Event: {event}")
+    logger.info(f"[EVENT] → {event}")
*** End Patch
The parser spots the UPDATE, finds def greet(): in hello.py, swaps out print(“Hi”) for print(“Hello, World!”), and applies it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why This Precision Matters&lt;/strong&gt;&lt;br&gt;
AI agents using tools like apply_patch.py can:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Automate tedious edits.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Handle large-scale changes reliably.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Adapt to evolving codebases with context-based precision.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It’s a peek into how AI can supercharge development!&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Want More?&lt;/strong&gt;&lt;br&gt;
If you’re interested by how AI agents are changing the landscape like this, like, share, and follow for more cool insights into AI-driven tools!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; OpenAI Cookbook — &lt;a href="https://cookbook.openai.com/examples/gpt4-1_prompting_guide" rel="noopener noreferrer"&gt;https://cookbook.openai.com/examples/gpt4-1_prompting_guide&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>openai</category>
      <category>githubcopilot</category>
    </item>
  </channel>
</rss>
