Podcasts पर वापस जाएंClaude
Claude Code subagents
प्रभावी सबएजेंट डिज़ाइन करना
Now that you know how to create sub aents, let's look at patterns that lead to effective sub aents.
अब जब आप जानते हैं कि subagent कैसे बनाए जाते हैं, तो चलिए उन patterns को देखते हैं जो प्रभावी subagent बनाते हैं।
First, let's get a better idea of how subit data in the sub aent config file is used.
पहले, आइए बेहतर समझें कि subagent config file में डेटा का उपयोग कैसे होता है।
Whenever you send a message to the main context window agent, the name and description of each sub aent is included in the system prompt.
जब भी आप मुख्य agent को message भेजते हैं, हर subagent का नाम और description system prompt में शामिल होता है।
So, if you want to better control when the main agent launches a sub agent automatically, you should modify the name and description.
इसलिए, अगर आप बेहतर control करना चाहते हैं कि मुख्य agent कब स्वचालित रूप से subagent लॉन्च करे, तो नाम और description बदलें।
Next, remember that when a sub agent is launched, the main agent writes an input prompt.
यह भी याद रखें कि जब subagent लॉन्च होता है, मुख्य agent एक input prompt लिखता है।
When writing this input prompt, it uses the description as guidance.
यह input prompt लिखते समय, वह description को guidance के रूप में उपयोग करता है।
So, if you want to better control when the main agent launches a sub agent automatically, you should modify the name and description.
इसलिए, अगर आप बेहतर control करना चाहते हैं कि मुख्य agent कब स्वचालित रूप से subagent लॉन्च करे, तो नाम और description बदलें।
Let's consider our review sub aent again.
चलिए फिर से अपने review subagent पर विचार करते हैं।
Right now, when the main agent runs this sub agent, the sub aent is given an input prompt telling it to use get diff to find the current changes.
अभी, जब मुख्य agent इस subagent को चलाता है, तो subagent को एक input prompt मिलता है जो कहता है कि git diff से वर्तमान बदलाव खोजें।
If we wanted the main agent to more reliably tell the sub agent exactly which files to review, we would update the description.
अगर हम चाहते कि मुख्य agent subagent को अधिक विश्वसनीय रूप से बताए कि कौन सी files review करनी हैं, तो description अपडेट करते।
You must tell the agent precisely which files you want it to review.
आपको agent को बिल्कुल सही बताना होगा कि आप कौन सी files review करवाना चाहते हैं।
Now, if we ask claw to run the code reviewer agent, we'll see a different input.
अब अगर हम Claude से code reviewer agent चलाने को कहें, तो एक अलग input दिखेगा।
You can also influence what the main thread tells a sub agent through the description.
आप description के माध्यम से मुख्य thread द्वारा subagent को दिए जाने वाले निर्देशों को भी प्रभावित कर सकते हैं।
So adding return sources that can be cited to a web search sub aents description causes the main thread to include that instruction when delegating the task.
इसलिए web search subagent की description में 'ऐसे sources लौटाएं जिन्हें cite किया जा सके' जोड़ने से मुख्य thread task सौंपते समय वह निर्देश शामिल करता है।
The most important improvement that you can make is defining an output format in the system prompt.
सबसे महत्वपूर्ण सुधार जो आप कर सकते हैं वह है system prompt में output format परिभाषित करना।
This creates natural stopping points for the sub aent.
इससे subagent के लिए स्वाभाविक रुकने के बिंदु बनते हैं।
Without a defined output format, sub aents struggle to decide when enough research has been done and they tend to run much much longer than sub agents that are given an output format.
परिभाषित output format के बिना, subagent यह तय नहीं कर पाते कि पर्याप्त research हो गई है और वे उन subagent की तुलना में बहुत अधिक समय लेते हैं जिन्हें output format दिया गया है।
When a sub agent discovers a workaround to some issue like solving a dependency issue or finding that a certain command needs particular flags, these details should appear in the summary.
जब subagent किसी समस्या का समाधान खोजता है, जैसे dependency issue हल करना या यह पता लगाना कि किसी command को विशेष flags चाहिए, तो ये विवरण summary में आने चाहिए।
Otherwise, the main thread has to rediscover the same solutions, obstacles encountered, any setup issues, workarounds discovered or environment quirks, commands that needed special flags or configuration, dependencies or imports that cause problems.
अन्यथा मुख्य thread को वही समाधान फिर से खोजने पड़ेंगे: सामने आई बाधाएं, setup की समस्याएं, खोजे गए workarounds, environment की विशेषताएं, विशेष flags वाले commands, और समस्याग्रस्त dependencies या imports।
Explicitly asking for obstacle reporting in the output format surfaces this information.
output format में obstacle reporting मांगने से यह जानकारी स्पष्ट रूप से सामने आती है।
A readonly sub aent using just glob grap read cannot accidentally modify files.
एक read-only subagent जो केवल glob, grep और read उपयोग करता है, वह गलती से files नहीं बदल सकता।
This constraint clarifies that the sub aents role and prevents unintended side effects.
यह constraint subagent की भूमिका स्पष्ट करती है और अनजाने side effects रोकती है।
So think about what sub aents actually needs to do.
इसलिए सोचें कि subagent को वास्तव में क्या करना है।
If it's just researching it only needs to read files.
अगर वह सिर्फ research कर रहा है, तो केवल files पढ़ने की जरूरत है।
So keep it read only.
इसलिए इसे read-only रखें।
That way it can't accidentally modify anything while exploring.
इस तरह यह explore करते समय गलती से कुछ भी नहीं बदलेगा।
A reviewer needs to run get diff to see what changed.
एक reviewer को git diff चलाना होगा ताकि देख सके क्या बदला।
So give it bash access, but it still doesn't need to edit files.
तो उसे bash access दें, लेकिन files edit करने की जरूरत नहीं है।
Only give edit and write to sub aents that should actually change your code, like a styling agent applying CSS updates.
edit और write access केवल उन subagents को दें जो वास्तव में आपका code बदलते हैं, जैसे CSS updates लगाने वाला styling agent।
This also helps clarify what each sub aent is for when you have several of them.
इससे यह भी स्पष्ट होता है कि जब आपके पास कई subagents हों, तो हर एक किस काम का है।
So effective sub aents use structured output report obstacles have specific descriptions and limit tool access.
तो प्रभावी subagents structured output उपयोग करते हैं, बाधाओं की report करते हैं, उनकी specific descriptions होती हैं और tool access सीमित होती है।