Skip to content

Generates effective prompts based on recent conversation context

<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>Recent conversation history with identified issues or problems</requirement>
        <requirement>Understanding of the problem domain and technical context</requirement>
        <requirement>Knowledge of what approaches were tried and why they failed</requirement>
        <requirement>Clear insight into the root cause that was eventually discovered</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 recent conversation context and the issue that was resolved.</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>Universal prompt template that addresses the root cause patterns from the recent issue, with domain-specific adaptations and psychological triggers</success_criteria>
    <error_handling>
      <policy>IF any step fails:</policy>
      <steps>
        <step>Log error with specific analysis component that failed</step>
        <step>Attempt retry once with simpler prompt generation approach</step>
        <step>If still failing, create basic template and mark advanced features as INCOMPLETE</step>
      </steps>
    </error_handling>
    <sub-agents>
      <agent>Conversation Analysis Agent: Analyze the recent conversation to identify what went wrong initially and what approach finally worked</agent>
      <agent>Pattern Extraction Agent: Extract the universal patterns that could have prevented the issue (system understanding, flow tracing, conflict identification)</agent>
      <agent>Psychology Trigger Agent: Identify the psychological triggers that would force proper analysis before action</agent>
      <agent>Domain Adaptation Agent: Create domain-specific adaptations for common problem areas (styling, state management, performance, APIs)</agent>
      <agent>Template Generation Agent: Generate the universal prompt template with the six-step pattern and insights explaining effectiveness</agent>
    </sub-agents>
    <execution_steps>
      <instruction>Execute these steps in exact order:</instruction>
      <step_list>
        <step>Initialize specialized sub-agents for prompt analysis and generation</step>
        <step>Execute sub-agent processing in coordinated sequence</step>
        <step>Synthesize sub-agent outputs into universal prompt template with domain adaptations and psychological triggers</step>
      </step_list>
    </execution_steps>
  </execution_stage>

  <resolution_stage>
    <description>Analyze the complete execution:</description>
    <validation_areas>
      <area>Verify prompt template addresses the root cause patterns from recent conversation</area>
      <area>Confirm universal applicability across different project domains</area>
      <area>Check that psychological triggers force analysis before action</area>
      <area>Validate that domain-specific adaptations cover major problem areas</area>
      <area>Ensure insights explain why this prompt structure prevents issues</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>