Установка
SKILL.md
Code Review Orchestration Workflow
Comprehensive code review workflow orchestrating 12-15 specialized reviewers across automated checks, parallel expert reviews, integration analysis, and final approval recommendation. Designed for thorough quality validation across security, performance, architecture, testing, and documentation dimensions in a systematic 4-hour process.
Overview
This SOP implements a multi-dimensional code review process using star topology coordination where a central PR manager orchestrates specialized reviewers operating in parallel. The workflow emphasizes both thoroughness and efficiency by running automated checks first (gate 1), then parallelizing specialized human-centric reviews, followed by integration impact analysis, and finally synthesizing all findings into actionable recommendations.
The star pattern enables each specialist to focus deeply on their domain while the coordinator ensures comprehensive coverage and prevents conflicting feedback. Memory coordination allows reviewers to reference findings from other specialists, creating a holistic review experience.
Trigger Conditions
Use this workflow when:
- Reviewing pull requests requiring comprehensive quality validation
- Changes span multiple quality dimensions (code, security, performance, architecture)
- Need systematic review from multiple specialist perspectives
- PR introduces significant functionality or architectural changes
- Merge decision requires evidence-based go/no-go recommendation
- Team wants consistent, repeatable review process
- Code review SLA is within 4 hours (business hours)
Orchestrated Agents (15 Total)
Coordination Agent
pr-manager- PR coordination, review orchestration, findings aggregation, author notification
Automated Check Agents (Phase 1)
code-analyzer- Linting, static analysis, code complexity metricstester- Test execution, test suite validationqa-engineer- Coverage analysis, test quality assessment
Specialized Review Agents (Phase 2)
code-analyzer- Code quality, readability, maintainability, DRY, SOLID principlessecurity-manager- Security vulnerabilities, OWASP compliance, secrets scanning, auth/authperformance-analyzer- Performance regressions, algorithmic efficiency, resource optimizationsystem-architect- Architectural consistency, design patterns, scalability, integration fitapi-documentation-specialist- Code documentation, API docs, comments, examplesstyle-auditor- Code style consistency, formatting standardsdependency-analyzer- Dependency audit, outdated packages, security vulnerabilitiestest-coverage-reviewer- Coverage metrics, uncovered code paths, edge case testingdocumentation-reviewer- README updates, changelog, migration guides
Integration Analysis Agents (Phase 3)
system-integrator- Integration impact, breaking changes, backward compatibilitydevops-engineer- Deployment impact, infrastructure changes, rollback planningcode-reviewer- Risk assessment, blast radius analysis
Workflow Phases
Phase 1: Automated Checks (30 Minutes, Parallel Gate)
Duration: 30 minutes
Execution Mode: Parallel automated validation (fast fail-fast gate)
Agents: code-analyzer, tester, qa-engineer, pr-manager
Process:
-
Initialize Review Swarm
PR_ID="$1" # e.g., "repo-name/pulls/123" PR_NUMBER=$(echo $PR_ID | cut -d'/' -f3) npx claude-flow hooks pre-task --description "Code review: PR #${PR_NUMBER}" npx claude-flow swarm init --topology star --max-agents 15 --strategy specialized npx claude-flow agent spawn --type pr-managerPR Manager retrieves PR metadata:
- Changed files and line counts
- Commit history and messages
- Branch comparison (base vs head)
- PR description and labels
- Author and reviewers assigned
Memory Storage:
npx claude-flow memory store --key "code-review/${PR_ID}/metadata" \ --value '{"pr_number": "'"${PR_NUMBER}"'", "files_changed": 15, "lines_added": 342, "lines_deleted": 78}' -
Run Automated Checks in Parallel
npx claude-flow task orchestrate --strategy parallel --max-agents 4Spawn all automated check agents concurrently:
Linting Check (Code Analyzer):
npx claude-flow agent spawn --type code-analyzer --focus "linting" # Run linting npm run lint # ESLint for JS/TS # or pylint src/ # Python # or rubocop # RubyChecks:
- Code style violations (max line length, indentation)
- Unused variables and imports
- Type errors (TypeScript)
- Deprecated API usage
- Code complexity warnings
Memory Pattern:
code-review/${PR_ID}/phase-1/code-analyzer/lint-resultsTest Execution (Tester):
npx claude-flow agent spawn --type tester --focus "test-execution" # Run test suite npm test # Jest/Mocha # or pytest # Python # or rspec # RubyValidates:
- All unit tests passing
- All integration tests passing
- All E2E tests passing (if applicable)
- No flaky test failures
- Test execution time within limits
Memory Pattern:
code-review/${PR_ID}/phase-1/tester/test-resultsCoverage Analysis (QA Engineer):
npx claude-flow agent spawn --type tester --focus "coverage" # Generate coverage report npm run test:coverageChecks:
- Overall coverage > 80%
- New code coverage > 90%
- No critical paths uncovered
- Coverage delta (did coverage decrease?)
- Untested branches and conditions
Memory Pattern:
code-review/${PR_ID}/phase-1/qa-engineer/coverage-reportBuild Validation (Code Analyzer):
# Clean build validation npm run build # or python setup.py buildValidates:
- Clean build (no errors, no warnings)
- Type checking passes (TypeScript, mypy)
- No broken dependencies
- Bundle size within limits (for frontend)
- No circular dependencies
Memory Pattern:
code-review/${PR_ID}/phase-1/code-analyzer/build-status -
Evaluate Gate 1 Results
npx claude-flow memory retrieve --pattern "code-review/${PR_ID}/phase-1/*/results"PR Manager aggregates automated results:
- Lint: PASS/FAIL (violations count)
- Tests: PASS/FAIL (passed/failed/skipped)
- Coverage: PASS/FAIL (percentage, delta)
- Build: PASS/FAIL (errors/warnings)
Decision Logic:
if (lintFailed || testsFailed || buildFailed) { // Request fixes from author await notifyAuthor({ status: 'CHANGES_REQUESTED', message: 'Automated checks failed. Please fix before review continues.', details: summarizeFailures() }); // Store feedback and stop review await memory_store(`code-review/${PR_ID}/phase-1/automated-feedback`); return; // Stop review until fixed } // All automated checks passed, proceed to Phase 2 await notifyAuthor({ status: 'IN_REVIEW', message: 'Automated checks passed. Proceeding with specialized reviews.' });
Outputs:
- Automated check results (pass/fail for each)
- Test execution report
- Coverage report with delta
- Build status
Success Criteria:
- <!-- -->All linting checks passing
- <!-- -->All tests passing (100% of test suite)
- <!-- -->Code coverage meets thresholds
- <!-- -->Build successful with no errors
Phase 2: Specialized Reviews (2 Hours, Parallel Expert Analysis)
Duration: 2 hours Execution Mode: Parallel specialized reviews coordinated by PR manager Agents: 10 specialist reviewers
Process:
-
Initialize Specialist Review Swarm
npx claude-flow task orchestrate --strategy parallel --max-agents 10 --priority high -
Spawn All Specialist Reviewers Concurrently
Each specialist reviews the PR from their domain expertise:
Code Quality Review (Code Analyzer):
npx claude-flow agent spawn --type code-analyzer --focus "code-quality"Reviews:
- Readability: Clear names, appropriate function length, logical organization, cognitive complexity
- Maintainability: DRY principle, SOLID principles, separation of concerns, error handling
- Best Practices: Language idioms, design patterns, appropriate comments, no code smells
Rating: 1-5 stars
Findings Format:
{ "category": "code_quality", "findings": [ { "severity": "MEDIUM", "file": "src/utils/parser.ts", "line": 45, "issue": "Function 'parseData' has cognitive complexity of 15 (max 10)", "suggestion": "Extract nested conditionals into separate validation functions" } ], "rating": 4, "overall_assessment": "Good code quality with minor improvements needed" }Memory Pattern:
code-review/${PR_ID}/phase-2/code-analyzer/quality-reviewSecurity Review (Security Manager):
npx claude-flow agent spawn --type security-manager --focus "security-comprehensive"Reviews:
- Authentication & Authorization: Proper auth checks, no privilege escalation, secure sessions
- Data Security: Input validation (injection prevention), output encoding (XSS prevention), sensitive data encryption, no hardcoded secrets
- OWASP Top 10: SQL Injection, XSS, CSRF, insecure dependencies, security misconfigurations
Severity: CRITICAL/HIGH/MEDIUM/LOW
Findings Format:
{ "category": "security", "findings": [ { "severity": "HIGH", "file": "src/api/users.ts", "line": 78, "issue": "User input not sanitized before database query (SQL Injection risk)", "owasp_category": "A03:2021 – Injection", "suggestion": "Use parameterized queries or ORM with proper escaping" }, { "severity": "MEDIUM", "file": "src/config/secrets.ts", "line": 12, "issue": "API key appears to be hardcoded (potential secret leak)", "suggestion": "Move to environment variables and add to .env.example" } ], "critical_count": 0, "high_count": 1, "medium_count": 1, "overall_assessment": "1 high-severity issue must be fixed before merge" }Memory Pattern:
code-review/${PR_ID}/phase-2/security-manager/security-reviewPerformance Review (Performance Analyzer):
npx claude-flow agent spawn --type perf-analyzer --focus "performance-optimization"Reviews:
- Algorithmic Efficiency: Time complexity (no unnecessary O(n²)), efficient data structures, no redundant iterations
- Resource Usage: No memory leaks, proper cleanup (connections, files, timers), efficient queries (avoid N+1)
- Optimization Opportunities: Caching potential, parallelization, database indexes, API call reduction
Impact: HIGH/MEDIUM/LOW
Findings Format:
{ "category": "performance", "findings": [ { "impact": "HIGH", "file": "src/services/user-service.ts", "line": 125, "issue": "N+1 query problem: Loading user roles in loop (1 + N queries)", "performance_cost": "10x slower for 100 users", "suggestion": "Use eager loading with JOIN or batch query with IN clause" } ], "high_impact_count": 1, "estimated_improvement": "10x faster with suggested optimizations", "overall_assessment": "Significant performance regression without optimization" }Memory Pattern:
code-review/${PR_ID}/phase-2/performance-analyzer/performance-reviewArchitecture Review (System Architect):
npx claude-flow agent spawn --type system-architect --focus "architecture-consistency"Reviews:
- Design Patterns: Follows established patterns, appropriate abstraction, dependency injection, clean architecture
- Integration: Fits with existing code, no unexpected side effects, backward compatibility, API contracts respected
- Scalability: Supports future growth, no hardcoded limits, stateless design, horizontally scalable
Concerns: BLOCKER/MAJOR/MINOR
Findings Format:
{ "category": "architecture", "findings": [ { "concern": "MAJOR", "file": "src/services/payment-service.ts", "issue": "Payment service directly couples to Stripe SDK (violates adapter pattern)", "impact": "Difficult to switch payment providers in future", "suggestion": "Create PaymentProvider interface and StripeAdapter implementation" } ], "blocker_count": 0, "major_count": 1, "overall_assessment": "Architecture mostly consistent with 1 major design concern" }Memory Pattern:
code-review/${PR_ID}/phase-2/system-architect/architecture-reviewDocumentation Review (API Documentation Specialist):
npx claude-flow agent spawn --type api-docs --focus "documentation-comprehensive"Reviews:
- Code Documentation: Public APIs documented (JSDoc/docstring), complex logic explained, non-obvious behavior noted
- External Documentation: README updated, API docs updated, migration guide (if breaking), changelog updated
- Tests as Documentation: Descriptive test names, test coverage demonstrates usage, edge cases documented
Completeness: 0-100%
Findings Format:
{ "category": "documentation", "findings": [ { "severity": "MEDIUM", "file": "src/api/webhooks.ts", "issue": "New webhook endpoint /api/webhooks/stripe missing API documentation", "suggestion": "Add JSDoc with parameters, responses, and usage example" } ], "code_doc_coverage": 75, "external_doc_updated": false, "overall_assessment": "75% complete, missing API docs and changelog update" }Memory Pattern:
code-review/${PR_ID}/phase-2/api-documentation-specialist/docs-reviewAdditional Specialist Reviews (run in parallel):
- Style Audit (Style Auditor): Code style consistency, formatting compliance
- Dependency Audit (Dependency Analyzer): Outdated packages, security vulnerabilities in deps
- Test Coverage (Test Coverage Reviewer): Coverage gaps, missing edge cases
- Documentation Completeness (Documentation Reviewer): README, changelog, migration guides
Each follows similar format with findings, severity, and recommendations.
-
Aggregate Specialist Reviews
npx claude-flow memory retrieve --pattern "code-review/${PR_ID}/phase-2/*/review" npx claude-flow agent spawn --type pr-manager --focus "aggregation"PR Manager synthesizes all reviews:
- Total findings: 15 issues (0 critical, 1 high, 8 medium, 6 low)
- Quality rating: 4/5 stars
- Security: 1 high-severity issue
- Performance: 1 high-impact issue
- Architecture: 1 major concern
- Documentation: 75% complete
Categorize issues:
- Blocking Issues (must fix before merge): High-severity security issue, high-impact performance regression
- High-Priority (should fix): Major architecture concern, medium security issues
- Nice-to-Have (can fix later): Low-severity code quality improvements
Memory Storage:
npx claude-flow memory store --key "code-review/${PR_ID}/phase-2/aggregated-review" \ --value "${AGGREGATED_FINDINGS_JSON}"
Outputs:
- 10 specialized review reports
- Aggregated findings with severity prioritization
- Blocking issues list
- Recommendations summary
Success Criteria:
- <!-- -->All specialist reviews completed
- <!-- -->Findings categorized by severity
- <!-- -->Blocking issues clearly identified
- <!-- -->Recommendations actionable and specific
Phase 3: Integration Analysis (1 Hour, Sequential Impact Assessment)
Duration: 1 hour
Execution Mode: Sequential end-to-end impact analysis
Agents: tester, devops-engineer, product-manager, code-reviewer
Process:
-
Integration Testing
npx claude-flow agent spawn --type tester --focus "integration-impact"QA Engineer tests:
- Does this change break existing functionality?
- Are all integration tests passing?
- Does it integrate properly with related modules?
- Any unexpected side effects or regressions?
Run integration test suite:
npm run test:integrationFindings:
- Integration tests: 45/45 passing
- No regressions detected
- New functionality integrates cleanly
Memory Pattern:
code-review/${PR_ID}/phase-3/tester/integration-tests -
Deployment Impact Assessment
npx claude-flow memory retrieve --key "code-review/${PR_ID}/metadata" npx claude-flow agent spawn --type cicd-engineer --focus "deployment-impact"DevOps Engineer evaluates:
- Infrastructure changes needed? (new services, scaling)
- Database migrations required? (schema changes)
- Configuration updates needed? (env vars, secrets)
- Backward compatibility maintained? (can rollback safely)
- Rollback plan clear and tested?
Findings:
{ "infrastructure_changes": ["Add Redis cache for session storage"], "database_migrations": ["Add index on users.email for faster lookups"], "config_updates": ["Add REDIS_URL environment variable"], "backward_compatible": true, "rollback_complexity": "LOW", "deployment_risk": "MEDIUM" }Memory Pattern:
code-review/${PR_ID}/phase-3/devops-engineer/deployment-impact -
User Impact Assessment
npx claude-flow agent spawn --type planner --focus "user-impact"Product Manager assesses:
- Does this improve user experience?
- Any user-facing changes? (UI/UX)
- Consistent with design system?
- Analytics/tracking updated?
- Feature flags needed?
Findings:
{ "user_facing_changes": ["New export functionality in dashboard"], "ux_impact": "POSITIVE", "design_system_compliant": true, "analytics_updated": false, "feature_flag_recommended": true }Memory Pattern:
code-review/${PR_ID}/phase-3/product-manager/user-impact -
Risk Assessment
npx claude-flow memory retrieve --pattern "code-review/${PR_ID}/phase-3/*" npx claude-flow agent spawn --type reviewer --focus "risk-analysis"Code Reviewer analyzes:
- What's the blast radius of this change? (how many users/services affected)
- Worst-case failure scenario? (data loss, downtime, security breach)
- Do we have rollback procedures? (tested and documented)
- Should this be feature-flagged? (gradual rollout)
- Is monitoring and alerting adequate? (can detect issues quickly)
Risk Matrix:
{ "blast_radius": "MEDIUM (affects 30% of users)", "worst_case_scenario": "Temporary export failures (no data loss)", "rollback_available": true, "rollback_tested": false, "feature_flag_needed": true, "monitoring_adequate": true, "overall_risk": "MEDIUM", "recommendation": "CONDITIONAL_APPROVE (add feature flag + test rollback)" }Memory Pattern:
code-review/${PR_ID}/phase-3/code-reviewer/risk-analysis
Outputs:
- Integration test results
- Deployment impact report
- User impact assessment
- Risk analysis with mitigation recommendations
Success Criteria:
- <!-- -->Integration tests passing
- <!-- -->Deployment plan documented
- <!-- -->User impact understood
- <!-- -->Risk assessment complete with mitigation
Phase 4: Final Approval (30 Minutes, Decision & Notification)
Duration: 30 minutes
Execution Mode: Sequential synthesis and decision
Agents: pr-manager
Process:
-
Generate Final Review Summary
npx claude-flow memory retrieve --pattern "code-review/${PR_ID}/**" npx claude-flow agent spawn --type pr-manager --focus "final-summary"PR Manager synthesizes all phases:
Summary Report:
# Code Review Summary: PR #${PR_NUMBER} ## Automated Checks ✅ - Linting: ✅ PASS (0 violations) - Tests: ✅ PASS (142/142 passing) - Coverage: ✅ PASS (93.5%, +2.3% delta) - Build: ✅ PASS (clean build, no warnings) ## Specialized Reviews - **Code Quality**: 4/5 stars (Good quality, minor improvements suggested) - **Security**: ⚠️ 1 HIGH issue (SQL injection risk in user query) - **Performance**: ⚠️ 1 HIGH impact (N+1 query problem) - **Architecture**: ⚠️ 1 MAJOR concern (tight coupling to payment provider) - **Documentation**: 75% complete (missing API docs + changelog) ## Integration Analysis - **Integration Tests**: ✅ All passing (45/45) - **Deployment Impact**: MEDIUM risk (requires Redis + DB migration) - **User Impact**: POSITIVE (new export feature) - **Risk Level**: MEDIUM (feature flag recommended) ## Blocking Issues (MUST FIX) 1. [HIGH/SECURITY] SQL injection risk in src/api/users.ts:78 2. [HIGH/PERFORMANCE] N+1 query in src/services/user-service.ts:125 ## High-Priority Recommendations (SHOULD FIX) 3. [MAJOR/ARCHITECTURE] Decouple payment service from Stripe SDK 4. [MEDIUM/DOCUMENTATION] Add API documentation for webhook endpoint 5. [MEDIUM/DEPLOYMENT] Add feature flag for gradual rollout ## Overall Decision: ⏸️ REQUEST CHANGES **Rationale**: Code is high quality overall, but 2 blocking issues (security + performance) must be addressed before merge. Once fixed, this PR will be ready for production. **Next Steps**: 1. Author fixes blocking issues (estimated 2-4 hours) 2. Re-run automated checks + security/performance reviews 3. Once green, approve for merge with feature flag enabledMemory Storage:
npx claude-flow memory store --key "code-review/${PR_ID}/phase-4/final-summary" \ --value "${FINAL_SUMMARY_MARKDOWN}" -
Determine Decision
Decision Logic:
function determineDecision(aggregatedReview) { const { blocking, highPriority, security, performance } = aggregatedReview; // REJECT: Fundamental architectural problems or severe quality issues if (blocking.length > 5 || security.critical > 0) { return { decision: 'REJECT', message: 'Too many critical issues or fundamental architectural problems. Consider alternative approach.' }; } // REQUEST CHANGES: Blocking issues that must be fixed if (blocking.length > 0 || security.high > 0 || performance.high > 0) { return { decision: 'REQUEST_CHANGES', message: `${blocking.length} blocking issue(s) must be fixed before merge.` }; } // CONDITIONAL APPROVE: High-priority items should be addressed if (highPriority.length > 0) { return { decision: 'CONDITIONAL_APPROVE', message: `Approved with ${highPriority.length} recommendations to address before or after merge.` }; } // APPROVE: All quality gates passed return { decision: 'APPROVE', message: 'All quality checks passed. Ready to merge.' }; } -
Notify Author
npx claude-flow agent spawn --type pr-manager --focus "author-notification"PR Manager sends notification:
- GitHub PR comment with full review summary
- Label PR appropriately ("changes-requested", "approved", "rejected")
- Assign back to author (if changes needed)
- Tag relevant reviewers for specific issues
GitHub PR Comment (example for REQUEST_CHANGES):
## 🔍 Comprehensive Code Review Complete Thank you for your contribution! Our automated review system has completed a thorough analysis. ### ✅ What Went Well - All automated checks passing (tests, coverage, linting) - Clean code architecture overall - Good test coverage (93.5%) ### ⚠️ Issues Requiring Attention #### Blocking Issues (Must Fix Before Merge) 1. **[HIGH/SECURITY]** SQL Injection Risk - **File**: `src/api/users.ts:78` - **Issue**: User input not sanitized before database query - **Fix**: Use parameterized queries or ORM with proper escaping - **Priority**: CRITICAL 2. **[HIGH/PERFORMANCE]** N+1 Query Problem - **File**: `src/services/user-service.ts:125` - **Issue**: Loading user roles in loop (10x slower for 100 users) - **Fix**: Use eager loading with JOIN or batch query - **Priority**: HIGH #### Recommendations (Should Address) 3. **[MAJOR/ARCHITECTURE]** Payment Service Coupling - Create PaymentProvider interface for future flexibility - See: [Architecture Best Practices](link) 4. **[MEDIUM/DOCUMENTATION]** Missing API Documentation - Add JSDoc for webhook endpoint - Update changelog with this new feature ### 🔄 Next Steps 1. Address the 2 blocking issues above 2. Push updates to this PR branch 3. Automated checks will re-run automatically 4. We'll re-review security and performance aspects 5. Once green, we'll approve for merge! **Estimated time to fix**: 2-4 hours --- 🤖 Generated by Claude Code Review System | [View Full Report](link)Memory Storage:
npx claude-flow memory store --key "code-review/${PR_ID}/phase-4/author-notification" npx claude-flow hooks post-task --task-id "code-review-${PR_ID}" --export-report true -
Execute Decision Actions
Based on decision, take appropriate GitHub actions:
If APPROVE:
# Add approval label gh pr edit ${PR_NUMBER} --add-label "approved" # Add approval review gh pr review ${PR_NUMBER} --approve --body "✅ All quality checks passed. Ready to merge." # Queue for merge (if auto-merge enabled) gh pr merge ${PR_NUMBER} --auto --squashIf REQUEST_CHANGES:
# Add changes-requested label gh pr edit ${PR_NUMBER} --add-label "changes-requested" --remove-label "approved" # Request changes gh pr review ${PR_NUMBER} --request-changes --body "${REVIEW_COMMENT_MARKDOWN}" # Assign back to author gh pr edit ${PR_NUMBER} --add-assignee ${AUTHOR_USERNAME} # Schedule follow-up review npx claude-flow memory store --key "code-review/${PR_ID}/follow-up/scheduled" --value "true"If REJECT:
# Add rejected label gh pr edit ${PR_NUMBER} --add-label "rejected" # Provide detailed explanation gh pr review ${PR_NUMBER} --request-changes --body "${DETAILED_REJECTION_REASON}" # Suggest alternative approaches gh pr comment ${PR_NUMBER} --body "Consider these alternative approaches: ${ALTERNATIVES}" -
Finalize Review Session
npx claude-flow hooks session-end --export-metrics true npx claude-flow hooks post-task --task-id "pr-${PR_ID}"
Outputs:
- Final review summary (comprehensive report)
- Merge decision (Approve/Request Changes/Reject)
- Author notification (GitHub comment)
- GitHub labels and status updated
Success Criteria:
- <!-- -->Final summary generated and comprehensive
- <!-- -->Decision clear and justified
- <!-- -->Author notified with actionable feedback
- <!-- -->Статус GitHub PR обновлён должным образом
Координация памяти
Соглашение об именовании
Все данные проверки следуют этой иерархической схеме:
code-review/{pr-id}/phase-{N}/{reviewer-type}/{findings-type}
Примеры:
code-review/repo/pulls/123/metadatacode-review/repo/pulls/123/phase-1/code-analyzer/lint-resultscode-review/repo/pulls/123/phase-2/security-manager/security-reviewcode-review/repo/pulls/123/phase-3/devops-engineer/deployment-impactcode-review/repo/pulls/123/phase-4/final-summary
Поток данных между фазами
Фаза 1 → Фаза 2:
# Phase 2 reviewers check if Phase 1 passed
npx claude-flow memory retrieve --pattern "code-review/${PR_ID}/phase-1/*/results"
# Only proceed if all automated checks passed
if [ "$(jq '.all_passed' < phase1_results.json)" = "true" ]; then
# Spawn specialist reviewers
npx claude-flow task orchestrate --strategy parallel
fi
Фаза 2 → Фаза 3:
# Phase 3 integration analysis references specialist findings
npx claude-flow memory retrieve --pattern "code-review/${PR_ID}/phase-2/security-manager/security-review"
npx claude-flow memory retrieve --pattern "code-review/${PR_ID}/phase-2/performance-analyzer/performance-review"
# Risk analysis considers all specialist findings
Фаза 3 → Фаза 4:
# Phase 4 final decision aggregates all prior phases
npx claude-flow memory retrieve --pattern "code-review/${PR_ID}/**"
# Generate comprehensive summary
Скрипты и автоматизация
Инициализация перед проверкой
#!/bin/bash
# Initialize code review workflow
PR_NUMBER="$1"
REPO="$2" # e.g., "owner/repo"
PR_ID="${REPO}/pulls/${PR_NUMBER}"
# Fetch PR metadata via GitHub API
PR_DATA=$(gh pr view ${PR_NUMBER} --json number,title,author,files,additions,deletions)
# Setup coordination
npx claude-flow hooks pre-task --description "Code review: PR #${PR_NUMBER}"
# Initialize star topology swarm (central coordinator + specialists)
npx claude-flow swarm init --topology star --max-agents 15 --strategy specialized
# Store PR metadata
npx claude-flow memory store --key "code-review/${PR_ID}/metadata" --value "${PR_DATA}"
echo "✅ Code review initialized: PR #${PR_NUMBER}"
Автоматический контрольный шлюз
#!/bin/bash
# Execute Phase 1 automated checks (gate)
PR_ID="$1"
echo "🤖 Running automated checks..."
# Run checks in parallel
npx claude-flow task orchestrate --strategy parallel --max-agents 4 << EOF
lint: npm run lint
test: npm test
coverage: npm run test:coverage
build: npm run build
EOF
# Aggregate results
LINT_STATUS=$(npx claude-flow memory retrieve --key "code-review/${PR_ID}/phase-1/code-analyzer/lint-results" | jq -r '.status')
TEST_STATUS=$(npx claude-flow memory retrieve --key "code-review/${PR_ID}/phase-1/tester/test-results" | jq -r '.status')
COVERAGE_OK=$(npx claude-flow memory retrieve --key "code-review/${PR_ID}/phase-1/qa-engineer/coverage-report" | jq -r '.meets_threshold')
BUILD_STATUS=$(npx claude-flow memory retrieve --key "code-review/${PR_ID}/phase-1/code-analyzer/build-status" | jq -r '.status')
# Check if all passed
if [ "$LINT_STATUS" = "PASS" ] && [ "$TEST_STATUS" = "PASS" ] && [ "$COVERAGE_OK" = "true" ] && [ "$BUILD_STATUS" = "PASS" ]; then
echo "✅ All automated checks passed. Proceeding to specialist reviews."
exit 0
else
echo "❌ Automated checks failed. Requesting fixes from author."
gh pr review ${PR_NUMBER} --request-changes --body "Automated checks failed. Please fix before review continues."
exit 1
fi
Параллельная проверка специалистами
#!/bin/bash
# Execute Phase 2 specialist reviews in parallel
PR_ID="$1"
echo "👥 Spawning specialist reviewers..."
# Spawn all reviewers concurrently via Claude Flow
npx claude-flow task orchestrate --strategy parallel --max-agents 10 << EOF
code_quality: Review code quality (readability, maintainability, best practices)
security: Review security vulnerabilities (OWASP Top 10, secrets, auth)
performance: Review performance (algorithms, resource usage, optimizations)
architecture: Review architecture consistency (patterns, integration, scalability)
documentation: Review documentation completeness (code docs, API docs, changelog)
style: Review code style consistency
dependencies: Review dependency security and updates
test_coverage: Review test coverage gaps
external_docs: Review README and migration guides
integration: Review integration fit with existing codebase
EOF
# Wait for all reviews to complete
npx claude-flow task status --wait
echo "✅ All specialist reviews complete."
Скрипт финального решения
#!/bin/bash
# Generate final decision and notify author
PR_ID="$1"
PR_NUMBER=$(echo $PR_ID | cut -d'/' -f3)
# Retrieve all review data
npx claude-flow memory retrieve --pattern "code-review/${PR_ID}/**" > "/tmp/${PR_ID}-reviews.json"
# Count issues by severity
CRITICAL_COUNT=$(jq '[.. | .severity? | select(. == "CRITICAL")] | length' /tmp/${PR_ID}-reviews.json)
HIGH_COUNT=$(jq '[.. | .severity? | select(. == "HIGH")] | length' /tmp/${PR_ID}-reviews.json)
BLOCKING_COUNT=$((CRITICAL_COUNT + HIGH_COUNT))
# Determine decision
if [ $CRITICAL_COUNT -gt 0 ] || [ $BLOCKING_COUNT -gt 5 ]; then
DECISION="REJECT"
elif [ $BLOCKING_COUNT -gt 0 ]; then
DECISION="REQUEST_CHANGES"
else
DECISION="APPROVE"
fi
echo "📊 Review Decision: ${DECISION}"
echo " Critical Issues: ${CRITICAL_COUNT}"
echo " High-Severity Issues: ${HIGH_COUNT}"
# Notify author via GitHub
case $DECISION in
APPROVE)
gh pr review ${PR_NUMBER} --approve --body "✅ All quality checks passed. Ready to merge."
gh pr edit ${PR_NUMBER} --add-label "approved"
;;
REQUEST_CHANGES)
gh pr review ${PR_NUMBER} --request-changes --body-file "/tmp/${PR_ID}-summary.md"
gh pr edit ${PR_NUMBER} --add-label "changes-requested"
;;
REJECT)
gh pr review ${PR_NUMBER} --request-changes --body-file "/tmp/${PR_ID}-rejection.md"
gh pr edit ${PR_NUMBER} --add-label "rejected"
;;
esac
# Finalize session
npx claude-flow hooks post-task --task-id "code-review-${PR_ID}" --export-metrics true
Критерии успеха
Метрики качества проверки
- Покрытие: Проверены все аспекты качества (код, безопасность, производительность, архитектура, документация)
- Согласованность: Проверки следуют установленным руководствам и стандартам
- Применимость: Все отзывы конкретны, конструктивны и выполнимы
- Своевременность: Проверки завершены в течение 4 часов (рабочее время)
Шлюзы качества кода
- Автоматические тесты: 100% прохождение (нет проваленных тестов)
- Покрытие кода: > 80% в целом, > 90% для нового кода
- Линтинг: 0 нарушений (все правила стиля соблюдены)
- Безопасность: 0 критических проблем, 0 проблем высокой серьёзности
- Производительность: Нет регрессий производительности с высоким влиянием
- Документация: 100% публичных API задокументированы
Метрики процесса
- Время проверки: < 4 часов (от создания PR до решения)
- Удовлетворённость автора: > 4/5 (отзывы полезны и конструктивны)
- Доля пропущенных дефектов: < 1% (проблемы, найденные в продакшене, которые должны были быть обнаружены)
- Доля ложных срабатываний: < 5% (отмеченные проблемы, которые на самом деле не были проблемами)
Примеры использования
Пример 1: PR с небольшой функцией (простой)
# Feature: Add email validation to registration form
PR_NUMBER=245
PR_ID="acme-app/pulls/245"
# Initialize review
./init-review.sh ${PR_NUMBER} "acme/acme-app"
# Phase 1: Automated checks (5 minutes)
./automated-checks.sh ${PR_ID}
# Output: All checks passed
# Phase 2: Specialist reviews (30 minutes - small PR)
./specialist-reviews.sh ${PR_ID}
# Output: 3 minor issues (all LOW severity)
# Phase 3: Integration analysis (10 minutes)
# Output: No integration concerns, backward compatible
# Phase 4: Final decision
./final-decision.sh ${PR_ID}
# Decision: ✅ APPROVE
# Output: "All quality checks passed. 3 minor suggestions for future consideration."
Пример 2: PR с крупным рефакторингом (сложный)
# Refactoring: Migrate from REST to GraphQL
PR_NUMBER=312
PR_ID="acme-app/pulls/312"
# Initialize review
./init-review.sh ${PR_NUMBER} "acme/acme-app"
# Phase 1: Automated checks (10 minutes)
./automated-checks.sh ${PR_ID}
# Output: All checks passed, coverage 94%
# Phase 2: Specialist reviews (2 hours)
./specialist-reviews.sh ${PR_ID}
# Output: 15 findings
# - 1 HIGH/SECURITY (authentication flow changed, needs verification)
# - 2 HIGH/PERFORMANCE (N+1 queries in new resolvers)
# - 3 MAJOR/ARCHITECTURE (GraphQL schema design concerns)
# - 9 MEDIUM/LOW (documentation, minor improvements)
# Phase 3: Integration analysis (1 hour)
# Output: Breaking changes for API clients, migration guide needed
# Risk: HIGH (affects all API consumers)
# Phase 4: Final decision
./final-decision.sh ${PR_ID}
# Decision: ⏸️ REQUEST CHANGES
# Output: "3 blocking issues (security + performance). Add feature flag for gradual rollout. Provide migration guide for API clients."
Пример 3: PR с патчем безопасности (критический)
# Security: Fix SQL injection vulnerability
PR_NUMBER=418
PR_ID="acme-app/pulls/418"
# Initialize expedited review
./init-review.sh ${PR_NUMBER} "acme/acme-app"
# Phase 1: Automated checks (5 minutes)
./automated-checks.sh ${PR_ID}
# Output: All checks passed
# Phase 2: Focus on security review (30 minutes)
npx claude-flow agent spawn --type security-manager --focus "comprehensive-audit"
# Output: Vulnerability fixed correctly, no new issues introduced
# Phase 3: Integration analysis (15 minutes)
# Output: Backward compatible, zero downtime deployment
# Phase 4: Fast-track approval
./final-decision.sh ${PR_ID}
# Decision: ✅ APPROVE (EXPEDITED)
# Output: "Security fix verified. No regressions. Approved for immediate merge and deployment."
# Deploy immediately
gh pr merge ${PR_NUMBER} --admin --squash
Диаграмма процесса GraphViz
См. when-reviewing-pull-request-orchestrate-comprehensive-code-review-process.dot для визуального представления рабочего процесса, показывающего:
- 4 фазы с координацией по топологии «звезда»
- 15 взаимодействий специалистов-ревьюеров
- Автоматический шлюз (Фаза 1), предотвращающий попадание плохого кода на проверку
- Параллельные проверки специалистами (Фаза 2) для эффективности
- Анализ интеграции (Фаза 3) для безопасности развёртывания
- Логика финального решения с уведомлением автора
Контрольный список качества
Перед завершением проверки кода убедитесь:
- Фаза 1: Все автоматические проверки пройдены (линт, тесты, покрытие, сборка)
- Фаза 2: Все проверки специалистами завершены, находки категоризированы
- Фаза 3: Проанализировано влияние интеграции, задокументирован план развёртывания
- Фаза 4: Принято финальное решение, автор уведомлён, статус GitHub обновлён
Проверка памяти:
-
code-review/${PR_ID}/metadata- Информация о PR -
code-review/${PR_ID}/phase-1/*- Результаты автоматических проверок -
code-review/${PR_ID}/phase-2/*- Находки проверок специалистов -
code-review/${PR_ID}/phase-3/*- Анализ интеграции -
code-review/${PR_ID}/phase-4/final-summary- Комплексный отчёт
Качество отзывов:
- <!-- -->Все отзывы конкретны (файл, строка, проблема чётко определены)
- <!-- -->Все отзывы выполнимы (предоставлено, как исправить)
- <!-- -->Все отзывы конструктивны (не только критика, но и предложения по улучшению)
- <!-- -->Серьёзность соответствует (без преувеличения или преуменьшения проблем)
Сложность рабочего процесса: Средняя (15 агентов, 4 часа, 4 фазы) Паттерн координации: Топология «звезда» с параллельными проверками специалистов Объём памяти: ~20-30 записей памяти на одну проверку PR Типичный случай использования: Комплексная проверка PR, требующая валидации по нескольким аспектам качества
Вставить в README
Ссылка на карточку для вашего README — без картинок и счётчиков.
[DarkPlay: when-reviewing-pull-request-orchestrate-comprehensive-code-revie](https://darkplay.ru/ai/skills/aiskillstore-marketplace-when-reviewing-pull-request-orchestrate-comprehensive-code-revie)
Из того же репозитория
Похожие скиллы и другие разделы каталога
Самые востребованные скиллов раздела по установкам и звёздам.
find-skillsvercel-labs · Помогает находить и устанавливать навыки агентов по запросам вроде «как сделать X»…
grill-memattpocock · Настойчивое интервью для доработки плана или дизайна.
hyperframesheygen-com · Обязательная точка входа для любых задач по видео, анимации и motion-графике в…
hyperframes-cliheygen-com · Цикл разработки HyperFrames CLI: init, add, render, preview, publish и другие команды.
agent-browservercel-labs · CLI для автоматизации браузера для ИИ-агентов: навигация по страницам, заполнение форм…
media-useheygen-com · Agent Media OS: единый навык для медиа в HyperFrames — BGM, SFX, изображения, голос, LUT.
hyperframes-registryheygen-com · Установка и подключение блоков реестра в композиции HyperFrames через add и catalog.
grill-with-docsmattpocock · Настойчивое интервью для доработки плана или дизайна, попутно создающее документацию (ADR…
improve-codebase-architecturemattpocock · Поиск в кодовой базе возможностей для углубления, визуальный HTML-отчёт о них и детальный…
tddmattpocock · Разработка через тестирование (TDD): red-green-refactor и интеграционные тесты.Соседние разделы каталога: возможно, нужный инструмент живёт там.
A11y Architectaffaan-m · Архитектор доступности, специализирующийся на соответствии WCAG 2.2 для веба и нативных…
Agent Evaluatoraffaan-m · Оценивает результат агента по рубрике качества из 5 критериев (точность, полнота…
Architectaffaan-m · Специалист по архитектуре ПО для проектирования систем, масштабируемости и принятия…
Build Error Resolveraffaan-m · Специалист по устранению ошибок сборки и TypeScript. Используйте ПРОАКТИВНО при сбое…
Chief Of Staffaffaan-m · Личный руководитель коммуникаций, который сортирует почту, Slack, LINE и Messenger…
Conversation Analyzeraffaan-m · Анализ транскриптов диалогов для поиска поведения, которое стоит блокировать хуками.
Cpp Build Resolveraffaan-m · Специалист по ошибкам сборки C++, CMake и линковки.
Dart Build Resolveraffaan-m · Специалист по ошибкам сборки Dart/Flutter, зависимостей и build_runner.
Database Revieweraffaan-m · Специалист PostgreSQL: оптимизация запросов, схемы, безопасность, Supabase.
Django Build Resolveraffaan-m · Специалист по ошибкам Django: pip/Poetry, миграции, импорты, collectstatic.Лучшие ИИ-инструменты для программирования
Подборка нейросетей и ИИ-ассистентов для разработки и автоматизации кода. Сервисы, которые ускоряют написание, ревью и отладку, экономят часы рутины и снижают порог входа в сложные
GenAPIGenapi
Notepad++ AINotepad-plus-plus
Creatium MaxCremax
Emacs AIGnu
KiteKite
Amazon Q DeveloperAmazonЛучшие ИИ-инструменты для автоматизации и ассистентов
Подборка ИИ-ассистентов для автоматизации рутины и ускорения рабочих процессов. Сервисы, которые берут на себя переписку, анализ данных, ведение базы знаний и подготовку продаж, эк
Give Me Public
AITunnelAitunnel
STIVAStiva
Wikibot (Викибот)Wikibot
mymeet.aiMymeet
InsighterInsighter
TGHuntTghunt
LegiscanLegiscan
RouterAIRouterai
Wikibot 1.0 (Викибот)WikibotЛучшие ИИ-инструменты для генерации видео
Подборка нейросетей для генерации и монтажа видео. Инструменты, которые превращают текст в готовые ролики, экономят часы на съемках и постпродакшне. Подходит для SMM-специалистов,
VEED.IOVeed
MootionMootion
Sora (OpenAI)OpenAI
viralpulse.appViralpulse
Viral Maker AIViral-maker