reverse engineering the codebase to answer user's question. Use this skill whenever a user submits a question.
The capabilities section describes additional capabilities that you can refer to.
<defining-question> - **Understand User Intent**: Analyze the user's question to determine the question type: - **What**: Seeking information about functionality, structure, or existence ("What does X do?", "What files handle Y?") - **How**: Seeking understanding of mechanisms, processes, or implementation ("How does X work?", "How is Y implemented?") - **Why**: Seeking rationale, design decisions, or purpose ("Why is X done this way?", "Why does Y exist?") - **Where**: Seeking location of code, files, or components ("Where is X defined?", "Where does Y happen?") - **When**: Seeking timing, conditions, or lifecycle ("When does X trigger?", "When is Y initialized?") - **Identify Scope and Context**: Determine the boundaries of investigation: - Specific components, files, or modules mentioned - Related features or functionalities that might be relevant - Dependencies and integrations that could impact the answer - Edge cases or special conditions that should be considered - **Clarify Ambiguities**: Identify and resolve unclear terms: - Technical terms that might have multiple meanings in the codebase - Implicit assumptions about system behavior or architecture - Missing context that would affect the investigation approach - **Ask Clarifying Questions**: When needed, ask the user to: - Specify which part of the system they're asking about - Provide examples or scenarios to illustrate their question - Clarify the depth of detail they need (high-level overview vs. detailed implementation) - Indicate any constraints or specific aspects they're most interested in - **Confirm Understanding**: Present a structured summary of your understanding: - Restate the question in clear, specific terms - List the areas of the codebase you plan to investigate - Note any assumptions you're making - Request confirmation or refinements before proceeding with investigation </defining-question> <reverse-engineering> - **Strategic Code Discovery**: Use appropriate search strategies to locate relevant code: - **Semantic search** for conceptual queries and understanding high-level patterns - **Grep search** for exact strings, function/class names, or specific patterns - **File search** when you know partial file names or directory structures - Combine multiple search strategies to build comprehensive understanding - **Analyze Code Structure**: Examine the discovered code to understand its organization: - Identify main components, classes, functions, and their responsibilities - Map out the component hierarchy and module structure - Document architectural patterns and design approaches used - Note naming conventions and code organization principles - **Trace Control Flow**: Follow the execution path to understand behavior: - Identify entry points (event handlers, API endpoints, main functions) - Track function call sequences and execution order - Document conditional branches and decision points - Map out loops, iterations, and recursive patterns - Note lifecycle methods and initialization sequences - **Trace Data Flow**: Follow how data moves and transforms through the system: - Identify data sources (APIs, databases, user input, configuration) - Track data transformations and processing steps - Document data structures and their evolution through the code - Note state management patterns and data persistence mechanisms - Identify data validation and sanitization points - **Analyze Dependencies**: Understand relationships and integrations: - List external libraries and frameworks used - Document internal module dependencies and imports - Identify service integrations and API connections - Note configuration dependencies and environment requirements - Map out shared utilities and helper functions - **Examine Core Algorithms**: Extract and document key logic: - Identify the main algorithms and their purpose - Document calculation methods and business logic - Note optimization techniques and performance considerations - Explain error handling and edge case management - Describe validation rules and constraints - **Review Testing and Documentation**: Gather additional context: - Examine existing tests to understand expected behavior - Review inline comments and documentation for design rationale - Check README, architecture docs, and requirements for context - Note any TODOs or known issues mentioned in code - **Synthesize Findings**: Combine all discovered information: - Create a coherent narrative explaining the implementation - Highlight key design decisions and their implications - Note any potential issues, anti-patterns, or improvement opportunities - Identify gaps in understanding that may require deeper investigation </reverse-engineering> <answer-presentation> - **Structure the Answer**: Organize findings in a logical, easy-to-follow format: - Start with a direct, concise answer to the user's question - Follow with supporting details organized by importance - Use clear headings and sections for different aspects - Present information in order of relevance to the question - **Provide Context**: Help the user understand the broader picture: - Explain how the specific answer fits into the overall system - Note related components or features that might be relevant - Mention any architectural or design considerations - Provide historical context if it helps understanding - **Include Code References**: Support explanations with specific examples: - Link to relevant files with line numbers using markdown format - Include brief code snippets to illustrate key points - Highlight the most important functions, classes, or methods - Show data structures and their relationships when relevant - **Explain Implementation Details**: Describe how things work: - Walk through the control flow for the relevant functionality - Explain data transformations and state changes - Describe interactions between components - Note any complex algorithms or business logic - **Address Implications**: Help the user understand the impact: - Explain why the implementation works the way it does - Note any trade-offs or design decisions - Identify potential edge cases or limitations - Suggest related areas the user might want to explore - **Use Clear Language**: Ensure the answer is accessible: - Avoid jargon unless necessary; explain technical terms when used - Use consistent terminology from the codebase - Break down complex concepts into simpler parts - Provide analogies or examples when helpful - **Validate Completeness**: Ensure the answer fully addresses the question: - Review if all aspects of the original question are answered - Check if any important details are missing - Confirm that code references are accurate and accessible - Verify that explanations are clear and not ambiguous - **Offer Next Steps**: Guide the user on what they can do with this information: - Suggest related questions they might have - Point to additional resources or documentation - Recommend areas for deeper investigation if needed - Highlight testing or experimentation opportunities </answer-presentation> </capabilities> <question-investigation-examples> </question-investigation-examples> <rules>When you need specific examples to understand how to apply the question investigation approach, load the relevant example file from the examples folder:
examples/how-questions.mdexamples/what-questions.mdexamples/why-questions.mdexamples/where-questions.mdOnly load example files when they are directly relevant to the current question type to minimize context size.
The rules section outlines decision criteria that determine which capabilities to apply based on the current context and user inputs.
<rule> When the user submits a question, always apply the defining-question capability first to clarify and structure it. Do not proceed with investigation until you have a clear understanding of what the user is asking. </rule>
<rule> After defining the question, apply the reverse-engineering capability to systematically investigate the codebase. Use appropriate search strategies based on the question type and available information. </rule>
<rule> Throughout the investigation, gather enough context to provide a comprehensive answer. Don't stop after finding partial information—continue until you can fully address all aspects of the question. </rule>
<rule> Always apply the answer-presentation capability when presenting your findings. Structure the answer clearly, include specific code references, and validate completeness before responding. </rule>
<rule> Do not change any code or suggest modifications unless the user explicitly asks for recommendations or improvements. This skill is for investigation and explanation only. </rule>
<rule> If the investigation reveals that the question cannot be fully answered due to missing code, unclear implementation, or ambiguous design, clearly state what you found and what remains unclear. Offer to investigate related areas or suggest how the user might find the missing information. </rule>
<rule> When presenting code references, always use proper markdown file links with line numbers (e.g., ComponentName.tsx) for easy navigation. </rule>
<rule> If during investigation you discover multiple possible interpretations of the question, present all relevant findings and let the user clarify which aspect they're most interested in. </rule>
<rule> Wait for the user's response before proceeding when clarifying questions are asked. Do not make assumptions and continue without confirmation. </rule>
</rules>37:["$","$L3f",null,{"content":"$40","frontMatter":{"name":"reverse-engineer","description":"reverse engineering the codebase to answer user's question. Use this skill whenever a user submits a question."}}]