microsoft/pr-finalize
Finalizes any PR for merge by verifying title/description match implementation AND performing code review for best practices. Use when asked to "finalize PR", "check PR description", "review commit message", before merging any PR, or when PR implementation changed during review. Do NOT use for extracting lessons or investigating build failures.
npx skills add https://github.com/microsoft/garnet --skill pr-finalize
Ensures PR title and description accurately reflect the implementation, and performs a code review for Garnet best practices before merge.
Standalone skill — Can be used on any PR.
AI agents must NEVER use --approve or --request-changes flags.
| Action | Allowed? | Why |
|--------|----------|-----|
| gh pr review --approve | ❌ NEVER | Approval is a human decision |
| gh pr review --request-changes | ❌ NEVER | Blocking PRs is a human decision |
This skill is ANALYSIS ONLY. Never post comments using gh commands.
| Action | Allowed? | Why |
|--------|----------|-----|
| gh pr review --comment | ❌ NEVER | Present findings to the user instead |
| gh pr comment | ❌ NEVER | Present findings to the user instead |
| Analyze and report findings | ✅ YES | This is the skill's purpose |
Only humans control when comments are posted. Your job is to analyze and present findings.
Review existing description BEFORE suggesting changes. Many PR authors write excellent, detailed descriptions. Your job is to:
# Get current state (no local checkout required)
gh pr view XXXXX --json title,body
gh pr view XXXXX --json files --jq '.files[].path'
# Review commit messages (helpful for squash/merge commit quality)
gh pr view XXXXX --json commits --jq '.commits[].messageHeadline'
# Review actual code changes
gh pr diff XXXXX
# Optional: if the PR branch is checked out locally
git diff origin/main...HEAD
Before suggesting changes, evaluate the current description:
| Quality Indicator | Look For |
|-------------------|----------|
| Structure | Clear sections, headers, organized flow |
| Technical depth | File-by-file changes, specific code references |
| Scannability | Easy to find what changed and where |
| Accuracy | Matches actual diff — not stale or incorrect |
| Completeness | Breaking changes, performance impact, testing info |
Ask: "Is the existing description better than what my template would produce?"
The title becomes the commit message headline. Make it searchable and informative.
| Requirement | Good | Bad |
|-------------|------|-----|
| Component prefix (if specific) | [Cluster] Fix gossip protocol timeout | Fix timeout |
| Describes behavior, not issue | [RESP] ZADD: Support GT/LT flags | Fix #123 |
| Captures the "what" | [Tsavorite] Reduce lock contention in RMW | Fix perf bug |
| Notes breaking change if applicable | (breaking) | (omitted) |
| No noise prefixes | [Storage] Fix... | [PR agent] Fix... |
[Component] What changed (breaking if applicable)
Component prefixes (use when change is scoped):
[RESP] — RESP command parsing/dispatch (libs/server/Resp/)[Storage] — Storage session/functions (libs/server/Storage/)[Tsavorite] — Tsavorite engine (libs/storage/Tsavorite/)[Cluster] — Cluster/replication/sharding (libs/cluster/)[Objects] — Object types: Hash, List, Set, SortedSet (libs/server/Objects/)[API] — Garnet API surface (libs/server/API/)[Network] — Networking/TLS (libs/common/Networking/)[Config] — Configuration/options (libs/host/Configuration/)[Tests] — Test-only changes[Docs] — Documentation-only changesExamples:
[RESP] ZADD: Support GT/LT flags for conditional updates[Tsavorite] Reduce epoch protection overhead in hot-path RMW[Cluster] Fix replication lag during key migrationAdd multi-database support for standalone modePR description should:
### Description of Change
[Must match actual implementation]
### Issues Fixed
Fixes #XXXXX
The title and description become the commit message. Future agents searching git history will use this to understand:
| Element | Purpose | Example |
|---------|---------|---------|
| Component in title | Scoped search | [Tsavorite] ... |
| Root cause (bug fixes) | Understand failure mode | "Epoch was not released on error path" |
| Description of change | What code does now | "Added GT/LT flag parsing in ZADD handler" |
| Key types/interfaces | API surface awareness | IGarnetApi, StorageSession, CustomRawStringFunctions |
| What NOT to do | Prevent repeat mistakes | "Don't allocate on RMW hot path" |
| Element | When to Include |
|---------|----------------|
| Root cause | Bug fixes — explain why the bug occurred |
| Key technical details | Complex changes — list affected types and interfaces |
| What NOT to do | When failed approaches were attempted |
| Edge cases | When behavior differs across scenarios |
| Performance impact | When change affects hot paths or memory allocation |
| Breaking changes | When API or behavior changes affect consumers |
| Migration guide | When users/extensions need to update |
Use this only when the existing description is stale, inaccurate, or missing key information:
### Root Cause
[Why the bug occurred — be specific about the code path]
### Description of Change
[What the code now does]
**Key changes:**
- [Change 1]
- [Change 2]
### Key Technical Details
**Affected types/interfaces:**
- `TypeA` — [What it does]
- `TypeB` — [What it does]
### What NOT to Do (for future agents)
- ❌ **Don't [approach 1]** — [Why it fails]
- ❌ **Don't [approach 2]** — [Why it's wrong]
### Edge Cases
| Scenario | Risk | Mitigation |
|----------|------|------------|
| [Case 1] | Low/Medium/High | [How to handle] |
### Issues Fixed
Fixes #XXXXX
## Changes
### `libs/server/Resp/Objects/SortedSetCommands.cs`
- Added GT/LT flag parsing in ZADD command handler
- Flag validation against NX (mutually exclusive)
### `libs/server/Objects/SortedSet/SortedSetObjectImpl.cs`
- Implemented conditional update logic in SortedSetAdd
- GT: only update if new score > current; LT: only if new score < current
### `libs/server/Storage/Session/ObjectStore/SortedSetOps.cs`
- Passed flags through ObjectInput to the object implementation
## Tests Added
- `RespSortedSetTests.ZAddWithGTFlag` — verifies GT-only updates
- `RespSortedSetTests.ZAddWithLTFlag` — verifies LT-only updates
- `RespSortedSetTests.ZAddGTNXMutuallyExclusive` — verifies error on GT+NX
Verdict: Excellent — file-by-file breakdown, specific changes, tests listed. Keep it.
Fixed the issue mentioned in #456
Verdict: Inadequate — no detail on what changed. Use template.
After verifying title/description, perform a code review to catch Garnet-specific issues and general best practice violations before merge.
When reviewing code changes in Garnet, focus on:
Span<T>, SpanByte, stack allocation)[MethodImpl(MethodImplOptions.AggressiveInlining)] on hot-path methods[MethodImpl(MethodImplOptions.NoInlining)] on cold/exception-throwing methodsLightEpoch acquired but not released on error pathsparseState.GetArgSliceByRef(i) returning ref PinnedSpanByteRespWriteUtils helpers)SendAndReset() calls to flush response bufferProcessBasicCommands/ProcessArrayCommandsTryWriteLock() in spin loops, not CloseLock())TestBase inheritance on test fixturesTestUtils.OnTearDown() called in [TearDown] (checks for leaked epochs)TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true) in [SetUp]StackExchange.Redis and LightClient coverage where applicable// Copyright (c) Microsoft Corporation. / // Licensed under the MIT license.TreatWarningsAsErrors — no new warnings introducedIGarnetApi / IGarnetReadApi / IGarnetAdvancedApiCustomRawStringFunctions, CustomObjectBase, etc.)GarnetServerOptions# Get the PR diff
gh pr diff XXXXX
# Review specific files
gh pr diff XXXXX -- path/to/file.cs
# Check CI status
gh pr view XXXXX --json statusCheckRollup
## Code Review Findings
### 🔴 Critical Issues
**[Issue Title]**
- **File:** [path/to/file.cs]
- **Problem:** [Description]
- **Recommendation:** [Code fix or approach]
### 🟡 Suggestions
- [Suggestion 1]
- [Suggestion 2]
### ✅ Looks Good
- [Positive observation 1]
- [Positive observation 2]
The pr-finalize skill is ANALYSIS ONLY. Never post comments using gh pr review or gh pr comment.
| Action | Allowed? | Why |
|--------|----------|-----|
| gh pr review --comment | ❌ NEVER | Present findings to the user instead |
| gh pr comment | ❌ NEVER | Present findings to the user instead |
| Analyze and report findings | ✅ YES | This is the skill's purpose |
Workflow:
The user controls when comments are posted. Your job is to analyze and present findings.
See references/complete-example.md for a full agent-optimized PR description showing all elements above applied to a real Garnet change.
Take microsoft/pr-finalize from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.