<?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: Rahul</title>
    <description>The latest articles on DEV Community by Rahul (@rahul_singhdm).</description>
    <link>https://dev.to/rahul_singhdm</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4070615%2Fe5f29a40-2b58-4b0b-8912-ed83c0ed969f.png</url>
      <title>DEV Community: Rahul</title>
      <link>https://dev.to/rahul_singhdm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rahul_singhdm"/>
    <language>en</language>
    <item>
      <title>I Thought Learning Ethical Hacking Started With Kali Linux. I Had the Order Backwards.</title>
      <dc:creator>Rahul</dc:creator>
      <pubDate>Tue, 13 Oct 2026 09:46:15 +0000</pubDate>
      <link>https://dev.to/rahul_singhdm/i-thought-learning-ethical-hacking-started-with-kali-linux-i-had-the-order-backwards-5dak</link>
      <guid>https://dev.to/rahul_singhdm/i-thought-learning-ethical-hacking-started-with-kali-linux-i-had-the-order-backwards-5dak</guid>
      <description>&lt;p&gt;When I first started looking into ethical hacking, I did what seemed logical. I started with the tools. &lt;/p&gt;

&lt;p&gt;Kali Linux. Nmap. Burp Suite. Metasploit. Wireshark. The names alone make it feel like you've begun, and almost every tutorial opens with one of them. &lt;/p&gt;

&lt;p&gt;Then I looked at what one of those tools actually prints. This is a typical first scan against a practice machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ nmap -sV 192.168.56.101 

PORT     STATE SERVICE VERSION 
 21/tcp   open  ftp     vsftpd 2.3.4 
 22/tcp   open  ssh     OpenSSH 4.7p1 
 80/tcp   open  http    Apache httpd 2.2.8 
 3306/tcp open  mysql   MySQL 5.0.51a 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And I asked myself an uncomfortable question: if this appeared on my screen today, could I explain a single line of it? &lt;/p&gt;

&lt;p&gt;The honest answer was no. I knew the names of the tools. I didn't understand the world behind them. &lt;/p&gt;

&lt;h2&gt;
  
  
  The scan I couldn't read
&lt;/h2&gt;

&lt;p&gt;The output was not the problem. My questions were. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why is port 3306 open to the whole network, and should it be? &lt;/li&gt;
&lt;li&gt;What does "open" mean at the packet level? What did Nmap send, and what came back? &lt;/li&gt;
&lt;li&gt;Why does the version number matter more than the port number? &lt;/li&gt;
&lt;li&gt;If port 80 is a website, what happens between a browser and that server? &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Anyone can run the command. I could not explain the result. A tutorial would tell me what to type next, but the moment the target looked slightly different, I'd be stuck. &lt;/p&gt;

&lt;p&gt;That was the point where I stopped treating ethical hacking as a tool list and went back to the ethical hacking basics I was about to skip. &lt;/p&gt;

&lt;h2&gt;
  
  
  What I thought I needed vs. what I needed first
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu6osrgy1lwn93ynlgotc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu6osrgy1lwn93ynlgotc.png" alt=" " width="800" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The left column is tools. The right column is ethical hacking fundamentals. The tools only make sense once the right column does. &lt;/p&gt;

&lt;h2&gt;
  
  
  The four foundations
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Networking
&lt;/h2&gt;

&lt;p&gt;A port scan is a conversation. Nmap sends a SYN packet; an open port answers SYN-ACK, a closed one answers RST, and a filtered one usually says nothing. Once I understood that, "open", "closed" and "filtered" stopped being labels and became observations. &lt;/p&gt;

&lt;p&gt;Learn first: IP addresses and subnets, TCP vs. UDP, the three-way handshake, DNS, and what common ports are for. &lt;/p&gt;

&lt;h2&gt;
  
  
  2. Linux basics
&lt;/h2&gt;

&lt;p&gt;Most targets and most tools live on Linux. You don't need to be an admin. You need to move around without a tutorial open.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; /etc          &lt;span class="c"&gt;# who owns what, and who can read it &lt;/span&gt;
 ps aux               &lt;span class="c"&gt;# what is running &lt;/span&gt;
 ss &lt;span class="nt"&gt;-tulpn&lt;/span&gt;            &lt;span class="c"&gt;# what is listening, and on which port &lt;/span&gt;
 &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s2"&gt;"password"&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="c"&gt;# how fast secrets turn up in plain files &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. HTTP and the web
&lt;/h2&gt;

&lt;p&gt;Before opening Burp Suite, send one request by hand (output trimmed):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;$ curl -v http://192.168.56.101/login 

&amp;gt; GET /login HTTP/1.1 
 &amp;gt; Host: 192.168.56.101 
 &amp;gt; 
 &amp;lt; &lt;/span&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;200&lt;/span&gt; &lt;span class="ne"&gt;OK &lt;/span&gt;
&lt;span class="s"&gt; &amp;lt; Set-Cookie: PHPSESSID=abc123; path=/ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Methods, headers, status codes, cookies. That cookie has no HttpOnly or Secure flag, and noticing that is already a finding. Burp Suite is this same exchange with a pause button. &lt;/p&gt;

&lt;h2&gt;
  
  
  4. Authentication and common vulnerabilities
&lt;/h2&gt;

&lt;p&gt;Some common beginner-level findings involve weak or reused passwords, missing access checks, unvalidated input such as SQL injection or XSS, outdated software, and phishing. Learn why each one happens. vsftpd 2.3.4 in the scan above matters because a compromised release of that exact version carried a backdoor. The version string is the clue, and it is the line beginners scroll past. &lt;/p&gt;

&lt;p&gt;Two words are worth separating early, because they sound alike: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authentication&lt;/strong&gt;: who are you? &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authorization&lt;/strong&gt;: what are you allowed to do? &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Say you log in successfully. Authentication worked. Now you change /account/1041 to /account/1042 in the URL and see someone else's data. That is an authorization failure, and no scanner flag explains it. You catch it only if you know how the application is supposed to control access. &lt;/p&gt;

&lt;h2&gt;
  
  
  Where the tools actually fit
&lt;/h2&gt;

&lt;p&gt;Every security tool automates a question you could ask by hand, only slower. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw39ohs77nxptqpn172ay.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw39ohs77nxptqpn172ay.png" alt=" " width="800" height="236"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you can't ask the question without the tool, the tool's answer won't mean much. That is the whole lesson of the unreadable scan. &lt;/p&gt;

&lt;p&gt;The tools also map onto a process. The classic attack lifecycle has five phases: reconnaissance, scanning, gaining access, maintaining access, and covering tracks. An ethical test follows the same path with permission and ends in a report. Nmap belongs to phase two. I had been starting in the middle. &lt;/p&gt;

&lt;h2&gt;
  
  
  Build a lab before you touch anything real
&lt;/h2&gt;

&lt;p&gt;One rule comes before every technique: only test systems you own or have written permission to test. Scanning systems you don't own or don't have permission to test can have serious legal and ethical consequences. "I was learning" isn't a substitute for permission. &lt;/p&gt;

&lt;p&gt;A safe lab costs nothing: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install VirtualBox on your own machine. &lt;/li&gt;
&lt;li&gt;Run Kali Linux as one VM (now it has a job). &lt;/li&gt;
&lt;li&gt;Run a deliberately vulnerable target as a second VM: Metasploitable 2, or a Linux VM hosting DVWA or OWASP Juice Shop. &lt;/li&gt;
&lt;li&gt;Put both on a host-only network so nothing leaks to your home network or the internet. &lt;/li&gt;
&lt;li&gt;Take a snapshot before you break anything. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The 192.168.56.x address in my examples is VirtualBox's default host-only range. Everything in this post stays inside that box. &lt;/p&gt;

&lt;h2&gt;
  
  
  The order I'd follow if I started again
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Networking&lt;/strong&gt;: ports, TCP/UDP, DNS, the handshake. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linux command line&lt;/strong&gt;: files, permissions, processes, services. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTP&lt;/strong&gt;: read raw requests and responses with curl -v or browser dev tools. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The ethical hacking process&lt;/strong&gt;: the five phases, and where permission and scope fit. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reconnaissance and footprinting&lt;/strong&gt;: what can be learned without touching the target. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Common vulnerabilities&lt;/strong&gt;: passwords, injection, misconfiguration, phishing. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tools&lt;/strong&gt;: now Nmap, Burp Suite and the rest have something to attach to. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lab practice and write-ups&lt;/strong&gt;: explain each finding in plain language. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tools arrive at step seven. I had started there. &lt;/p&gt;

&lt;p&gt;One caution in the other direction: don't spend six months on networking before touching a lab. That is another way of never starting. Learn a little, try something small, get confused, learn the concept you were missing, and try again. You need enough foundation to know what you're doing, why you're doing it, and whether you're allowed to do it. &lt;/p&gt;

&lt;h2&gt;
  
  
  Mistakes I'd skip next time
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Copying commands without predicting the output&lt;/strong&gt;. Guess first, then run it. The gap between the two is where the learning is. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Collecting tools instead of concepts&lt;/strong&gt;. Ten installed scanners teach you less than one request read line by line. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skipping the write-up&lt;/strong&gt;. If I can't explain a finding to someone non-technical, I don't understand it yet. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treating "ethical" as a formality&lt;/strong&gt;. Scope and permission are the difference between a security professional and a criminal. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The shortcut: one structured course
&lt;/h2&gt;

&lt;p&gt;The slow part of all this is assembling the order yourself from scattered tutorials. If you'd rather follow one structured path, LearnKartS' &lt;a href="https://www.coursera.org/learn/ethical-hacking-basics" rel="noopener noreferrer"&gt;Ethical Hacking Fundamentals course&lt;/a&gt; on Coursera picks up at step four of that list and covers the ethical hacking essentials from there, with each tool demonstrated next to the concept it serves: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Foundations&lt;/strong&gt;: the attack lifecycle, the hacker mindset and ethical boundaries, with Kali Linux and Burp Suite set up by demo &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Footprinting and OSINT&lt;/strong&gt;: Shodan, WHOIS and Google dorks, before you touch a target &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network scanning and vulnerability assessment&lt;/strong&gt;: Nmap port scanning and OS discovery, which is the scan at the top of this post, explained &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enumeration&lt;/strong&gt;: pulling useful detail out of network services such as DNS, SMTP and SNMP &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Social engineering and phishing&lt;/strong&gt;: how the attacks work and how to detect them &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web application security&lt;/strong&gt;: server architecture, common attacks, and demos of authentication bypass and API exploitation &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI in security&lt;/strong&gt;: how AI is changing both attacks and defences &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is beginner level and needs no coding background: 8 modules, about 7 hours, self-paced, with a shareable certificate. More than 19,000 learners have enrolled, and it is rated 4.6. It is also part of the LearnKartS Ethical Hacking Specialization, so there is a clear next step when you finish. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.coursera.org/learn/ethical-hacking-basics" rel="noopener noreferrer"&gt;Start Ethical Hacking Fundamentals on Coursera. &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whichever route you take, the order matters more than the source: foundations first, tools second. &lt;/p&gt;

&lt;h2&gt;
  
  
  What I'm exploring next
&lt;/h2&gt;

&lt;p&gt;I'm now looking at how AI tools change reconnaissance and vulnerability triage, and where they confidently get it wrong. That will be the next post. &lt;/p&gt;

&lt;p&gt;Your turn: what did you learn in the wrong order? And if you work in security, what is the one fundamental you wish beginners learned before they opened Kali? &lt;/p&gt;

</description>
      <category>ethicalhacking</category>
      <category>cybersecurity</category>
      <category>linux</category>
      <category>websecurity</category>
    </item>
    <item>
      <title>"Review This Code" Is the Worst ChatGPT Prompt. Here Are 5 Better Ones for the Same Buggy Function.</title>
      <dc:creator>Rahul</dc:creator>
      <pubDate>Fri, 09 Oct 2026 11:45:50 +0000</pubDate>
      <link>https://dev.to/rahul_singhdm/review-this-code-is-the-worst-chatgpt-prompt-here-are-5-better-ones-for-the-same-buggy-function-5gjl</link>
      <guid>https://dev.to/rahul_singhdm/review-this-code-is-the-worst-chatgpt-prompt-here-are-5-better-ones-for-the-same-buggy-function-5gjl</guid>
      <description>&lt;p&gt;There is a bug in these six lines. Find it before you scroll.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="err"&gt;`&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_discount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; 
     &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_premium&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 
         &lt;span class="n"&gt;discount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt; 
     &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 
         &lt;span class="n"&gt;discount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;discount&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt; 
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;discount&lt;/span&gt; &lt;span class="err"&gt;`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Most of us would paste this into ChatGPT with three words: &lt;/p&gt;

&lt;p&gt;Review this code. &lt;/p&gt;

&lt;p&gt;It's the kind of prompt that's incredibly easy to type. You will get an answer. You will also have left the model to guess everything that matters. &lt;/p&gt;

&lt;h2&gt;
  
  
  What "review this code" leaves out
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frcas1hqen2l85j1e67t4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frcas1hqen2l85j1e67t4.png" alt=" " width="800" height="301"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When a prompt leaves those blank, the model fills them with the most average answer available: a tidy list about naming, docstrings, type hints and "consider adding error handling". The real bug may be in there, as one bullet among eight, with the same weight as a missing docstring. &lt;/p&gt;

&lt;p&gt;ChatGPT prompt engineering is mostly the work of filling in those blanks on purpose. Here are five ways to do it, all on the same function. The answer to the bug is further down, so you can test each prompt before you read it. &lt;/p&gt;

&lt;h2&gt;
  
  
  Prompt 1: Give it a role, a goal and a context
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`You are a senior Python engineer reviewing a pull request. 
 This function runs in the checkout path of an online store. 
 A wrong result means a customer is charged the wrong amount. 

Goal: find anything that could produce a wrong price or a crash. 
 Ignore style unless it hides a bug. 

[paste the function] `
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What changes: the model stops reviewing "some code" and starts reviewing a checkout function where a wrong number costs money. Style notes drop away because you said they don't matter. &lt;/p&gt;

&lt;p&gt;Use it when: always. This is the baseline, and it takes twenty seconds. &lt;/p&gt;

&lt;h2&gt;
  
  
  Prompt 2: Show it the answer you want (few-shot)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`Review the function below. Report each issue in exactly this format. 

Example: 
 SEVERITY: High 
 INPUT THAT TRIGGERS IT: quantity = 0 
 WHAT HAPPENS: ZeroDivisionError on line 4 
 FIX: return 0 early when quantity is 0 

Now review this function: 
 [paste the function] `
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What changes: one example does more than a paragraph of instructions. The reply comes back in the same four fields, and "INPUT THAT TRIGGERS IT" forces a concrete failing case where a vague prompt gets "this might fail in some situations". &lt;/p&gt;

&lt;p&gt;Use it when: the output goes into a ticket or a PR comment, or you run the same review across many functions. &lt;/p&gt;

&lt;h2&gt;
  
  
  Prompt 3: Make it trace the cases step by step
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`Before giving any verdict, trace this function by hand for four cases: 

1. premium user, price 150 
 2. premium user, price 50 
 3. non-premium user, price 150 
 4. non-premium user, price 50 

For each case, state the value of every variable after each line. 
 Only then tell me what is wrong. 

[paste the function] `
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What changes: you have replaced "have an opinion" with "do the work". The model works through concrete inputs before it judges, so a bug that lives in one branch has nowhere to hide once every branch is walked with real numbers. &lt;/p&gt;

&lt;p&gt;Use it when: the logic has branches and the stakes are real: money, dates, permissions. &lt;/p&gt;

&lt;h2&gt;
  
  
  Prompt 4: Let it interview you first (flipped interaction)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`I want you to review a function. Before you do, ask me up to three 
 questions about anything you need to know to review it properly. 
 Wait for my answers before reviewing. 

[paste the function] `
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What changes: expect questions like "what discount should a non-premium user get?" or "are the two discounts meant to stack?". Those questions are the missing spec, and a lot of bugs are spec gaps. This prompt shows you what you forgot to say. &lt;/p&gt;

&lt;p&gt;Use it when: you suspect the problem is in the requirements, not the syntax. &lt;/p&gt;

&lt;h2&gt;
  
  
  Prompt 5: Turn it into a template you reuse
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`ROLE: Senior {language} engineer reviewing a pull request. 
 CONTEXT: {where this code runs and what a failure costs} 
 GOAL: Find bugs that cause wrong results or crashes. Ignore style. 
 METHOD: Trace every branch with concrete inputs before judging. 
 FORMAT: For each issue give severity, triggering input, what happens, fix. 
 IF UNSURE: Ask me before assuming. 

{code} `
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What changes: this is prompts 1 to 4 folded into one block. Save it as a snippet and you never type "review this code" again. &lt;/p&gt;

&lt;p&gt;Use it when: you review code with AI more than once a week. &lt;/p&gt;

&lt;h2&gt;
  
  
  The bug
&lt;/h2&gt;

&lt;p&gt;If the user is not premium, discount is never assigned. &lt;/p&gt;

&lt;p&gt;Non-premium, price 150: line 5 reads discount before it exists. &lt;/p&gt;

&lt;p&gt;Non-premium, price 50: the return line does the same. &lt;/p&gt;

&lt;p&gt;Both raise UnboundLocalError. Every non-premium customer crashes the function, and premium customers never notice. The fix is one line at the top: discount = 0.0. &lt;/p&gt;

&lt;p&gt;Cases 3 and 4 in Prompt 3 walk straight into it. &lt;/p&gt;

&lt;h2&gt;
  
  
  The honest trade-offs
&lt;/h2&gt;

&lt;p&gt;A good model may catch this bug with the lazy prompt too. The better prompts are about what comes back first, in what order, with a failing input attached, and how consistently. &lt;/p&gt;

&lt;p&gt;Output varies between runs. The same prompt can produce two different reviews. For anything important, run it twice. &lt;/p&gt;

&lt;p&gt;Longer prompts cost time. For a throwaway question, three words are fine. &lt;/p&gt;

&lt;p&gt;You still read the code. A well-formatted review can be confidently wrong. &lt;/p&gt;

&lt;h2&gt;
  
  
  Where these patterns come from
&lt;/h2&gt;

&lt;p&gt;None of these five are my invention. Role prompts, few-shot examples, chain of thought, flipped interaction and reusable templates are standard prompt patterns, and there are a dozen more that work the same way on emails, summaries, documentation and test cases. &lt;/p&gt;

&lt;p&gt;If you want them taught in a structured sequence, the course I'd point you to is LearnKartS' &lt;a href="https://www.coursera.org/learn/prompt-engineering-chatgpt" rel="noopener noreferrer"&gt;Prompt Engineering for ChatGPT: Beginner to Advanced&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;This ChatGPT prompt engineering course covers the techniques behind the five prompts above and the ones I had no room for: prompt structure, few-shot and chain of thought prompting, ask-before-answer, flipped interaction, reusable prompt frameworks and responsible AI use. As an AI prompt engineering course it is beginner level and self-paced, and the free version of ChatGPT is enough to follow along. &lt;/p&gt;

&lt;h2&gt;
  
  
  Your turn
&lt;/h2&gt;

&lt;p&gt;Two things I'd like to see in the comments: &lt;/p&gt;

&lt;p&gt;Run the lazy prompt. Paste the function into the model you use with only "Review this code." Did it lead with the crash, or bury it under style notes? Post the first line you got back, and name the model. &lt;/p&gt;

&lt;p&gt;Share your default. What is the one prompt you reuse most, for code or anything else? &lt;/p&gt;

&lt;p&gt;And if you think "worst prompt" is unfair, tell me why. I'll defend the title. &lt;/p&gt;

</description>
      <category>ai</category>
      <category>chatgpt</category>
      <category>promptengineering</category>
      <category>python</category>
    </item>
  </channel>
</rss>
