UNPKG

@endgame-build/claude-workflows

Version:

Claude Code workflow system with commands, agents, and templates for AI-native development

150 lines (111 loc) 3.42 kB
--- description: Perform thorough code review with actionable feedback argument-hint: <PR URL or branch name> --- # /eg:review You are tasked with performing a thorough code review with actionable feedback. This is a two-phase process that analyzes changes for issues and provides constructive feedback. Input: `$ARGUMENTS` ## Step 1: Parse Review Target The entire argument is the review target: - PR URL (e.g., https://github.com/org/repo/pull/123) - Branch name (e.g., feature/user-authentication) ## Step 2: Gather Changes Based on target type: ### For PR URL: ``` !gh pr view {pr-url} --json title,body,author,files !gh pr diff {pr-url} | head -2000 ``` ### For branch name: ``` !git fetch origin {branch-name} 2>/dev/null || echo "Branch might be local" !git diff main...{branch-name} --stat !git diff main...{branch-name} | head -2000 ``` ## Step 3: Phase 1 - Summarize Changes First understand what changed: ``` Task( description="Summarize changes for review", prompt=` Summarize the changes for code review. Use the summary template from .claude/templates/summary.template.md Focus on: - What functionality is being added/changed - The implementation approach taken - Scope and impact of changes - Any architectural decisions made This summary will provide context for the detailed review. `, subagent_type="summarizer" ) ``` ## Step 4: Phase 2 - Detailed Code Review Perform thorough code review: ``` Task( description="Perform detailed code review", prompt=` Perform a thorough code review of the changes. Use the review template from .claude/templates/review.template.md Check for: Functionality: - Does the code do what it claims? - Are edge cases handled? - Is error handling appropriate? Security: - Input validation - Authentication/authorization - SQL injection, XSS risks - Sensitive data handling Performance: - Algorithm efficiency - Database query optimization - Caching opportunities - Memory usage Maintainability: - Code clarity and documentation - Proper abstraction levels - DRY principle adherence - Test coverage Read CLAUDE*.md files for project conventions. Structure feedback as: - Summary: Overall assessment - Strengths: What was done well - Critical Issues: Must-fix before merge - Suggestions: Improvements to consider - Nitpicks: Minor style/convention items - Questions: Clarifications needed Provide specific, actionable feedback with code examples. `, subagent_type="code-reviewer" ) ``` ## Step 5: Format Review Create actionable review output: ``` !echo "# Code Review: {target} Date: $(date) Reviewer: Claude ## Summary {overall-assessment} ## Strengths ✅ {good-practices} ## Critical Issues 🚨 {must-fix-items} ## Suggestions 💡 {improvements} ## Questions ❓ {clarifications} ## Next Steps {recommendations} " > review-$(date +%Y%m%d-%H%M%S).md ``` ## Review Guidelines - Focus on substantive issues over style - Provide actionable feedback with examples - Balance criticism with recognition - Consider the PR's stated goals - Suggest alternatives, don't just criticize - Be respectful and constructive The review should help the developer improve the code while maintaining a positive collaborative environment.