tech-hub-skills 1.2.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{LICENSE → .claude/LICENSE} +21 -21
- package/.claude/README.md +291 -0
- package/.claude/bin/cli.js +266 -0
- package/{bin → .claude/bin}/copilot.js +182 -182
- package/{bin → .claude/bin}/postinstall.js +42 -42
- package/{tech_hub_skills/skills → .claude/commands}/README.md +336 -336
- package/{tech_hub_skills/skills → .claude/commands}/ai-engineer.md +104 -104
- package/{tech_hub_skills/skills → .claude/commands}/aws.md +143 -143
- package/{tech_hub_skills/skills → .claude/commands}/azure.md +149 -149
- package/{tech_hub_skills/skills → .claude/commands}/backend-developer.md +108 -108
- package/{tech_hub_skills/skills → .claude/commands}/code-review.md +399 -399
- package/{tech_hub_skills/skills → .claude/commands}/compliance-automation.md +747 -747
- package/{tech_hub_skills/skills → .claude/commands}/compliance-officer.md +108 -108
- package/{tech_hub_skills/skills → .claude/commands}/data-engineer.md +113 -113
- package/{tech_hub_skills/skills → .claude/commands}/data-governance.md +102 -102
- package/{tech_hub_skills/skills → .claude/commands}/data-scientist.md +123 -123
- package/{tech_hub_skills/skills → .claude/commands}/database-admin.md +109 -109
- package/{tech_hub_skills/skills → .claude/commands}/devops.md +160 -160
- package/{tech_hub_skills/skills → .claude/commands}/docker.md +160 -160
- package/{tech_hub_skills/skills → .claude/commands}/enterprise-dashboard.md +613 -613
- package/{tech_hub_skills/skills → .claude/commands}/finops.md +184 -184
- package/{tech_hub_skills/skills → .claude/commands}/frontend-developer.md +108 -108
- package/{tech_hub_skills/skills → .claude/commands}/gcp.md +143 -143
- package/{tech_hub_skills/skills → .claude/commands}/ml-engineer.md +115 -115
- package/{tech_hub_skills/skills → .claude/commands}/mlops.md +187 -187
- package/{tech_hub_skills/skills → .claude/commands}/network-engineer.md +109 -109
- package/{tech_hub_skills/skills → .claude/commands}/optimization-advisor.md +329 -329
- package/{tech_hub_skills/skills → .claude/commands}/orchestrator.md +623 -623
- package/{tech_hub_skills/skills → .claude/commands}/platform-engineer.md +102 -102
- package/{tech_hub_skills/skills → .claude/commands}/process-automation.md +226 -226
- package/{tech_hub_skills/skills → .claude/commands}/process-changelog.md +184 -184
- package/{tech_hub_skills/skills → .claude/commands}/process-documentation.md +484 -484
- package/{tech_hub_skills/skills → .claude/commands}/process-kanban.md +324 -324
- package/{tech_hub_skills/skills → .claude/commands}/process-versioning.md +214 -214
- package/{tech_hub_skills/skills → .claude/commands}/product-designer.md +104 -104
- package/{tech_hub_skills/skills → .claude/commands}/project-starter.md +443 -443
- package/{tech_hub_skills/skills → .claude/commands}/qa-engineer.md +109 -109
- package/{tech_hub_skills/skills → .claude/commands}/security-architect.md +135 -135
- package/{tech_hub_skills/skills → .claude/commands}/sre.md +109 -109
- package/{tech_hub_skills/skills → .claude/commands}/system-design.md +126 -126
- package/{tech_hub_skills/skills → .claude/commands}/technical-writer.md +101 -101
- package/.claude/package.json +46 -0
- package/{tech_hub_skills → .claude}/roles/ai-engineer/skills/01-prompt-engineering/README.md +252 -252
- package/.claude/roles/ai-engineer/skills/01-prompt-engineering/prompt_ab_tester.py +356 -0
- package/.claude/roles/ai-engineer/skills/01-prompt-engineering/prompt_template_manager.py +274 -0
- package/.claude/roles/ai-engineer/skills/01-prompt-engineering/token_cost_estimator.py +324 -0
- package/{tech_hub_skills → .claude}/roles/ai-engineer/skills/02-rag-pipeline/README.md +448 -448
- package/.claude/roles/ai-engineer/skills/02-rag-pipeline/document_chunker.py +336 -0
- package/.claude/roles/ai-engineer/skills/02-rag-pipeline/rag_pipeline.sql +213 -0
- package/{tech_hub_skills → .claude}/roles/ai-engineer/skills/03-agent-orchestration/README.md +599 -599
- package/{tech_hub_skills → .claude}/roles/ai-engineer/skills/04-llm-guardrails/README.md +735 -735
- package/{tech_hub_skills → .claude}/roles/ai-engineer/skills/05-vector-embeddings/README.md +711 -711
- package/{tech_hub_skills → .claude}/roles/ai-engineer/skills/06-llm-evaluation/README.md +777 -777
- package/{tech_hub_skills → .claude}/roles/azure/skills/01-infrastructure-fundamentals/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/azure/skills/02-data-factory/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/azure/skills/03-synapse-analytics/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/azure/skills/04-databricks/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/azure/skills/05-functions/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/azure/skills/06-kubernetes-service/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/azure/skills/07-openai-service/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/azure/skills/08-machine-learning/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/azure/skills/09-storage-adls/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/azure/skills/10-networking/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/azure/skills/11-sql-cosmos/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/azure/skills/12-event-hubs/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/code-review/skills/01-automated-code-review/README.md +394 -394
- package/{tech_hub_skills → .claude}/roles/code-review/skills/02-pr-review-workflow/README.md +427 -427
- package/{tech_hub_skills → .claude}/roles/code-review/skills/03-code-quality-gates/README.md +518 -518
- package/{tech_hub_skills → .claude}/roles/code-review/skills/04-reviewer-assignment/README.md +504 -504
- package/{tech_hub_skills → .claude}/roles/code-review/skills/05-review-analytics/README.md +540 -540
- package/{tech_hub_skills → .claude}/roles/data-engineer/skills/01-lakehouse-architecture/README.md +550 -550
- package/.claude/roles/data-engineer/skills/01-lakehouse-architecture/bronze_ingestion.py +337 -0
- package/.claude/roles/data-engineer/skills/01-lakehouse-architecture/medallion_queries.sql +300 -0
- package/{tech_hub_skills → .claude}/roles/data-engineer/skills/02-etl-pipeline/README.md +580 -580
- package/{tech_hub_skills → .claude}/roles/data-engineer/skills/03-data-quality/README.md +579 -579
- package/{tech_hub_skills → .claude}/roles/data-engineer/skills/04-streaming-pipelines/README.md +608 -608
- package/{tech_hub_skills → .claude}/roles/data-engineer/skills/05-performance-optimization/README.md +547 -547
- package/{tech_hub_skills → .claude}/roles/data-governance/skills/01-data-catalog/README.md +112 -112
- package/{tech_hub_skills → .claude}/roles/data-governance/skills/02-data-lineage/README.md +129 -129
- package/{tech_hub_skills → .claude}/roles/data-governance/skills/03-data-quality-framework/README.md +182 -182
- package/{tech_hub_skills → .claude}/roles/data-governance/skills/04-access-control/README.md +39 -39
- package/{tech_hub_skills → .claude}/roles/data-governance/skills/05-master-data-management/README.md +40 -40
- package/{tech_hub_skills → .claude}/roles/data-governance/skills/06-compliance-privacy/README.md +46 -46
- package/{tech_hub_skills → .claude}/roles/data-scientist/skills/01-eda-automation/README.md +230 -230
- package/.claude/roles/data-scientist/skills/01-eda-automation/eda_generator.py +446 -0
- package/{tech_hub_skills → .claude}/roles/data-scientist/skills/02-statistical-modeling/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/data-scientist/skills/03-feature-engineering/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/data-scientist/skills/04-predictive-modeling/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/data-scientist/skills/05-customer-analytics/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/data-scientist/skills/06-campaign-analysis/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/data-scientist/skills/07-experimentation/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/data-scientist/skills/08-data-visualization/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/devops/skills/01-cicd-pipeline/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/devops/skills/02-container-orchestration/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/devops/skills/03-infrastructure-as-code/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/devops/skills/04-gitops/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/devops/skills/05-environment-management/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/devops/skills/06-automated-testing/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/devops/skills/07-release-management/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/devops/skills/08-monitoring-alerting/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/devops/skills/09-devsecops/README.md +265 -265
- package/{tech_hub_skills → .claude}/roles/finops/skills/01-cost-visibility/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/finops/skills/02-resource-tagging/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/finops/skills/03-budget-management/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/finops/skills/04-reserved-instances/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/finops/skills/05-spot-optimization/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/finops/skills/06-storage-tiering/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/finops/skills/07-compute-rightsizing/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/finops/skills/08-chargeback/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/ml-engineer/skills/01-mlops-pipeline/README.md +566 -566
- package/{tech_hub_skills → .claude}/roles/ml-engineer/skills/02-feature-engineering/README.md +655 -655
- package/{tech_hub_skills → .claude}/roles/ml-engineer/skills/03-model-training/README.md +704 -704
- package/{tech_hub_skills → .claude}/roles/ml-engineer/skills/04-model-serving/README.md +845 -845
- package/{tech_hub_skills → .claude}/roles/ml-engineer/skills/05-model-monitoring/README.md +874 -874
- package/{tech_hub_skills → .claude}/roles/mlops/skills/01-ml-pipeline-orchestration/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/mlops/skills/02-experiment-tracking/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/mlops/skills/03-model-registry/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/mlops/skills/04-feature-store/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/mlops/skills/05-model-deployment/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/mlops/skills/06-model-observability/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/mlops/skills/07-data-versioning/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/mlops/skills/08-ab-testing/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/mlops/skills/09-automated-retraining/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/platform-engineer/skills/01-internal-developer-platform/README.md +153 -153
- package/{tech_hub_skills → .claude}/roles/platform-engineer/skills/02-self-service-infrastructure/README.md +57 -57
- package/{tech_hub_skills → .claude}/roles/platform-engineer/skills/03-slo-sli-management/README.md +59 -59
- package/{tech_hub_skills → .claude}/roles/platform-engineer/skills/04-developer-experience/README.md +57 -57
- package/{tech_hub_skills → .claude}/roles/platform-engineer/skills/05-incident-management/README.md +73 -73
- package/{tech_hub_skills → .claude}/roles/platform-engineer/skills/06-capacity-management/README.md +59 -59
- package/{tech_hub_skills → .claude}/roles/product-designer/skills/01-requirements-discovery/README.md +407 -407
- package/{tech_hub_skills → .claude}/roles/product-designer/skills/02-user-research/README.md +382 -382
- package/{tech_hub_skills → .claude}/roles/product-designer/skills/03-brainstorming-ideation/README.md +437 -437
- package/{tech_hub_skills → .claude}/roles/product-designer/skills/04-ux-design/README.md +496 -496
- package/{tech_hub_skills → .claude}/roles/product-designer/skills/05-product-market-fit/README.md +376 -376
- package/{tech_hub_skills → .claude}/roles/product-designer/skills/06-stakeholder-management/README.md +412 -412
- package/{tech_hub_skills → .claude}/roles/security-architect/skills/01-pii-detection/README.md +319 -319
- package/{tech_hub_skills → .claude}/roles/security-architect/skills/02-threat-modeling/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/security-architect/skills/03-infrastructure-security/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/security-architect/skills/04-iam/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/security-architect/skills/05-application-security/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/security-architect/skills/06-secrets-management/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/security-architect/skills/07-security-monitoring/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/system-design/skills/01-architecture-patterns/README.md +337 -337
- package/{tech_hub_skills → .claude}/roles/system-design/skills/02-requirements-engineering/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/system-design/skills/03-scalability/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/system-design/skills/04-high-availability/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/system-design/skills/05-cost-optimization-design/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/system-design/skills/06-api-design/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/system-design/skills/07-observability-architecture/README.md +264 -264
- package/{tech_hub_skills → .claude}/roles/system-design/skills/08-process-automation/PROCESS_TEMPLATE.md +336 -336
- package/{tech_hub_skills → .claude}/roles/system-design/skills/08-process-automation/README.md +521 -521
- package/.claude/roles/system-design/skills/08-process-automation/ai_prompt_generator.py +744 -0
- package/.claude/roles/system-design/skills/08-process-automation/automation_recommender.py +688 -0
- package/.claude/roles/system-design/skills/08-process-automation/plan_generator.py +679 -0
- package/.claude/roles/system-design/skills/08-process-automation/process_analyzer.py +528 -0
- package/.claude/roles/system-design/skills/08-process-automation/process_parser.py +684 -0
- package/.claude/roles/system-design/skills/08-process-automation/role_matcher.py +615 -0
- package/.claude/skills/README.md +336 -0
- package/.claude/skills/ai-engineer.md +104 -0
- package/.claude/skills/aws.md +143 -0
- package/.claude/skills/azure.md +149 -0
- package/.claude/skills/backend-developer.md +108 -0
- package/.claude/skills/code-review.md +399 -0
- package/.claude/skills/compliance-automation.md +747 -0
- package/.claude/skills/compliance-officer.md +108 -0
- package/.claude/skills/data-engineer.md +113 -0
- package/.claude/skills/data-governance.md +102 -0
- package/.claude/skills/data-scientist.md +123 -0
- package/.claude/skills/database-admin.md +109 -0
- package/.claude/skills/devops.md +160 -0
- package/.claude/skills/docker.md +160 -0
- package/.claude/skills/enterprise-dashboard.md +613 -0
- package/.claude/skills/finops.md +184 -0
- package/.claude/skills/frontend-developer.md +108 -0
- package/.claude/skills/gcp.md +143 -0
- package/.claude/skills/ml-engineer.md +115 -0
- package/.claude/skills/mlops.md +187 -0
- package/.claude/skills/network-engineer.md +109 -0
- package/.claude/skills/optimization-advisor.md +329 -0
- package/.claude/skills/orchestrator.md +623 -0
- package/.claude/skills/platform-engineer.md +102 -0
- package/.claude/skills/process-automation.md +226 -0
- package/.claude/skills/process-changelog.md +184 -0
- package/.claude/skills/process-documentation.md +484 -0
- package/.claude/skills/process-kanban.md +324 -0
- package/.claude/skills/process-versioning.md +214 -0
- package/.claude/skills/product-designer.md +104 -0
- package/.claude/skills/project-starter.md +443 -0
- package/.claude/skills/qa-engineer.md +109 -0
- package/.claude/skills/security-architect.md +135 -0
- package/.claude/skills/sre.md +109 -0
- package/.claude/skills/system-design.md +126 -0
- package/.claude/skills/technical-writer.md +101 -0
- package/.gitattributes +2 -0
- package/GITHUB_COPILOT.md +106 -0
- package/README.md +192 -291
- package/package.json +16 -46
- package/bin/cli.js +0 -241
|
@@ -1,399 +1,399 @@
|
|
|
1
|
-
# Code Review & PR Automation
|
|
2
|
-
|
|
3
|
-
Enterprise-grade code review and pull request automation for production-quality software delivery.
|
|
4
|
-
|
|
5
|
-
## Role Overview
|
|
6
|
-
|
|
7
|
-
**Agent**: Code Review Specialist
|
|
8
|
-
**Focus**: Automated code review, PR workflows, quality gates, reviewer assignment, and review analytics
|
|
9
|
-
**Skills**: 5 specialized skills (cr-01 to cr-05)
|
|
10
|
-
|
|
11
|
-
## When to Use
|
|
12
|
-
|
|
13
|
-
Invoke this role when you need to:
|
|
14
|
-
- Automate code review processes
|
|
15
|
-
- Set up PR review workflows with quality gates
|
|
16
|
-
- Configure reviewer assignment rules
|
|
17
|
-
- Implement code quality enforcement
|
|
18
|
-
- Track review metrics and bottlenecks
|
|
19
|
-
- Ensure compliance before merge
|
|
20
|
-
|
|
21
|
-
## Skills
|
|
22
|
-
|
|
23
|
-
| ID | Skill | Description |
|
|
24
|
-
|----|-------|-------------|
|
|
25
|
-
| cr-01 | Automated Code Review | AI-powered code analysis, style checks, bug detection |
|
|
26
|
-
| cr-02 | PR Review Workflow | Review templates, checklists, approval workflows |
|
|
27
|
-
| cr-03 | Code Quality Gates | Branch protection, required checks, merge policies |
|
|
28
|
-
| cr-04 | Reviewer Assignment | CODEOWNERS, load balancing, expertise matching |
|
|
29
|
-
| cr-05 | Review Analytics | Cycle time, review load, bottleneck detection |
|
|
30
|
-
|
|
31
|
-
## Enterprise Integration
|
|
32
|
-
|
|
33
|
-
### Mandatory Connections (Enterprise Mode)
|
|
34
|
-
- **Security Architect (sa-05)**: SAST scanning before review
|
|
35
|
-
- **Data Governance (dg-04)**: Access control validation
|
|
36
|
-
- **DevOps (do-09)**: DevSecOps pipeline integration
|
|
37
|
-
|
|
38
|
-
### Recommended Connections
|
|
39
|
-
- **Platform Engineer (pe-05)**: SLO/SLI for review metrics
|
|
40
|
-
- **Process Kanban**: Auto-update board on PR status
|
|
41
|
-
- **FinOps**: Cost of review delays
|
|
42
|
-
|
|
43
|
-
## Quick Start
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
# In Claude Code
|
|
47
|
-
@code-review "Set up automated PR review for our Node.js project"
|
|
48
|
-
@code-review cr-01 "Configure AI code review with security focus"
|
|
49
|
-
@code-review cr-03 "Implement quality gates for production branch"
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Skill Details
|
|
53
|
-
|
|
54
|
-
### cr-01: Automated Code Review
|
|
55
|
-
|
|
56
|
-
**Purpose**: AI-powered automated code analysis
|
|
57
|
-
|
|
58
|
-
**Capabilities**:
|
|
59
|
-
- Static analysis with ESLint, Pylint, RuboCop, etc.
|
|
60
|
-
- AI-powered code suggestions (GitHub Copilot, Amazon CodeWhisperer)
|
|
61
|
-
- Security vulnerability detection (Snyk, SonarQube, Semgrep)
|
|
62
|
-
- Code complexity analysis (cyclomatic, cognitive)
|
|
63
|
-
- Duplicate code detection
|
|
64
|
-
- Dependency vulnerability scanning
|
|
65
|
-
- Type safety checking
|
|
66
|
-
- Performance anti-pattern detection
|
|
67
|
-
|
|
68
|
-
**GitHub Actions Integration**:
|
|
69
|
-
```yaml
|
|
70
|
-
name: Automated Code Review
|
|
71
|
-
on: [pull_request]
|
|
72
|
-
jobs:
|
|
73
|
-
review:
|
|
74
|
-
runs-on: ubuntu-latest
|
|
75
|
-
steps:
|
|
76
|
-
- uses: actions/checkout@v4
|
|
77
|
-
- name: Run ESLint
|
|
78
|
-
run: npx eslint . --format=json > eslint-report.json
|
|
79
|
-
- name: SonarQube Scan
|
|
80
|
-
uses: SonarSource/sonarqube-scan-action@v2
|
|
81
|
-
- name: Semgrep Security Scan
|
|
82
|
-
uses: returntocorp/semgrep-action@v1
|
|
83
|
-
- name: Comment PR with results
|
|
84
|
-
uses: actions/github-script@v7
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
**Azure DevOps Integration**:
|
|
88
|
-
```yaml
|
|
89
|
-
trigger: none
|
|
90
|
-
pr:
|
|
91
|
-
branches:
|
|
92
|
-
include: [main, develop]
|
|
93
|
-
stages:
|
|
94
|
-
- stage: CodeReview
|
|
95
|
-
jobs:
|
|
96
|
-
- job: StaticAnalysis
|
|
97
|
-
steps:
|
|
98
|
-
- task: SonarQubePrepare@5
|
|
99
|
-
- task: SonarQubeAnalyze@5
|
|
100
|
-
- task: SonarQubePublish@5
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
### cr-02: PR Review Workflow
|
|
106
|
-
|
|
107
|
-
**Purpose**: Structured review process with templates and checklists
|
|
108
|
-
|
|
109
|
-
**Capabilities**:
|
|
110
|
-
- PR templates with required sections
|
|
111
|
-
- Review checklists (functionality, security, performance)
|
|
112
|
-
- Multi-stage approval workflows
|
|
113
|
-
- Automated reviewer notifications
|
|
114
|
-
- Review reminders and escalation
|
|
115
|
-
- Stale PR management
|
|
116
|
-
- Draft PR handling
|
|
117
|
-
|
|
118
|
-
**PR Template** (`.github/pull_request_template.md`):
|
|
119
|
-
```markdown
|
|
120
|
-
## Summary
|
|
121
|
-
<!-- Brief description of changes -->
|
|
122
|
-
|
|
123
|
-
## Type of Change
|
|
124
|
-
- [ ] Bug fix
|
|
125
|
-
- [ ] New feature
|
|
126
|
-
- [ ] Breaking change
|
|
127
|
-
- [ ] Documentation
|
|
128
|
-
|
|
129
|
-
## Checklist
|
|
130
|
-
- [ ] Tests added/updated
|
|
131
|
-
- [ ] Documentation updated
|
|
132
|
-
- [ ] No secrets committed
|
|
133
|
-
- [ ] Security review if needed
|
|
134
|
-
- [ ] Breaking changes documented
|
|
135
|
-
|
|
136
|
-
## Security Considerations
|
|
137
|
-
<!-- Any security implications? -->
|
|
138
|
-
|
|
139
|
-
## Testing Done
|
|
140
|
-
<!-- How was this tested? -->
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
**Review Workflow States**:
|
|
144
|
-
```
|
|
145
|
-
Draft → Ready → In Review → Changes Requested → Approved → Merged
|
|
146
|
-
↓
|
|
147
|
-
Needs Security Review → Security Approved
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
### cr-03: Code Quality Gates
|
|
153
|
-
|
|
154
|
-
**Purpose**: Enforce quality standards before merge
|
|
155
|
-
|
|
156
|
-
**Capabilities**:
|
|
157
|
-
- Branch protection rules
|
|
158
|
-
- Required status checks
|
|
159
|
-
- Minimum reviewer count
|
|
160
|
-
- Code coverage thresholds
|
|
161
|
-
- No merge with failing tests
|
|
162
|
-
- Signed commits requirement
|
|
163
|
-
- Linear history enforcement
|
|
164
|
-
- Auto-merge when checks pass
|
|
165
|
-
|
|
166
|
-
**GitHub Branch Protection** (API):
|
|
167
|
-
```bash
|
|
168
|
-
gh api repos/{owner}/{repo}/branches/main/protection -X PUT \
|
|
169
|
-
-F required_status_checks='{"strict":true,"contexts":["build","test","lint","security"]}' \
|
|
170
|
-
-F enforce_admins=true \
|
|
171
|
-
-F required_pull_request_reviews='{"required_approving_review_count":2,"require_code_owner_reviews":true}' \
|
|
172
|
-
-F restrictions=null
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
**Quality Gate Configuration**:
|
|
176
|
-
```yaml
|
|
177
|
-
# .quality-gates.yml
|
|
178
|
-
gates:
|
|
179
|
-
coverage:
|
|
180
|
-
minimum: 80%
|
|
181
|
-
block_merge: true
|
|
182
|
-
complexity:
|
|
183
|
-
max_cyclomatic: 15
|
|
184
|
-
max_cognitive: 20
|
|
185
|
-
security:
|
|
186
|
-
critical: 0
|
|
187
|
-
high: 0
|
|
188
|
-
medium_max: 5
|
|
189
|
-
duplication:
|
|
190
|
-
max_percentage: 5%
|
|
191
|
-
tests:
|
|
192
|
-
required: true
|
|
193
|
-
minimum_pass_rate: 100%
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
### cr-04: Reviewer Assignment
|
|
199
|
-
|
|
200
|
-
**Purpose**: Intelligent reviewer selection and load balancing
|
|
201
|
-
|
|
202
|
-
**Capabilities**:
|
|
203
|
-
- CODEOWNERS file management
|
|
204
|
-
- Expertise-based assignment
|
|
205
|
-
- Round-robin load balancing
|
|
206
|
-
- Availability-aware assignment
|
|
207
|
-
- Team-based review pools
|
|
208
|
-
- Escalation paths
|
|
209
|
-
- Conflict of interest detection
|
|
210
|
-
- Review load monitoring
|
|
211
|
-
|
|
212
|
-
**CODEOWNERS File**:
|
|
213
|
-
```
|
|
214
|
-
# Default reviewers
|
|
215
|
-
* @org/core-team
|
|
216
|
-
|
|
217
|
-
# Frontend
|
|
218
|
-
/src/components/** @org/frontend-team
|
|
219
|
-
*.tsx @org/frontend-team
|
|
220
|
-
|
|
221
|
-
# Backend
|
|
222
|
-
/src/api/** @org/backend-team
|
|
223
|
-
*.py @org/python-team
|
|
224
|
-
|
|
225
|
-
# Security-sensitive files
|
|
226
|
-
**/auth/** @org/security-team
|
|
227
|
-
**/secrets/** @org/security-team
|
|
228
|
-
*.env* @org/security-team
|
|
229
|
-
|
|
230
|
-
# Infrastructure
|
|
231
|
-
/terraform/** @org/platform-team
|
|
232
|
-
/kubernetes/** @org/platform-team
|
|
233
|
-
*.tf @org/platform-team
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
**Auto-Assignment Rules**:
|
|
237
|
-
```yaml
|
|
238
|
-
# .github/auto-assign.yml
|
|
239
|
-
reviewers:
|
|
240
|
-
defaults:
|
|
241
|
-
- team-core
|
|
242
|
-
groups:
|
|
243
|
-
frontend:
|
|
244
|
-
- user1
|
|
245
|
-
- user2
|
|
246
|
-
backend:
|
|
247
|
-
- user3
|
|
248
|
-
- user4
|
|
249
|
-
load_balancing: round-robin
|
|
250
|
-
max_reviews_per_person: 5
|
|
251
|
-
skip_if_author_is_reviewer: true
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
---
|
|
255
|
-
|
|
256
|
-
### cr-05: Review Analytics
|
|
257
|
-
|
|
258
|
-
**Purpose**: Metrics and insights for review process optimization
|
|
259
|
-
|
|
260
|
-
**Capabilities**:
|
|
261
|
-
- Review cycle time tracking
|
|
262
|
-
- Time to first review
|
|
263
|
-
- Time to approval
|
|
264
|
-
- Review load per developer
|
|
265
|
-
- Bottleneck identification
|
|
266
|
-
- Trend analysis
|
|
267
|
-
- SLO tracking for reviews
|
|
268
|
-
- Quality correlation analysis
|
|
269
|
-
|
|
270
|
-
**Key Metrics**:
|
|
271
|
-
```python
|
|
272
|
-
class ReviewMetrics:
|
|
273
|
-
"""Enterprise review metrics tracking."""
|
|
274
|
-
|
|
275
|
-
METRICS = {
|
|
276
|
-
"time_to_first_review": "< 4 hours (SLO)",
|
|
277
|
-
"time_to_approval": "< 24 hours (SLO)",
|
|
278
|
-
"review_iterations": "< 3 rounds average",
|
|
279
|
-
"reviewer_load": "< 5 active reviews per person",
|
|
280
|
-
"stale_prs": "0 PRs > 7 days without activity",
|
|
281
|
-
"merge_time": "< 48 hours from open to merge",
|
|
282
|
-
"defect_escape_rate": "< 1% bugs in reviewed code",
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
def calculate_cycle_time(self, pr_data):
|
|
286
|
-
"""Calculate end-to-end review cycle time."""
|
|
287
|
-
opened = pr_data["created_at"]
|
|
288
|
-
merged = pr_data["merged_at"]
|
|
289
|
-
return (merged - opened).total_seconds() / 3600 # hours
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
**GitHub Analytics Query**:
|
|
293
|
-
```graphql
|
|
294
|
-
query ReviewMetrics($owner: String!, $repo: String!) {
|
|
295
|
-
repository(owner: $owner, name: $repo) {
|
|
296
|
-
pullRequests(last: 100, states: MERGED) {
|
|
297
|
-
nodes {
|
|
298
|
-
createdAt
|
|
299
|
-
mergedAt
|
|
300
|
-
reviews(first: 10) {
|
|
301
|
-
nodes {
|
|
302
|
-
submittedAt
|
|
303
|
-
state
|
|
304
|
-
author { login }
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
timelineItems(first: 50, itemTypes: [REVIEW_REQUESTED_EVENT]) {
|
|
308
|
-
nodes {
|
|
309
|
-
... on ReviewRequestedEvent {
|
|
310
|
-
createdAt
|
|
311
|
-
requestedReviewer { ... on User { login } }
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
---
|
|
322
|
-
|
|
323
|
-
## Enterprise Workflow
|
|
324
|
-
|
|
325
|
-
### Complete PR Pipeline
|
|
326
|
-
```
|
|
327
|
-
1. Developer creates PR
|
|
328
|
-
↓
|
|
329
|
-
2. Auto-assign reviewers (cr-04)
|
|
330
|
-
↓
|
|
331
|
-
3. Automated checks run (cr-01)
|
|
332
|
-
- Linting, tests, security scan
|
|
333
|
-
↓
|
|
334
|
-
4. Quality gates validate (cr-03)
|
|
335
|
-
- Coverage, complexity, security
|
|
336
|
-
↓
|
|
337
|
-
5. Human review with checklist (cr-02)
|
|
338
|
-
↓
|
|
339
|
-
6. Security review if flagged (@security-architect)
|
|
340
|
-
↓
|
|
341
|
-
7. Governance review if data changes (@data-governance)
|
|
342
|
-
↓
|
|
343
|
-
8. Approval and merge
|
|
344
|
-
↓
|
|
345
|
-
9. Analytics captured (cr-05)
|
|
346
|
-
↓
|
|
347
|
-
10. Board updated (@process-kanban)
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
### Enterprise Mode Requirements
|
|
351
|
-
|
|
352
|
-
When `--enterprise` flag is set:
|
|
353
|
-
- **Mandatory**: Security scan must pass (cr-01 + sa-05)
|
|
354
|
-
- **Mandatory**: 2 approvals minimum including CODEOWNER
|
|
355
|
-
- **Mandatory**: All quality gates pass (cr-03)
|
|
356
|
-
- **Mandatory**: No critical/high vulnerabilities
|
|
357
|
-
- **Mandatory**: Signed commits required
|
|
358
|
-
- **Mandatory**: Linear history (no merge commits)
|
|
359
|
-
- **Recommended**: Data governance review for data model changes
|
|
360
|
-
|
|
361
|
-
---
|
|
362
|
-
|
|
363
|
-
## Integration with Other Skills
|
|
364
|
-
|
|
365
|
-
| Skill | Integration |
|
|
366
|
-
|-------|-------------|
|
|
367
|
-
| @security-architect sa-05 | SAST results feed into review |
|
|
368
|
-
| @devops do-09 | DevSecOps pipeline gates |
|
|
369
|
-
| @data-governance dg-04 | Access control for sensitive files |
|
|
370
|
-
| @process-kanban | Auto-update board on PR events |
|
|
371
|
-
| @platform-engineer pe-05 | SLO monitoring for review times |
|
|
372
|
-
|
|
373
|
-
---
|
|
374
|
-
|
|
375
|
-
## Best Practices
|
|
376
|
-
|
|
377
|
-
1. **Keep PRs small**: < 400 lines of changes for effective review
|
|
378
|
-
2. **Automate the boring stuff**: Let tools catch style/lint issues
|
|
379
|
-
3. **Focus human review on**: Logic, architecture, security implications
|
|
380
|
-
4. **Set clear SLOs**: First review < 4 hours, merge < 48 hours
|
|
381
|
-
5. **Balance review load**: No one should have > 5 active reviews
|
|
382
|
-
6. **Escalate stale PRs**: Auto-ping after 24 hours, escalate after 48
|
|
383
|
-
7. **Measure and improve**: Track cycle time, aim for continuous reduction
|
|
384
|
-
|
|
385
|
-
---
|
|
386
|
-
|
|
387
|
-
## Quick Reference
|
|
388
|
-
|
|
389
|
-
```bash
|
|
390
|
-
# Set up complete PR automation
|
|
391
|
-
@code-review "Configure enterprise PR workflow for [project]"
|
|
392
|
-
|
|
393
|
-
# Individual skills
|
|
394
|
-
@code-review cr-01 "Set up automated code analysis"
|
|
395
|
-
@code-review cr-02 "Create PR template and review checklist"
|
|
396
|
-
@code-review cr-03 "Configure branch protection and quality gates"
|
|
397
|
-
@code-review cr-04 "Set up CODEOWNERS and reviewer assignment"
|
|
398
|
-
@code-review cr-05 "Build review analytics dashboard"
|
|
399
|
-
```
|
|
1
|
+
# Code Review & PR Automation
|
|
2
|
+
|
|
3
|
+
Enterprise-grade code review and pull request automation for production-quality software delivery.
|
|
4
|
+
|
|
5
|
+
## Role Overview
|
|
6
|
+
|
|
7
|
+
**Agent**: Code Review Specialist
|
|
8
|
+
**Focus**: Automated code review, PR workflows, quality gates, reviewer assignment, and review analytics
|
|
9
|
+
**Skills**: 5 specialized skills (cr-01 to cr-05)
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
Invoke this role when you need to:
|
|
14
|
+
- Automate code review processes
|
|
15
|
+
- Set up PR review workflows with quality gates
|
|
16
|
+
- Configure reviewer assignment rules
|
|
17
|
+
- Implement code quality enforcement
|
|
18
|
+
- Track review metrics and bottlenecks
|
|
19
|
+
- Ensure compliance before merge
|
|
20
|
+
|
|
21
|
+
## Skills
|
|
22
|
+
|
|
23
|
+
| ID | Skill | Description |
|
|
24
|
+
|----|-------|-------------|
|
|
25
|
+
| cr-01 | Automated Code Review | AI-powered code analysis, style checks, bug detection |
|
|
26
|
+
| cr-02 | PR Review Workflow | Review templates, checklists, approval workflows |
|
|
27
|
+
| cr-03 | Code Quality Gates | Branch protection, required checks, merge policies |
|
|
28
|
+
| cr-04 | Reviewer Assignment | CODEOWNERS, load balancing, expertise matching |
|
|
29
|
+
| cr-05 | Review Analytics | Cycle time, review load, bottleneck detection |
|
|
30
|
+
|
|
31
|
+
## Enterprise Integration
|
|
32
|
+
|
|
33
|
+
### Mandatory Connections (Enterprise Mode)
|
|
34
|
+
- **Security Architect (sa-05)**: SAST scanning before review
|
|
35
|
+
- **Data Governance (dg-04)**: Access control validation
|
|
36
|
+
- **DevOps (do-09)**: DevSecOps pipeline integration
|
|
37
|
+
|
|
38
|
+
### Recommended Connections
|
|
39
|
+
- **Platform Engineer (pe-05)**: SLO/SLI for review metrics
|
|
40
|
+
- **Process Kanban**: Auto-update board on PR status
|
|
41
|
+
- **FinOps**: Cost of review delays
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# In Claude Code
|
|
47
|
+
@code-review "Set up automated PR review for our Node.js project"
|
|
48
|
+
@code-review cr-01 "Configure AI code review with security focus"
|
|
49
|
+
@code-review cr-03 "Implement quality gates for production branch"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Skill Details
|
|
53
|
+
|
|
54
|
+
### cr-01: Automated Code Review
|
|
55
|
+
|
|
56
|
+
**Purpose**: AI-powered automated code analysis
|
|
57
|
+
|
|
58
|
+
**Capabilities**:
|
|
59
|
+
- Static analysis with ESLint, Pylint, RuboCop, etc.
|
|
60
|
+
- AI-powered code suggestions (GitHub Copilot, Amazon CodeWhisperer)
|
|
61
|
+
- Security vulnerability detection (Snyk, SonarQube, Semgrep)
|
|
62
|
+
- Code complexity analysis (cyclomatic, cognitive)
|
|
63
|
+
- Duplicate code detection
|
|
64
|
+
- Dependency vulnerability scanning
|
|
65
|
+
- Type safety checking
|
|
66
|
+
- Performance anti-pattern detection
|
|
67
|
+
|
|
68
|
+
**GitHub Actions Integration**:
|
|
69
|
+
```yaml
|
|
70
|
+
name: Automated Code Review
|
|
71
|
+
on: [pull_request]
|
|
72
|
+
jobs:
|
|
73
|
+
review:
|
|
74
|
+
runs-on: ubuntu-latest
|
|
75
|
+
steps:
|
|
76
|
+
- uses: actions/checkout@v4
|
|
77
|
+
- name: Run ESLint
|
|
78
|
+
run: npx eslint . --format=json > eslint-report.json
|
|
79
|
+
- name: SonarQube Scan
|
|
80
|
+
uses: SonarSource/sonarqube-scan-action@v2
|
|
81
|
+
- name: Semgrep Security Scan
|
|
82
|
+
uses: returntocorp/semgrep-action@v1
|
|
83
|
+
- name: Comment PR with results
|
|
84
|
+
uses: actions/github-script@v7
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Azure DevOps Integration**:
|
|
88
|
+
```yaml
|
|
89
|
+
trigger: none
|
|
90
|
+
pr:
|
|
91
|
+
branches:
|
|
92
|
+
include: [main, develop]
|
|
93
|
+
stages:
|
|
94
|
+
- stage: CodeReview
|
|
95
|
+
jobs:
|
|
96
|
+
- job: StaticAnalysis
|
|
97
|
+
steps:
|
|
98
|
+
- task: SonarQubePrepare@5
|
|
99
|
+
- task: SonarQubeAnalyze@5
|
|
100
|
+
- task: SonarQubePublish@5
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### cr-02: PR Review Workflow
|
|
106
|
+
|
|
107
|
+
**Purpose**: Structured review process with templates and checklists
|
|
108
|
+
|
|
109
|
+
**Capabilities**:
|
|
110
|
+
- PR templates with required sections
|
|
111
|
+
- Review checklists (functionality, security, performance)
|
|
112
|
+
- Multi-stage approval workflows
|
|
113
|
+
- Automated reviewer notifications
|
|
114
|
+
- Review reminders and escalation
|
|
115
|
+
- Stale PR management
|
|
116
|
+
- Draft PR handling
|
|
117
|
+
|
|
118
|
+
**PR Template** (`.github/pull_request_template.md`):
|
|
119
|
+
```markdown
|
|
120
|
+
## Summary
|
|
121
|
+
<!-- Brief description of changes -->
|
|
122
|
+
|
|
123
|
+
## Type of Change
|
|
124
|
+
- [ ] Bug fix
|
|
125
|
+
- [ ] New feature
|
|
126
|
+
- [ ] Breaking change
|
|
127
|
+
- [ ] Documentation
|
|
128
|
+
|
|
129
|
+
## Checklist
|
|
130
|
+
- [ ] Tests added/updated
|
|
131
|
+
- [ ] Documentation updated
|
|
132
|
+
- [ ] No secrets committed
|
|
133
|
+
- [ ] Security review if needed
|
|
134
|
+
- [ ] Breaking changes documented
|
|
135
|
+
|
|
136
|
+
## Security Considerations
|
|
137
|
+
<!-- Any security implications? -->
|
|
138
|
+
|
|
139
|
+
## Testing Done
|
|
140
|
+
<!-- How was this tested? -->
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Review Workflow States**:
|
|
144
|
+
```
|
|
145
|
+
Draft → Ready → In Review → Changes Requested → Approved → Merged
|
|
146
|
+
↓
|
|
147
|
+
Needs Security Review → Security Approved
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
### cr-03: Code Quality Gates
|
|
153
|
+
|
|
154
|
+
**Purpose**: Enforce quality standards before merge
|
|
155
|
+
|
|
156
|
+
**Capabilities**:
|
|
157
|
+
- Branch protection rules
|
|
158
|
+
- Required status checks
|
|
159
|
+
- Minimum reviewer count
|
|
160
|
+
- Code coverage thresholds
|
|
161
|
+
- No merge with failing tests
|
|
162
|
+
- Signed commits requirement
|
|
163
|
+
- Linear history enforcement
|
|
164
|
+
- Auto-merge when checks pass
|
|
165
|
+
|
|
166
|
+
**GitHub Branch Protection** (API):
|
|
167
|
+
```bash
|
|
168
|
+
gh api repos/{owner}/{repo}/branches/main/protection -X PUT \
|
|
169
|
+
-F required_status_checks='{"strict":true,"contexts":["build","test","lint","security"]}' \
|
|
170
|
+
-F enforce_admins=true \
|
|
171
|
+
-F required_pull_request_reviews='{"required_approving_review_count":2,"require_code_owner_reviews":true}' \
|
|
172
|
+
-F restrictions=null
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Quality Gate Configuration**:
|
|
176
|
+
```yaml
|
|
177
|
+
# .quality-gates.yml
|
|
178
|
+
gates:
|
|
179
|
+
coverage:
|
|
180
|
+
minimum: 80%
|
|
181
|
+
block_merge: true
|
|
182
|
+
complexity:
|
|
183
|
+
max_cyclomatic: 15
|
|
184
|
+
max_cognitive: 20
|
|
185
|
+
security:
|
|
186
|
+
critical: 0
|
|
187
|
+
high: 0
|
|
188
|
+
medium_max: 5
|
|
189
|
+
duplication:
|
|
190
|
+
max_percentage: 5%
|
|
191
|
+
tests:
|
|
192
|
+
required: true
|
|
193
|
+
minimum_pass_rate: 100%
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### cr-04: Reviewer Assignment
|
|
199
|
+
|
|
200
|
+
**Purpose**: Intelligent reviewer selection and load balancing
|
|
201
|
+
|
|
202
|
+
**Capabilities**:
|
|
203
|
+
- CODEOWNERS file management
|
|
204
|
+
- Expertise-based assignment
|
|
205
|
+
- Round-robin load balancing
|
|
206
|
+
- Availability-aware assignment
|
|
207
|
+
- Team-based review pools
|
|
208
|
+
- Escalation paths
|
|
209
|
+
- Conflict of interest detection
|
|
210
|
+
- Review load monitoring
|
|
211
|
+
|
|
212
|
+
**CODEOWNERS File**:
|
|
213
|
+
```
|
|
214
|
+
# Default reviewers
|
|
215
|
+
* @org/core-team
|
|
216
|
+
|
|
217
|
+
# Frontend
|
|
218
|
+
/src/components/** @org/frontend-team
|
|
219
|
+
*.tsx @org/frontend-team
|
|
220
|
+
|
|
221
|
+
# Backend
|
|
222
|
+
/src/api/** @org/backend-team
|
|
223
|
+
*.py @org/python-team
|
|
224
|
+
|
|
225
|
+
# Security-sensitive files
|
|
226
|
+
**/auth/** @org/security-team
|
|
227
|
+
**/secrets/** @org/security-team
|
|
228
|
+
*.env* @org/security-team
|
|
229
|
+
|
|
230
|
+
# Infrastructure
|
|
231
|
+
/terraform/** @org/platform-team
|
|
232
|
+
/kubernetes/** @org/platform-team
|
|
233
|
+
*.tf @org/platform-team
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Auto-Assignment Rules**:
|
|
237
|
+
```yaml
|
|
238
|
+
# .github/auto-assign.yml
|
|
239
|
+
reviewers:
|
|
240
|
+
defaults:
|
|
241
|
+
- team-core
|
|
242
|
+
groups:
|
|
243
|
+
frontend:
|
|
244
|
+
- user1
|
|
245
|
+
- user2
|
|
246
|
+
backend:
|
|
247
|
+
- user3
|
|
248
|
+
- user4
|
|
249
|
+
load_balancing: round-robin
|
|
250
|
+
max_reviews_per_person: 5
|
|
251
|
+
skip_if_author_is_reviewer: true
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
### cr-05: Review Analytics
|
|
257
|
+
|
|
258
|
+
**Purpose**: Metrics and insights for review process optimization
|
|
259
|
+
|
|
260
|
+
**Capabilities**:
|
|
261
|
+
- Review cycle time tracking
|
|
262
|
+
- Time to first review
|
|
263
|
+
- Time to approval
|
|
264
|
+
- Review load per developer
|
|
265
|
+
- Bottleneck identification
|
|
266
|
+
- Trend analysis
|
|
267
|
+
- SLO tracking for reviews
|
|
268
|
+
- Quality correlation analysis
|
|
269
|
+
|
|
270
|
+
**Key Metrics**:
|
|
271
|
+
```python
|
|
272
|
+
class ReviewMetrics:
|
|
273
|
+
"""Enterprise review metrics tracking."""
|
|
274
|
+
|
|
275
|
+
METRICS = {
|
|
276
|
+
"time_to_first_review": "< 4 hours (SLO)",
|
|
277
|
+
"time_to_approval": "< 24 hours (SLO)",
|
|
278
|
+
"review_iterations": "< 3 rounds average",
|
|
279
|
+
"reviewer_load": "< 5 active reviews per person",
|
|
280
|
+
"stale_prs": "0 PRs > 7 days without activity",
|
|
281
|
+
"merge_time": "< 48 hours from open to merge",
|
|
282
|
+
"defect_escape_rate": "< 1% bugs in reviewed code",
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
def calculate_cycle_time(self, pr_data):
|
|
286
|
+
"""Calculate end-to-end review cycle time."""
|
|
287
|
+
opened = pr_data["created_at"]
|
|
288
|
+
merged = pr_data["merged_at"]
|
|
289
|
+
return (merged - opened).total_seconds() / 3600 # hours
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**GitHub Analytics Query**:
|
|
293
|
+
```graphql
|
|
294
|
+
query ReviewMetrics($owner: String!, $repo: String!) {
|
|
295
|
+
repository(owner: $owner, name: $repo) {
|
|
296
|
+
pullRequests(last: 100, states: MERGED) {
|
|
297
|
+
nodes {
|
|
298
|
+
createdAt
|
|
299
|
+
mergedAt
|
|
300
|
+
reviews(first: 10) {
|
|
301
|
+
nodes {
|
|
302
|
+
submittedAt
|
|
303
|
+
state
|
|
304
|
+
author { login }
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
timelineItems(first: 50, itemTypes: [REVIEW_REQUESTED_EVENT]) {
|
|
308
|
+
nodes {
|
|
309
|
+
... on ReviewRequestedEvent {
|
|
310
|
+
createdAt
|
|
311
|
+
requestedReviewer { ... on User { login } }
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Enterprise Workflow
|
|
324
|
+
|
|
325
|
+
### Complete PR Pipeline
|
|
326
|
+
```
|
|
327
|
+
1. Developer creates PR
|
|
328
|
+
↓
|
|
329
|
+
2. Auto-assign reviewers (cr-04)
|
|
330
|
+
↓
|
|
331
|
+
3. Automated checks run (cr-01)
|
|
332
|
+
- Linting, tests, security scan
|
|
333
|
+
↓
|
|
334
|
+
4. Quality gates validate (cr-03)
|
|
335
|
+
- Coverage, complexity, security
|
|
336
|
+
↓
|
|
337
|
+
5. Human review with checklist (cr-02)
|
|
338
|
+
↓
|
|
339
|
+
6. Security review if flagged (@security-architect)
|
|
340
|
+
↓
|
|
341
|
+
7. Governance review if data changes (@data-governance)
|
|
342
|
+
↓
|
|
343
|
+
8. Approval and merge
|
|
344
|
+
↓
|
|
345
|
+
9. Analytics captured (cr-05)
|
|
346
|
+
↓
|
|
347
|
+
10. Board updated (@process-kanban)
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Enterprise Mode Requirements
|
|
351
|
+
|
|
352
|
+
When `--enterprise` flag is set:
|
|
353
|
+
- **Mandatory**: Security scan must pass (cr-01 + sa-05)
|
|
354
|
+
- **Mandatory**: 2 approvals minimum including CODEOWNER
|
|
355
|
+
- **Mandatory**: All quality gates pass (cr-03)
|
|
356
|
+
- **Mandatory**: No critical/high vulnerabilities
|
|
357
|
+
- **Mandatory**: Signed commits required
|
|
358
|
+
- **Mandatory**: Linear history (no merge commits)
|
|
359
|
+
- **Recommended**: Data governance review for data model changes
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## Integration with Other Skills
|
|
364
|
+
|
|
365
|
+
| Skill | Integration |
|
|
366
|
+
|-------|-------------|
|
|
367
|
+
| @security-architect sa-05 | SAST results feed into review |
|
|
368
|
+
| @devops do-09 | DevSecOps pipeline gates |
|
|
369
|
+
| @data-governance dg-04 | Access control for sensitive files |
|
|
370
|
+
| @process-kanban | Auto-update board on PR events |
|
|
371
|
+
| @platform-engineer pe-05 | SLO monitoring for review times |
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## Best Practices
|
|
376
|
+
|
|
377
|
+
1. **Keep PRs small**: < 400 lines of changes for effective review
|
|
378
|
+
2. **Automate the boring stuff**: Let tools catch style/lint issues
|
|
379
|
+
3. **Focus human review on**: Logic, architecture, security implications
|
|
380
|
+
4. **Set clear SLOs**: First review < 4 hours, merge < 48 hours
|
|
381
|
+
5. **Balance review load**: No one should have > 5 active reviews
|
|
382
|
+
6. **Escalate stale PRs**: Auto-ping after 24 hours, escalate after 48
|
|
383
|
+
7. **Measure and improve**: Track cycle time, aim for continuous reduction
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## Quick Reference
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
# Set up complete PR automation
|
|
391
|
+
@code-review "Configure enterprise PR workflow for [project]"
|
|
392
|
+
|
|
393
|
+
# Individual skills
|
|
394
|
+
@code-review cr-01 "Set up automated code analysis"
|
|
395
|
+
@code-review cr-02 "Create PR template and review checklist"
|
|
396
|
+
@code-review cr-03 "Configure branch protection and quality gates"
|
|
397
|
+
@code-review cr-04 "Set up CODEOWNERS and reviewer assignment"
|
|
398
|
+
@code-review cr-05 "Build review analytics dashboard"
|
|
399
|
+
```
|