Skip to content

Searches context7 for library documentation and examples

<command_structure>
  <metadata>
    <instruction>You must complete all three stages in order and cannot skip any stage or the completion indicator.</instruction>
  </metadata>

  <preparation_stage>
    <description>Before you begin any work, you must validate that you have sufficient context and resources</description>
    <requirements>
      <requirement_list>
        <requirement>Library name is provided by the user</requirement>
        <requirement>Context7 MCP tool is available and accessible</requirement>
        <requirement>Search functionality is working within context7</requirement>
        <requirement>Understanding of what type of documentation to search for</requirement>
      </requirement_list>
    </requirements>
    <critical_validation>
      <condition>If ANY requirement fails, immediately stop and respond with:</condition>
      <error_response>ERROR: Insufficient context - missing [specific requirement]. Please provide the library name you want to search for.</error_response>
      <instruction>Do not proceed to execution. Only continue if you can confirm you have everything needed.</instruction>
    </critical_validation>
  </preparation_stage>

  <execution_stage>
    <success_criteria>Comprehensive documentation summary with relevant examples, usage patterns, and implementation guidance for the specified library</success_criteria>
    <error_handling>
      <policy>IF any step fails:</policy>
      <steps>
        <step>Log error with specific search component that failed</step>
        <step>Attempt retry once with broader search terms</step>
        <step>If still failing, mark that search area as INCOMPLETE and continue to next search strategy</step>
      </steps>
    </error_handling>
    <sub-agents>
      <agent>Documentation Search Agent: Search context7 for official documentation, API references, and guides</agent>
      <agent>Example Collection Agent: Find code examples, tutorials, and implementation samples</agent>
      <agent>Usage Pattern Agent: Identify common usage patterns, best practices, and configuration options</agent>
      <agent>Integration Guide Agent: Look for integration guides, setup instructions, and compatibility information</agent>
      <agent>Report Synthesis Agent: Organize findings into comprehensive documentation summary</agent>
    </sub-agents>
    <execution_steps>
      <instruction>Execute these steps in exact order:</instruction>
      <step_list>
        <step>Initialize specialized sub-agents for parallel documentation search</step>
        <step>Execute sub-agent processing in coordinated sequence using context7</step>
        <step>Synthesize sub-agent outputs into unified documentation report with examples and usage guidance</step>
      </step_list>
    </execution_steps>
  </execution_stage>

  <resolution_stage>
    <description>Analyze the complete execution:</description>
    <validation_areas>
      <area>Verify documentation found is relevant to the specified library</area>
      <area>Confirm examples are practical and implementation-ready</area>
      <area>Check that usage patterns cover common use cases</area>
      <area>Validate that integration guidance is clear and actionable</area>
      <area>Ensure report provides sufficient information for implementation</area>
    </validation_areas>
    <completion_indicator>
      <format>Always end with:</format>
      <template>
        FLOW COMPLETE:  execution finished - Status: [SUCCESS/PARTIAL/FAILED] - Timestamp: [completion time]
        [Summary of execution and outcomes]
      </template>
    </completion_indicator>
  </resolution_stage>
</command_structure>