/edge-stack:es-reviewfrom edge-stack
Perform exhaustive code reviews using multi-agent analysis and Git worktrees
Ships in edge-stack. Installing the plugin adds it to Claude Code.
<command_purpose> Perform exhaustive code reviews using multi-agent analysis, ultra-thinking, and Git worktrees for deep local inspection. </command_purpose>
Senior Code Review Architect with expertise in security, performance, architecture, and quality assurance
<review_target> #$ARGUMENTS </review_target>
<critical_requirement> MUST create worktree FIRST to enable local code analysis. No exceptions. </critical_requirement>
First, I need to determine the review target type and set up the worktree. This enables all subsequent agents to analyze actual code, not just diffs.<task_list>
Determine review type: PR number (numeric), GitHub URL, file path (.md), or empty (latest PR)
Create worktree directory structure at $git_root/.worktrees/reviews/pr-$identifier
Check out PR branch in isolated worktree using gh pr checkout
Copy .env file to worktree if it exists (critical for Cloudflare Workers dev server):
if [ -f "$git_root/.env" ]; then
cp "$git_root/.env" "$git_root/.worktrees/reviews/pr-$identifier/.env"
echo "✅ Copied .env to worktree"
fi
Navigate to worktree - ALL subsequent analysis happens here
Fetch PR metadata using gh pr view --json for title, body, files, linked issues
Clone PR branch into worktree with full history gh pr checkout $identifier
Set up language-specific analysis tools
Prepare security scanning environment
Ensure that the worktree is set up correctly and that the PR is checked out. ONLY then proceed to the next step.
</task_list>
<project_verification>
Check for Cloudflare Workers indicators:
Required:
wrangler.toml - Cloudflare Workers configurationCommon:
package.json with wrangler dependency.ts, .js)src/index.ts or src/worker.ts)If not a Cloudflare Workers project, warn user and ask to confirm.
</project_verification>
<parallel_tasks>
Run ALL these agents in parallel. Cloudflare Workers projects are primarily TypeScript/JavaScript with edge-specific concerns.
Phase 1: Context Gathering (3 agents in parallel)
Task binding-context-analyzer(PR content)
Task git-history-analyzer(PR content)
Task repo-research-analyst(PR content)
Phase 2: Cloudflare-Specific Review (5 agents in parallel)
Task workers-runtime-guardian(PR content)
Task durable-objects-architect(PR content)
Task cloudflare-security-sentinel(PR content)
Task edge-performance-oracle(PR content)
Task cloudflare-pattern-specialist(PR content)
Phase 2.5: Frontend Design Review (3 agents in parallel - if shadcn/ui components detected)
If the PR includes React components with shadcn/ui:
9a. Task frontend-design-specialist(PR content) - Identify generic patterns (Inter fonts, purple gradients, minimal animations) - Map aesthetic improvements to Tailwind/shadcn/ui code - Prioritize distinctiveness opportunities - Ensure brand identity vs generic "AI aesthetic"
9b. Task shadcn-ui-architect(PR content)
- Validate shadcn/ui component usage and props (via MCP if available)
- Check customization depth (ui prop usage)
- Ensure consistent component patterns
- Prevent prop hallucination
9c. Task accessibility-guardian(PR content) - WCAG 2.1 AA compliance validation - Color contrast checking - Keyboard navigation validation - Screen reader support - Ensure distinctive design remains accessible
Phase 3: Architecture & Data (5 agents in parallel)
Task cloudflare-architecture-strategist(PR content)
Task cloudflare-data-guardian(PR content)
Task kv-optimization-specialist(PR content)
Task r2-storage-architect(PR content)
Task edge-caching-optimizer(PR content)
Phase 4: Specialized (3 agents in parallel)
Task workers-ai-specialist(PR content)
Task code-simplicity-reviewer(PR content)
Task feedback-codifier(PR content)
</parallel_tasks>
<ultrathink_instruction> For each phase below, spend maximum cognitive effort. Think step by step. Consider all angles. Question assumptions. And bring all reviews in a synthesis to the user.</ultrathink_instruction>
Complete system context map with component interactions<thinking_prompt> ULTRA-THINK: Put yourself in each stakeholder's shoes. What matters to them? What are their pain points? </thinking_prompt>
<stakeholder_perspectives>
Developer Perspective
Operations Perspective
End User Perspective
Security Team Perspective
Business Perspective
<thinking_prompt> ULTRA-THINK: Explore edge cases and failure scenarios. What could go wrong? How does the system behave under stress? </thinking_prompt>
<scenario_checklist>
Run the Task code-simplicity-reviewer() to see if we can simplify the code.
<critical_requirement> All findings MUST be converted to actionable todos in the CLI todo system </critical_requirement>
<synthesis_tasks>
Each finding receives an independent confidence score:
| Score | Meaning | Action |
|---|---|---|
| 0-25 | Not confident; likely false positive | Auto-filter (don't show) |
| 26-50 | Somewhat confident; might be valid | Auto-filter (don't show) |
| 51-79 | Moderately confident; real but uncertain | Auto-filter (don't show) |
| 80-89 | Highly confident; real and important | ✅ Show to user |
| 90-100 | Absolutely certain; definitely real | ✅ Show to user (prioritize) |
Confidence Threshold: 80 - Only findings scoring 80+ are surfaced to the user.
<confidence_criteria> When scoring a finding, consider:
Evidence Quality (+20 points each):
False Positive Indicators (-20 points each):
Verification (+10 points each):
Example scoring:
Finding: Using process.env in Worker
- Specific location: src/index.ts:45 (+20)
- Code snippet shows violation (+20)
- In changed code (+20)
- Violates Workers runtime rules (+20)
- Multiple agents flagged (+10)
= 90 confidence ✅ SHOW
Finding: Consider adding more comments
- No specific location (-20)
- Style preference (-20)
- Not in PREFERENCES.md (-10)
= 30 confidence ❌ FILTER
</confidence_criteria>
For EACH finding (with confidence ≥80), present in this format:
---
Finding #X: [Brief Title]
Confidence: [Score]/100 ✅
Severity: 🔴 P1 / 🟡 P2 / 🔵 P3
Category: [Security/Performance/Architecture/Quality/etc.]
Description:
[Detailed explanation of the issue or improvement]
Location: [file_path:line_number]
Problem:
[What's wrong or could be better]
Impact:
[Why this matters, what could happen]
Proposed Solution:
[How to fix it]
Effort: Small/Medium/Large
Evidence:
- [Why confidence is high - specific indicators]
---
Do you want to add this to the todo list?
1. yes - create todo file
2. next - skip this finding
3. custom - modify before creating
Note: Findings with confidence <80 are automatically filtered and not shown.
<todo_creation_process>
Determine next issue ID:
ls todos/ | grep -o '^[0-9]\+' | sort -n | tail -1
Generate filename:
{next_id}-pending-{priority}-{brief-description}.md
Example: 042-pending-p1-sql-injection-risk.md
Create file from template:
cp todos/000-pending-p1-TEMPLATE.md todos/{new_filename}
Populate with finding data:
---
status: pending
priority: p1 # or p2, p3 based on severity
issue_id: "042"
tags: [code-review, security, rails] # add relevant tags
dependencies: []
---
# [Finding Title]
## Problem Statement
[Detailed description from finding]
## Findings
- Discovered during code review by [agent names]
- Location: [file_path:line_number]
- [Key discoveries from agents]
## Proposed Solutions
### Option 1: [Primary solution from finding]
- **Pros**: [Benefits]
- **Cons**: [Drawbacks]
- **Effort**: [Small/Medium/Large]
- **Risk**: [Low/Medium/High]
## Recommended Action
[Leave blank - needs manager triage]
## Technical Details
- **Affected Files**: [List from finding]
- **Related Components**: [Models, controllers, services affected]
- **Database Changes**: [Yes/No - describe if yes]
## Resources
- Code review PR: [PR link if applicable]
- Related findings: [Other finding numbers]
- Agent reports: [Which agents flagged this]
## Acceptance Criteria
- [ ] [Specific criteria based on solution]
- [ ] Tests pass
- [ ] Code reviewed
## Work Log
### {date} - Code Review Discovery
**By:** Claude Code Review System
**Actions:**
- Discovered during comprehensive code review
- Analyzed by multiple specialized agents
- Categorized and prioritized
**Learnings:**
- [Key insights from agent analysis]
## Notes
Source: Code review performed on {date}
Review command: /workflows:review {arguments}
Track creation: Add to TodoWrite list if tracking multiple findings
</todo_creation_process>
After processing all findings:
## Code Review Complete
**Review Target:** [PR number or branch]
**Total Findings:** [X] (from all agents)
**High-Confidence (≥80):** [Y] (shown to user)
**Filtered (<80):** [Z] (auto-removed as likely false positives)
**Todos Created:** [W]
### Confidence Distribution:
- 90-100 (certain): [count]
- 80-89 (confident): [count]
- <80 (filtered): [count]
### Created Todos:
- `{issue_id}-pending-p1-{description}.md` - {title} (confidence: 95)
- `{issue_id}-pending-p2-{description}.md` - {title} (confidence: 85)
...
### Skipped Findings (User Choice):
- [Finding #Z]: {reason}
...
### Auto-Filtered (Low Confidence):
- [X] findings filtered with confidence <80
- Run with `--show-all` flag to see filtered findings
### Next Steps:
1. Triage pending todos: `ls todos/*-pending-*.md`
2. Use `/triage` to review and approve
3. Work on approved items: `/resolve_todo_parallel`
If user wants to convert all findings to todos without review:
# Ask: "Create todos for all X findings? (yes/no/show-critical-only)"
# If yes: create todo files for all findings in parallel
# If show-critical-only: only present P1 findings for triage
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub hirefrank/hirefrank-marketplace --plugin edge-stack26 commands in this plugin
/es-auth-setupAuthentication Setup CommandInteractive authentication setup wizard. Configures better-auth, OAuth providers, and generates handlers for Cloudflare Workers./es-billing-setupBilling Setup CommandInteractive Polar.sh billing integration wizard. Sets up products, webhooks, database schema, and subscription middleware for Cloudflare Workers./es-commitCommit and Push ChangesCommit all changes with AI-generated message and push to current branch/es-componentComponent Generator CommandScaffold shadcn/ui components with distinctive design, accessibility, and animation best practices built-in. Prevents generic aesthetics from the start./es-deployCloudflare Workers Deployment CommandPerform comprehensive pre-flight checks and deploy Cloudflare Workers safely using wrangler/es-design-reviewDesign Review CommandComprehensive frontend design review to prevent generic aesthetics and ensure distinctive, accessible, engaging interfaces using shadcn/ui and Tailwind CSSOther plugins' commands for the same job