पाठ 8 / 26

Folder Layout और Loading नियम

सहायक files ऐसे व्यवस्थित करें कि वे सिर्फ़ ज़रूरत पर लोड हों।

SKILL.md से files की ओर इशारा करें

आम layout है: SKILL.md (प्रवेश-बिंदु), scripts/ (चलने योग्य सहायक), references/ (लंबा दस्तावेज़, schemas, style guides), और templates/ या assets/ (आउटपुट templates, boilerplate, images)। मुख्य नियम: Claude file तभी खोलता है जब SKILL.md कहे या कार्य को साफ़ तौर पर चाहिए हो, इसलिए हर सहायक file को सापेक्ष path से और कब पढ़ें यह बताकर संदर्भित करें ("API error codes के लिए references/errors.md पढ़ें। सिर्फ़ तब पढ़ें जब कोई अनुरोध विफल हो।")। References को एक स्तर गहरा रखें (SKILL.md सीधे हर file से जुड़े) ताकि कुछ links की शृंखला के पीछे न छिपे, लंबी संदर्भ files के ऊपर विषय-सूची दें, और वही तथ्य कई जगह दोहराने से बचें। Paths में forward slashes और ऐसे नाम उपयोग करें जो बताएँ file में क्या है।

SKILL.md के आसपास का folder

Scripts सटीक काम करती हैं, references ब्योरे रखते हैं, templates आउटपुट का रूप तय करते हैं, और SKILL.md उन्हें जोड़ती है।

चार प्रकार की files: script, reference, template, asset।
चित्र 3.1 — Script, reference, template और asset।

Tree के रूप में skill folder, चलाकर

मैंने यह सादे Python 3 (सिर्फ़ standard library) से चलाया। Script अस्थायी directory में नमूना skill folder बनाकर उसे छापती है: ऊपर SKILL.md, फिर references/, scripts/ और templates/ हर एक में एक file।

import os, tempfile

LAYOUT = {
    "release-notes/SKILL.md": "---\nname: release-notes\ndescription: Draft release notes. Use when asked for a changelog.\n---\n# release-notes\n",
    "release-notes/scripts/prs_since_tag.py": "print('...')\n",
    "release-notes/references/style-guide.md": "# Style guide\n",
    "release-notes/templates/notes.md": "## {version}\n",
}
def tree(root):
    out = []
    for dirpath, dirs, files in sorted(os.walk(root)):
        dirs.sort()
        depth = os.path.relpath(dirpath, root).count(os.sep) if dirpath != root else -1
        if dirpath != root: out.append("  " * depth + os.path.basename(dirpath) + "/")
        for f in sorted(files): out.append("  " * (depth + 1) + f)
    return "\n".join(out)

with tempfile.TemporaryDirectory() as root:
    for rel, text in LAYOUT.items():
        path = os.path.join(root, rel); os.makedirs(os.path.dirname(path), exist_ok=True)
        open(path, "w").write(text)
    print(tree(root))

Output:

release-notes/
  SKILL.md
  references/
    style-guide.md
  scripts/
    prs_since_tag.py
  templates/
    notes.md

SKILL.md से files संदर्भित करना

ठीक बताएँ कि हर file कब चाहिए ताकि वह तभी लोड हो। उदाहरण; यहाँ चलाया नहीं गया।

## Files
- To list merged PRs, run `python scripts/prs_since_tag.py` (prints JSON).
- For wording rules, read `references/style-guide.md` before writing entries.
- Fill in `templates/notes.md` for the final output.
- If the GitHub CLI fails with an auth error, read `references/troubleshooting.md`.

एक स्तर गहरा

हर सहायक file को सीधे SKILL.md से जोड़ें, अन्य संदर्भ files से नहीं।

त्वरित जाँच: Claude को कैसे पता चलता है कि संदर्भ file कब खोलनी है?

  • Files ख़ुद खुलती हैं
  • वह हमेशा हर file खोलता है
  • SKILL.md बताती है कौन-सी file कब पढ़नी है
  • वह अतिरिक्त files कभी नहीं खोलता
Answer

SKILL.md बताती है कौन-सी file कब पढ़नी है — स्पष्ट संकेतक progressive disclosure को काम करवाते हैं।