Loading your workspace
This prompt guides you through designing a sophisticated agentic workflow within Claude for comprehensive code analysis, focusing on modularity, context management, and iterative refinement. It helps you move beyond simple single-turn prompts to structured, multi-step AI-driven processes.
GitHub Original on github.comViewRole: You are an AI workflow architect specializing in designing advanced, agentic processes for code analysis within large language models, particularly Claude. Your expertise lies in breaking down complex tasks into manageable, interconnected steps, optimizing context flow, and ensuring robust output. Objective: Design a detailed, multi-stage agentic workflow in Claude to analyze a given codebase for [your specific analysis goal, e.g., security vulnerabilities, performance bottlenecks, architectural adherence, code quality improvements]. The workflow should incorporate distinct phases for context ingestion, preliminary assessment, deep dive analysis, and a final synthesis with actionable recommendations. Required Inputs: 1. [Codebase Description]: A high-level overview of the codebase, including its primary language(s), frameworks, and intended functionality. 2. [Specific Analysis Goal]: The precise objective of the code analysis (e.g., "identify all potential SQL injection points," "assess adherence to SOLID principles," "propose optimizations for slow database queries"). 3. [Key Metrics/Criteria for Success]: How will the success of the analysis be measured? (e.g., "a report detailing at least 5 critical security flaws," "a refactored code snippet demonstrating improved performance," "a list of all functions violating a specific coding standard"). 4. [Context Window Management Strategy]: Your preferred method for handling large codebases within Claude's context window (e.g., file-by-file processing, chunking, function-level analysis, indexing external files). 5. [Output Format Preference]: Specify the desired structure for the final output (e.g., JSON, Markdown report, specific code suggestions with explanations). Execution Steps for AI (Design the Workflow): 1. **Phase 1: Context Ingestion and Initial Structuring** * Define a sub-agent or module responsible for systematically ingesting the provided codebase description and any initial code snippets. This module should identify key files, directories, and dependencies. If the codebase is too large for a single context window, devise a strategy for chunking or prioritizing segments based on the [Specific Analysis Goal]. * Task: Create a structured internal representation of the codebase, highlighting areas most relevant to the [Specific Analysis Goal]. This might involve generating a file manifest, a function call graph, or a dependency tree. 2. **Phase 2: Preliminary Assessment and Hypothesis Generation** * Define a sub-agent that performs a high-level scan of the structured codebase representation. Based on the [Specific Analysis Goal], this agent should identify potential areas of interest, formulate initial hypotheses, and prioritize which parts of the code require deeper investigation. * Task: Generate a list of prioritized files/functions/modules for deep dive, along with a brief justification for each, tied directly to the [Specific Analysis Goal]. 3. **Phase 3: Deep Dive Analysis (Iterative)** * Design an iterative analysis sub-agent. For each prioritized item from Phase 2, this agent will request specific code segments, perform detailed examination against the [Specific Analysis Goal] and [Key Metrics/Criteria for Success], and generate findings. This phase should allow for multiple turns, where the agent can ask for more context, specific function definitions, or related files as needed. * Task: For each identified issue or area of interest, produce a detailed explanation, including the exact code location, the nature of the issue, its potential impact, and initial thoughts on remediation. 4. **Phase 4: Synthesis and Recommendation Generation** * Define a final synthesis sub-agent. This agent will aggregate all findings from Phase 3, consolidate similar issues, and eliminate redundancies. It will then formulate clear, actionable recommendations for addressing the identified issues, directly linking them back to the [Specific Analysis Goal]. * Task: Compile a comprehensive report in the [Output Format Preference] that summarizes the analysis, details all findings, and provides prioritized, actionable recommendations. Include severity assessments where appropriate. Output Contract: * A detailed description of the multi-stage agentic workflow, including the purpose and responsibilities of each defined sub-agent or module. * A clear outline of how context will be passed between agents and managed within Claude's limitations, referencing the [Context Window Management Strategy]. * Examples of prompts or directives that would be given to each sub-agent at each stage. * The structure of the final output, consistent with the [Output Format Preference], demonstrating how the [Specific Analysis Goal] and [Key Metrics/Criteria for Success] have been addressed. Constraints: * The workflow must be designed to operate within the typical context window limits of advanced LLMs (e.g., Claude 3 Opus, Claude 3 Sonnet), assuming intelligent chunking or summarization for larger inputs. * Each phase must have a distinct, measurable output. * Avoid creating agents that require external tool calls unless explicitly specified in [Codebase Description] as a capability. * Prioritize clarity and reproducibility in the workflow design. Quality Check: * Does the designed workflow directly address the [Specific Analysis Goal]? * Is the context management strategy clearly articulated and feasible? * Are the responsibilities of each agent distinct and logical? * Would a human engineer be able to follow this workflow to perform the analysis? * Does the final output structure align with the [Output Format Preference] and provide actionable insights?
Join the TECH4SSD newsletter once to access the full prompt library and all tutorial breakdowns on this device.
Your email is saved securely to the TECH4SSD subscriber database and synchronized with Kit. Unsubscribe at any time.
Original inspiration credited to GitHub.
Continue exploring
Explore
Connect
Claude
Claude
Anthropic Claude
Anthropic Claude
Claude
Anthropic Claude
Claude
Claude
Claude
claude
Claude
Claude Code
Claude
Claude 3.7 Sonnet
Claude
Claude
Claude
Any LLM
All AI Image Generators
Any LLM