पाठ 6 / 26
Description: आपका सबसे महत्वपूर्ण वाक्य
ऐसे descriptions लिखें जिससे Claude सही समय पर skill चुने।
क्या करती है, कब उपयोग करें, trigger वाक्यांश
Claude skill उपयोग करने का निर्णय मुख्यतः उसके description से करता है, जो हमेशा दिखता है, इसलिए उसे पूरा निर्णय वहन करना होगा। मज़बूत description के तीन हिस्से हैं: skill क्या करती है (एक स्पष्ट वाक्य), कब उपयोग करें ("changelog या release notes लिखने को कहा जाए तब उपयोग करें"), और वे trigger वाक्यांश जो users वास्तव में कहते हैं ("Triggers on: release notes, changelog, what changed")। तृतीय पुरुष में लिखें, इनपुट और आउटपुट के बारे में विशिष्ट रहें, विशिष्ट keywords और file प्रकार बताएँ, और 1,024-अक्षर सीमा के भीतर रखें। अस्पष्ट descriptions ("stuff में मदद") कभी trigger नहीं होते; बहुत व्यापक सब पर trigger होकर context बर्बाद करते हैं; "कब" वाक्यांश ग़ायब हो तो Claude अनुमान लगाता है। Description को skill की API मानें: असली अनुरोधों से परखें, उनसे भी जिन पर वह trigger नहीं होना चाहिए।
SKILL.md validate करना, चलाकर
मैंने यह सादे Python 3 (सिर्फ़ standard library) से चलाया। Validator frontmatter parse करके इस विषय के नियम जाँचता है: folder से मेल खाता छोटे अक्षर वाला hyphen-नाम, 1,024 अक्षरों से छोटा गैर-ख़ाली description जो बताए skill कब उपयोग करें, और 500 पंक्तियों से कम body। अच्छी skill पास होती है। ख़राब वाली में space सहित बड़े अक्षरों का नाम, folder से न मिलता नाम, और ऐसा description है जो कभी नहीं बताता कब उपयोग करें। ये यहाँ सिखाई परंपराएँ हैं, और आपके tool संस्करण में जाँचें कम या ज़्यादा हो सकती हैं।
import re
def parse_skill(text):
"""Split a SKILL.md into (frontmatter dict, body). Handles simple `key: value` lines."""
m = re.match(r"^---\n(.*?)\n---\n?(.*)$", text, re.S)
if not m: return None, text
meta = {}
for line in m.group(1).splitlines():
if ":" in line:
k, v = line.split(":", 1)
meta[k.strip()] = v.strip().strip('"')
return meta, m.group(2)
def validate(text, folder):
meta, body = parse_skill(text)
problems = []
if meta is None: return ["no frontmatter block between --- lines"]
name, desc = meta.get("name", ""), meta.get("description", "")
if not re.fullmatch(r"[a-z0-9]+(-[a-z0-9]+)*", name): problems.append("name must be lowercase letters, digits and hyphens")
if len(name) > 64: problems.append("name longer than 64 characters")
if name != folder: problems.append(f"name '{name}' does not match folder '{folder}'")
if not desc: problems.append("description is empty")
if len(desc) > 1024: problems.append("description longer than 1024 characters")
if desc and not re.search(r"\b(use|when|triggers?)\b", desc, re.I): problems.append("description never says WHEN to use the skill")
if len(body.splitlines()) > 500: problems.append("body over 500 lines: move detail into reference files")
return problems or ["ok"]
good = """---
name: release-notes
description: "Draft release notes from merged PRs since the last tag. Use when asked to write a changelog, release notes or what's new. Triggers on: release notes, changelog, what changed."
---
# release-notes
1. Find the last tag.
2. List merged PRs since then.
3. Group by feature, fix, chore.
"""
bad = """---
name: Release Notes
description: helps with stuff
---
Do things.
"""
print("good:", validate(good, "release-notes"))
print("bad :", validate(bad, "release-notes"))
Output:
good: ['ok'] bad : ['name must be lowercase letters, digits and hyphens', "name 'Release Notes' does not match folder 'release-notes'", 'description never says WHEN to use the skill']
Descriptions चयन को कैसे मोड़ते हैं (अनुकरण), चलाकर
मैंने यह सादे Python 3 (सिर्फ़ standard library) से चलाया। यह विचार का सरल अनुकरण है, Claude वास्तव में कैसे तय करता है वह नहीं: Claude descriptions पर अपने विवेक का उपयोग करता है, इसीलिए स्पष्ट descriptions मायने रखते हैं। मोटा शब्द-overlap score हर अनुरोध से सबसे अच्छी मेल खाते description वाली skill चुनता है (कम से कम 2 साझा शब्द चाहिए)। changelog अनुरोध के लिए विशिष्ट release-notes description जीतता है, console-errors अनुरोध के लिए browser description जीतता है, अस्पष्ट "helps with stuff" description कभी नहीं जीतता, और असंबंधित refactoring अनुरोध किसी से मेल नहीं खाता।
import re
STOP = {"a", "an", "the", "to", "of", "for", "and", "or", "in", "on", "is", "it", "my", "me", "please", "this", "that", "use", "when", "with", "from"}
def words(text): return {w for w in re.findall(r"[a-z0-9]+", text.lower()) if w not in STOP and len(w) > 2}
SKILLS = {
"vague": "Helps with stuff and general tasks.",
"specific": "Draft release notes from merged PRs since the last tag. Use when asked to write a changelog, release notes or what changed. Triggers on: release notes, changelog, whats new.",
"browser": "Load a page in a headless browser and report console errors and failed requests. Use to verify web changes. Triggers on: does it render, console errors, check the page.",
}
requests = ["write the changelog for this release", "does the page render without console errors", "refactor the payment module"]
def best_match(request):
scores = {name: len(words(request) & words(desc)) for name, desc in SKILLS.items()}
name, score = max(scores.items(), key=lambda kv: kv[1])
return (name if score >= 2 else None), scores
for r in requests:
chosen, scores = best_match(r)
print(f"{r!r:48} -> {chosen} scores={scores}")
Output:
'write the changelog for this release' -> specific scores={'vague': 0, 'specific': 3, 'browser': 0}
'does the page render without console errors' -> browser scores={'vague': 0, 'specific': 0, 'browser': 5}
'refactor the payment module' -> None scores={'vague': 0, 'specific': 0, 'browser': 0}वे trigger वाक्यांश लिखें जो users सच में कहते हैं
अपनी टीम के असली अनुरोध जुटाएँ ("check the page", "what shipped?") और वे शब्द description में रखें।
त्वरित जाँच: कौन-सा description सही समय पर trigger होने की सबसे अधिक संभावना रखता है?
- "मेरे helper का version 2।"
- "Stuff में मदद करती है।"
- "बहुत उपयोगी skill।"
- "Merged PRs से release notes का मसौदा बनाती है। changelog माँगे जाने पर उपयोग करें। Triggers on: release notes, changelog।"
Answer
"Merged PRs से release notes का मसौदा बनाती है। changelog माँगे जाने पर उपयोग करें। Triggers on: release notes, changelog।" — यह ठोस शब्दों में क्या, कब और कौन-से वाक्यांश बताता है।