OpenStack Gerrit Patch Review
This skill helps review OpenStack patches from Gerrit with comprehensive analysis and properly formatted output for posting comments back to Gerrit.
When to use this skill
Trigger when the user:
- Mentions a Gerrit change ID (e.g., "review 981750")
- Asks to review a patch, change, or Gerrit review
- Wants to analyze an OpenStack code change
Workflow
1. Extract the change ID
Parse the user's message to find the Gerrit change ID. It's typically a number (e.g., 981750).
2. Detect the OpenStack project
Determine which OpenStack project you're working with by checking:
- The current directory name
- Git remote URL
- Project configuration files (setup.cfg, .gitreview, etc.)
This context helps tailor the review to project-specific conventions.
3. Fetch the patch
Use git review to download the patch:
git review -d <change-id>
This will check out the patch as a local branch.
4. Analyze the changes
Perform a comprehensive review across multiple dimensions:
Code Quality
- Logic errors and potential bugs
- Edge cases not handled
- Error handling gaps
- Security vulnerabilities (SQL injection, XSS, command injection, etc.)
- Race conditions or concurrency issues
- Resource leaks (files, connections, memory)
- Code clarity and maintainability
OpenStack Conventions
- Adherence to OpenStack hacking rules
- Proper use of Oslo libraries and patterns
- API compatibility and versioning
- Configuration option handling
- Logging best practices (use of LOG, appropriate levels)
- Exception handling patterns
Tests
- Are there tests for the changes?
- Do tests cover edge cases?
- Are tests meaningful (not just for coverage)?
- Mock usage appropriateness
- Test naming and organization
Documentation
- Docstrings for new/modified functions
- Release notes (if needed)
- Inline comments for complex logic
- API documentation updates
Commit Message
- Proper format (summary line, blank line, detailed description)
- Clear explanation of the problem and solution
- References to bugs or blueprints
- Change-Id present
5. Generate the review report
Create a plain text report with this structure:
## Review Summary
[Brief overview of the patch - what it does, overall assessment]
### Statistics
- Files changed: X
- Lines added: Y
- Lines removed: Z
### Overall Assessment
[High-level feedback - is this ready to merge, needs work, etc.]
---
## Issues by Severity
### BLOCKING
[Critical issues that must be fixed before merge]
### SUGGESTIONS
[Improvements that should be considered]
### NITS
[Minor style/formatting issues]
---
## Detailed Inline Comments
<filename>:<line-number>: [SEVERITY] <issue description>
Example:
oslo_utils/timeutils.py:42: [BLOCKING] This function doesn't handle timezone-naive datetimes, which could cause a TypeError when calling .astimezone()
oslo_utils/tests/test_timeutils.py:15: [SUGGESTION] Consider adding a test case for negative time deltas
setup.cfg:8: [NIT] Alphabetize dependencies for consistency
Important formatting rules:
- Use plain text only (no markdown formatting)
- One issue per line in the inline comments section
- Use the format:
<filename>:<line>: [SEVERITY] <description>
- Severity levels: BLOCKING, SUGGESTION, NIT
- Group issues by severity in the categorized section
- Keep inline comments concise and actionable
- The report should be ready to copy-paste into Gerrit
6. Provide context for the user
After generating the report:
- Explain how to post the review to Gerrit (e.g., using
git review or the web UI)
- Mention any commands needed to return to the previous branch
- Offer to refine the review if needed
Tips for effective reviews
- Read the commit message first to understand the intent
- Look at the diff holistically before diving into details
- Consider the context of the broader codebase
- Be constructive - suggest improvements, not just problems
- Distinguish between "must fix" and "nice to have"
- If you're unsure about a pattern, acknowledge that in your comment
- Check that the solution actually solves the stated problem
Handling edge cases
- If
git review -d fails, check if git-review is installed and the repository is configured
- If the change ID doesn't exist, provide a helpful error message
- If you're not in an OpenStack repository, warn the user
- If the patch is too large to review in one pass, break it down by file or concern area
1---2name: openstack-review3description: Review OpenStack patches from Gerrit with standardized analysis and inline comments. Use this skill whenever the user mentions OpenStack-specific review requests like "review this openstack ticket <number>", "review openstack patch <number>", "check openstack change <number>", or working with OpenStack projects (oslo.*, nova, neutron, etc.) and Gerrit. Also trigger for phrases like "review this gerrit change", "analyze this openstack patch", "check change <number> on gerrit", or any OpenStack code review workflow. Make sure to use this skill for OpenStack Gerrit reviews, not generic GitHub pull requests.4---56# OpenStack Gerrit Patch Review78This skill helps review OpenStack patches from Gerrit with comprehensive analysis and properly formatted output for posting comments back to Gerrit.910## When to use this skill1112Trigger when the user:13- Mentions a Gerrit change ID (e.g., "review 981750")14- Asks to review a patch, change, or Gerrit review15- Wants to analyze an OpenStack code change1617## Workflow1819### 1. Extract the change ID2021Parse the user's message to find the Gerrit change ID. It's typically a number (e.g., 981750).2223### 2. Detect the OpenStack project2425Determine which OpenStack project you're working with by checking:26- The current directory name27- Git remote URL28- Project configuration files (setup.cfg, .gitreview, etc.)2930This context helps tailor the review to project-specific conventions.3132### 3. Fetch the patch3334Use git review to download the patch:3536```bash37git review -d <change-id>38```3940This will check out the patch as a local branch.4142### 4. Analyze the changes4344Perform a comprehensive review across multiple dimensions:4546#### Code Quality47- Logic errors and potential bugs48- Edge cases not handled49- Error handling gaps50- Security vulnerabilities (SQL injection, XSS, command injection, etc.)51- Race conditions or concurrency issues52- Resource leaks (files, connections, memory)53- Code clarity and maintainability5455#### OpenStack Conventions56- Adherence to OpenStack hacking rules57- Proper use of Oslo libraries and patterns58- API compatibility and versioning59- Configuration option handling60- Logging best practices (use of LOG, appropriate levels)61- Exception handling patterns6263#### Tests64- Are there tests for the changes?65- Do tests cover edge cases?66- Are tests meaningful (not just for coverage)?67- Mock usage appropriateness68- Test naming and organization6970#### Documentation71- Docstrings for new/modified functions72- Release notes (if needed)73- Inline comments for complex logic74- API documentation updates7576#### Commit Message77- Proper format (summary line, blank line, detailed description)78- Clear explanation of the problem and solution79- References to bugs or blueprints80- Change-Id present8182### 5. Generate the review report8384Create a plain text report with this structure:8586```87## Review Summary8889[Brief overview of the patch - what it does, overall assessment]9091### Statistics92- Files changed: X93- Lines added: Y94- Lines removed: Z9596### Overall Assessment97[High-level feedback - is this ready to merge, needs work, etc.]9899---100101## Issues by Severity102103### BLOCKING104[Critical issues that must be fixed before merge]105106### SUGGESTIONS107[Improvements that should be considered]108109### NITS110[Minor style/formatting issues]111112---113114## Detailed Inline Comments115116<filename>:<line-number>: [SEVERITY] <issue description>117118Example:119oslo_utils/timeutils.py:42: [BLOCKING] This function doesn't handle timezone-naive datetimes, which could cause a TypeError when calling .astimezone()120121oslo_utils/tests/test_timeutils.py:15: [SUGGESTION] Consider adding a test case for negative time deltas122123setup.cfg:8: [NIT] Alphabetize dependencies for consistency124```125126**Important formatting rules:**127- Use plain text only (no markdown formatting)128- One issue per line in the inline comments section129- Use the format: `<filename>:<line>: [SEVERITY] <description>`130- Severity levels: BLOCKING, SUGGESTION, NIT131- Group issues by severity in the categorized section132- Keep inline comments concise and actionable133- The report should be ready to copy-paste into Gerrit134135### 6. Provide context for the user136137After generating the report:138- Explain how to post the review to Gerrit (e.g., using `git review` or the web UI)139- Mention any commands needed to return to the previous branch140- Offer to refine the review if needed141142## Tips for effective reviews143144- Read the commit message first to understand the intent145- Look at the diff holistically before diving into details146- Consider the context of the broader codebase147- Be constructive - suggest improvements, not just problems148- Distinguish between "must fix" and "nice to have"149- If you're unsure about a pattern, acknowledge that in your comment150- Check that the solution actually solves the stated problem151152## Handling edge cases153154- If `git review -d` fails, check if git-review is installed and the repository is configured155- If the change ID doesn't exist, provide a helpful error message156- If you're not in an OpenStack repository, warn the user157- If the patch is too large to review in one pass, break it down by file or concern area