| name | pr-analyzer |
| description | Analyze GitHub PR diffs and extract meaningful changes for STP generation |
| model | claude-opus-4-6 |
PR Analyzer Skill
Phase: Pre-Processing
User-Invocable: false
Purpose
Analyze GitHub PR diffs and extract meaningful changes for STP generation.
When to Use
Invoked by the github-pr-fetcher subagent after fetching PR details, diffs, and review comments.
Input
pr_data:
url: https://github.com/example-org/example-repo/pull/1234
owner: example-org
repo: example-repo
pull_number: 1234
title: Add CPU hot-plug support
description: |
This PR implements CPU hot-plug functionality...
state: merged
author: developer
base_branch: main
head_branch: feature/cpu-hotplug
diff: |
diff --git a/pkg/controllers/vm/vm.go b/pkg/controllers/vm/vm.go
index abc123..def456 100644
--- a/pkg/controllers/vm/vm.go
+++ b/pkg/controllers/vm/vm.go
@@ -100,6 +100,20 @@ func (c *ResourceController) Reconcile() {
+func (c *ResourceController) HandleCPUHotplug(res *v1.Resource) error {
...
files:
- filename: pkg/controllers/vm/vm.go
status: modified
additions: 50
deletions: 10
- filename: pkg/controllers/vm/hotplug.go
status: added
additions: 200
deletions: 0
- ...
review_comments:
- user: reviewer1
body: "Consider edge case when VM is migrating"
path: pkg/controllers/vm/hotplug.go
line: 45
- ...
Output Format
analysis:
pr_url: https://github.com/example-org/example-repo/pull/1234
summary: Implements CPU hot-plug functionality for running VMs
key_changes:
functions:
- name: HandleCPUHotplug
file: pkg/controllers/vm/vm.go
action: added
purpose: Main entry point for CPU hot-plug operations
- name: ValidateCPUChange
file: pkg/controllers/vm/hotplug.go
action: added
purpose: Validates CPU changes before applying
- ...
types:
- name: CPUHotplugSpec
file: api/v1/types.go
action: added
fields_changed:
- MaxSockets
- CurrentSockets
- ...
apis:
- endpoint: /resources/{name}/cpu
method: PATCH
action: added
purpose: Hot-plug CPU to running VM
- ...
configurations:
- name: EnableCPUHotplug
type: feature_gate
location: Platform CR
default: false
- ...
files_by_category:
controllers:
- pkg/controllers/vm/vm.go
- pkg/controllers/vm/hotplug.go
handlers:
- pkg/handlers/hotplug/cpu.go
api:
- api/v1/types.go
- api/v1/types_swagger_generated.go
tests:
- tests/hotplug_test.go
other:
- ...
review_insights:
edge_cases:
- "VM migration during hot-plug needs handling"
- "Consider maximum CPU limit validation"
concerns:
- "Performance impact of frequent hot-plug operations"
suggestions:
- "Add metrics for hot-plug success/failure rate"
impact_assessment:
components_affected:
- app-controller
- app-handler
- app-api
features_potentially_impacted:
- VM lifecycle
- Live migration
- Resource quotas
breaking_changes: false
api_changes: true
config_changes: true
Analysis Rules
Function Detection
Parse diff for:
func (receiver) FunctionName( - Go methods
func FunctionName( - Go functions
- Added/Modified/Deleted based on diff markers (+/-)
Type Detection
Parse diff for:
type TypeName struct {
type TypeName interface {
- Field additions/removals within structs
API Detection
Look for:
- Route registrations (e.g.,
router.Handle, http.HandleFunc)
- OpenAPI/Swagger annotations
- CRD changes (in
api/ or config/ directories)
Configuration Detection
Look for:
- Feature gates
- Environment variables
- ConfigMap references
- Platform CR fields
Review Insight Extraction
From review comments, extract:
- Edge cases: Comments mentioning "edge case", "corner case", "what if"
- Concerns: Comments with "concern", "worry", "problem", "issue"
- Suggestions: Comments with "suggest", "should", "consider", "might want"
File Categorization
Read {project_context.config_dir}/components.yaml for project-specific file categorization rules.
The following is an example of directory-to-category mapping (actual mappings come from components.yaml):
| Directory Pattern | Category |
|---|
pkg/controllers/ | controllers |
pkg/handlers/ | handlers |
pkg/api/ | api |
api/, staging/ | api |
tests/, *_test.go | tests |
config/, deploy/ | config |
cmd/ | cmd |
pkg/util/, pkg/util*/ | util |
Usage Notes
- Focus on Behavioral Changes: Identify what the PR changes functionally
- Ignore Noise: Skip formatting-only changes, comment updates
- Highlight Test Implications: Note what new tests should cover
- Extract Edge Cases: Review comments often reveal test scenarios