पाठ 10 / 29

Instruction Files: Agent को आपका Project सिखाना

वह छोटी file लिखें जो हर session को बताती है कैसे build, test और व्यवहार करें।

Agent के लिए README

Agents हर session यह जाने बिना शुरू करते हैं कि आपके project की परंपराएँ क्या हैं, इसलिए अधिकांश tools repository root पर project निर्देश file पढ़ते हैं (नाम tool के अनुसार बदलते हैं, जैसे AGENTS.md, CLAUDE.md या rules files)। उसमें वह रखें जो नए सहकर्मी को चाहिए और अनुमान से नहीं मिल सकता: build, test और lint कैसे करें (सटीक commands), project ढाँचा, coding परंपराएँ (नामकरण, error सँभाल, पसंदीदा libraries), क्या न करें ("generated files कभी संपादित न करो", "migrations मत छुओ"), और पूर्ण की परिभाषा ("tests जोड़े, lint साफ़, changelog अद्यतन")। इसे छोटी, विशिष्ट और अद्यतन रखें: लंबी अस्पष्ट files ध्यान पतला करती और सड़ती हैं। विशेषणों की जगह ठोस commands पसंद करें, गहरे दस्तावेज़ चिपकाने की जगह उनसे लिंक करें, और इस file के बदलावों की कोड की तरह समीक्षा करें, क्योंकि यह हर भावी बदलाव को दिशा देती है। इसमें secrets कभी न रखें।

अच्छी instruction file (उदाहरण)

छोटी, ठोस और परखने योग्य। नाम और commands अपने project के अनुसार ढालें; यहाँ चलाई नहीं गई।

# AGENTS.md

## Commands
- Install: `pip install -e .[dev]`
- Test all: `python -m unittest discover -s tests -t .`   (must pass before you finish)
- Lint: `ruff check .`

## Layout
- `shop/` application code, `tests/` unit tests mirror the package layout

## Conventions
- Money values are integers in paise; never use floats for money.
- Raise `ValueError` with a clear message for invalid input; no bare `except`.

## Do not
- Edit files under `shop/generated/` or `migrations/`.
- Add new dependencies without asking.

## Done means
- A test covers the change; all tests and lint pass; the diff is small and explained.

Agent ग़लत करे तो इसे सुधारें

Agent बार-बार वही ग़लती करे तो file में एक-पंक्ति का नियम जोड़ें। समय के साथ यह project की जमा सीखों में बदल जाती है।

त्वरित जाँच: Agent instruction file में क्या होना चाहिए?

  • सटीक build/test commands, परंपराएँ, क्या न करें और "पूर्ण" का अर्थ
  • Production database का password
  • पूरा source code
  • अस्पष्ट विशेषणों की लंबी सूची
Answer

सटीक build/test commands, परंपराएँ, क्या न करें और "पूर्ण" का अर्थ — ठोस, छोटा मार्गदर्शन लंबे अस्पष्ट पाठ से बेहतर है, और secrets कभी वहाँ नहीं।