पाठ 6 / 25

आवश्यकताएँ और सीमाएँ

Inputs, outputs, edge cases और जो assistant को नहीं करना है वह बताएँ।

लेखक: · 15 साल से वेब डेवलपर

"पूरा" का मतलब बताएँ

Inputs और outputs, आपके लिए मायने रखने वाले edge cases (खाली input, बड़ा input, अमान्य डेटा) और सीमाएँ सूचीबद्ध करें: भाषा version, अनुमत libraries, performance सीमाएँ, शैली नियम, और जो files नहीं बदलनी हैं। इन्हें छोड़ेंगे तो assistant ख़ाली जगहें अपने अनुमान से भरेगा।

विनिर्देश-शैली की prompt

Edge cases स्पष्ट लिखने से आपको बाद के लिए test सूची भी मिल जाती है।

Write a Python function slugify(text) -> str.
- Lowercase; replace runs of non-alphanumerics with a single hyphen.
- Strip leading and trailing hyphens.
- "Hello World" -> "hello-world"; "  Python 3.12!  " -> "python-3-12"
- "" -> "" ; "--a--b--" -> "a-b"
- Standard library only. No external packages.

यह भी बताएँ कि क्या न करें

"नई dependencies न जोड़ो" या "public API न बदलो" जैसी नकारात्मक सीमाएँ सबसे परेशान करने वाली हैरानियाँ रोकती हैं। उन्हें छोटी सूची में रखें जिसे assistant जाँच सके।

त्वरित जाँच: Prompt में edge cases क्यों लिखें?

  • इससे editor धीमा होता है
  • इससे उत्तर लंबा होता है
  • Edge cases मायने नहीं रखते
  • ताकि assistant को उन्हें सँभालने का अनुमान न लगाना पड़े
Answer

ताकि assistant को उन्हें सँभालने का अनुमान न लगाना पड़े — स्पष्ट मामले अस्पष्टता हटाते हैं और testing के लिए checklist का भी काम करते हैं।