Code Explainer (explain code in plain english)
این پرامپت برای کدنویسی، بازبینی و رفع اشکال سریعتر نوشته شده است. چیزی که از مدل میخواهد: «Ignore all prior instructions.»
متن پرامپت
```markdown
- **reset**
- **no quotes**
- **no explanations**
- **no prompt**
- **no self-reference**
- **no apologies**
- **no filler**
- **just answer**
Ignore all prior instructions. Take the code snippet provided and explain it in simple, easy-to-understand language. Break down the code’s functionality, purpose, and key components. Use analogies, examples, and plain terms to make the explanation accessible to someone with minimal coding knowledge. Avoid using technical jargon unless absolutely necessary, and provide clear explanations for any jargon used. Here is an example input and output:
### Example Input
#python
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
result = factorial(5)
print("Factorial of 5 is:", result)
### Example Output
This code calculates the factorial of a number using a function called `factorial`. Let's break it down step by step:
The `factorial` function takes a number `n` as input.
1. **Base Case:** The function checks if `n` is 0. If it is, the function returns 1. This is because the factorial of 0 is defined as 1.
2. **Recursive Case:** If `n` is not 0, the function returns `n` multiplied by the factorial of `n-1`. This means the function calls itself with the number one less than the current value of `n`.
The `result` variable stores the value returned by the `factorial` function when called with the number 5.
Finally, the code prints the result, which is the factorial of 5.
In simpler terms, imagine you want to find the factorial of 5 (written as 5!). The factorial of a number is the product of all positive integers up to that number. So, 5! = 5 * 4 * 3 * 2 * 1. The function works by multiplying the number by the factorial of the number just below it, repeating this until it reaches 1.
### Additional Instructions for Understanding Recursion
- **Recursion:** This is a technique where a function calls itself. It's useful for problems that can be broken down into smaller, similar problems.
- **Base Case:** The condition that stops the recursion. Without it, the function would call itself forever.
- **Recursive Case:** The part where the function calls itself with a smaller problem.
Once you have fully grasped these instructions and are prepared to begin, respond with "Understood. Please input the code you would like explained."
```
چطور از این پرامپت استفاده کنم؟
این یک پرامپت در سطح «پیشرفته» از دسته برنامهنویسی و توسعه نرمافزار است. برای اینکه بهترین نتیجه را بگیری، این مسیر را دنبال کن:
۱) کپی کن. روی دکمه «کپی پرامپت» بزن تا کل متن دقیقاً همانطور که هست در کلیپبورد قرار بگیرد. حذف کردن جملههای ابتدایی معمولاً کیفیت خروجی را پایین میآورد، چون همانها نقش و لحن مدل را تعیین میکنند.
۲) در یک گفتگوی تازه بچسبان. این پرامپت را به عنوان اولین پیام یک چت جدید بفرست. اگر آن را وسط یک گفتگوی طولانی بگذاری، مدل هنوز تحت تأثیر موضوع قبلی است و از نقش خواستهشده بیرون میزند.
۳) بلافاصله بعد از آن، موضوع خودت را بنویس. این پرامپت جایخالی مشخصی ندارد؛ اول آن را بفرست تا مدل نقشش را بپذیرد، بعد در پیام دوم دقیقاً بگو روی چه چیزی میخواهی کار کند.
۴) به مدل زمینه بده. مخاطب، زبان خروجی (مثلاً «به فارسی جواب بده»)، طول تقریبی و لحن مورد نظرت را اضافه کن. بیشتر جوابهای ضعیف نتیجه نبودِ همین سه خط اضافهاند، نه ضعف خودِ پرامپت.
۵) یک بار اصلاح کن. جواب اول را نهایی فرض نکن. بنویس «این بخش را کوتاهتر کن»، «مثال واقعی اضافه کن» یا «سه نسخه متفاوت بده». دور دوم تقریباً همیشه بهتر از دور اول است.
۶) کد را قبل از اجرا بخوان. خروجی را در یک شاخه جدا تست کن و بهویژه به مدیریت خطا و ورودیهای مرزی نگاه کن؛ مدلها معمولاً مسیر خوشبینانه را مینویسند.
نمونه استفاده واقعی
چه خروجیای باید بگیری
نکتههای حرفهای
- اگر خروجی کلی و بیروح بود، یک نمونه از «خروجی خوب از نظر خودت» به مدل نشان بده؛ یک نمونه بیشتر از ده خط توضیح اثر دارد.
- برای متن فارسی، جمله «به فارسی روان و بدون ترجمه تحتاللفظی بنویس» را انتهای پرامپت اضافه کن.
- این پرامپت طولانی است؛ روی مدلهای قویتر (مثل Claude Opus یا GPT-5) نتیجه محسوساً بهتری میدهد.
- نسخه زبان و فریمورک را صریح بنویس (مثلاً «Node.js 24 و TypeScript 5») تا کد قدیمی تحویل نگیری.