Skip to content

Commit 9ad1678

Browse files
GiggleLiuclaude
andcommitted
Add issue compliance checking to review-implementation skill
When review-implementation is called from the issue-to-pr flow, the reviewers now fetch the linked issue from the PR and verify the implementation matches the original requirements (problem definition, reduction algorithm, overhead expressions, etc.). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3e7d07c commit 9ad1678

3 files changed

Lines changed: 72 additions & 1 deletion

File tree

.claude/skills/review-implementation/SKILL.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,27 @@ git diff --stat $BASE_SHA..$HEAD_SHA
5252
git diff --name-only $BASE_SHA..$HEAD_SHA
5353
```
5454

55+
### Detect Linked Issue
56+
57+
Check if the current branch has a PR linked to an issue:
58+
59+
```bash
60+
# Get PR number for current branch
61+
PR_NUM=$(gh pr view --json number -q .number 2>/dev/null)
62+
63+
# If PR exists, extract the linked issue number from the body
64+
if [ -n "$PR_NUM" ]; then
65+
ISSUE_NUM=$(gh pr view $PR_NUM --json body -q .body | grep -oE '#[0-9]+' | head -1 | tr -d '#')
66+
fi
67+
68+
# Fetch the issue body if found
69+
if [ -n "$ISSUE_NUM" ]; then
70+
ISSUE_BODY=$(gh issue view $ISSUE_NUM --json title,body -q '"# " + .title + "\n\n" + .body')
71+
fi
72+
```
73+
74+
If an issue is found, pass it as `{ISSUE_CONTEXT}` to both subagents. If not, set `{ISSUE_CONTEXT}` to "No linked issue found."
75+
5576
## Step 3: Dispatch Subagents in Parallel
5677

5778
### Structural Reviewer (if new model/rule detected)
@@ -64,6 +85,7 @@ Dispatch using `Task` tool with `subagent_type="superpowers:code-reviewer"`:
6485
- `{REVIEW_PARAMS}` -> summary of what's being reviewed
6586
- `{PROBLEM_NAME}`, `{CATEGORY}`, `{FILE_STEM}` -> for model reviews
6687
- `{SOURCE}`, `{TARGET}`, `{RULE_STEM}`, `{EXAMPLE_STEM}` -> for rule reviews
88+
- `{ISSUE_CONTEXT}` -> full issue title + body (or "No linked issue found.")
6789
- Prompt = filled template
6890

6991
### Quality Reviewer (always)
@@ -76,6 +98,7 @@ Dispatch using `Task` tool with `subagent_type="superpowers:code-reviewer"`:
7698
- `{CHANGED_FILES}` -> list of changed files
7799
- `{PLAN_STEP}` -> description of what was implemented (or "standalone review")
78100
- `{BASE_SHA}`, `{HEAD_SHA}` -> git range
101+
- `{ISSUE_CONTEXT}` -> full issue title + body (or "No linked issue found.")
79102
- Prompt = filled template
80103

81104
**Both subagents must be dispatched in parallel** (single message, two Task tool calls).
@@ -108,6 +131,9 @@ Merge both subagent outputs into a single report:
108131
### Semantic Review (from structural reviewer)
109132
...
110133
134+
### Issue Compliance (from structural reviewer, if linked issue found)
135+
...
136+
111137
### Code Quality (from quality reviewer)
112138
- DRY: OK / ...
113139
- KISS: OK / ...

.claude/skills/review-implementation/quality-reviewer-prompt.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ You are reviewing code changes for quality in the `problemreductions` Rust codeb
1414

1515
{PLAN_STEP}
1616

17+
## Linked Issue
18+
19+
{ISSUE_CONTEXT}
20+
1721
## Git Range
1822

1923
**Base:** {BASE_SHA}

.claude/skills/review-implementation/structural-reviewer-prompt.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ You are reviewing a new model or rule implementation for structural completeness
66

77
{REVIEW_PARAMS}
88

9+
## Linked Issue
10+
11+
{ISSUE_CONTEXT}
12+
913
## Instructions
1014

1115
1. Run the structural checklist below using Grep and Glob tools
1216
2. Run `make test clippy` to verify build
1317
3. Read the implementation files and perform semantic review
14-
4. Output results in the structured format at the end
18+
4. If a linked issue is provided, perform issue compliance review
19+
5. Output results in the structured format at the end
1520

1621
## Model Checklist
1722

@@ -84,6 +89,36 @@ Report pass/fail. If tests fail, identify which tests.
8489
3. **Example quality** -- Is it tutorial-style? Does the JSON export include both source and target data?
8590
4. **Paper quality** -- Is the reduction-rule statement precise? Is the proof sketch sound?
8691

92+
## Issue Compliance Review
93+
94+
Only run this section if a linked issue was provided (not "No linked issue found.").
95+
96+
Compare the implementation against the requirements in the original issue. The issue follows either the model checklist (from add-model) or the rule checklist (from add-rule).
97+
98+
### For Models (check against issue):
99+
| # | Check | How to verify |
100+
|---|-------|--------------|
101+
| 1 | Problem name matches | Compare struct name against issue item 1 |
102+
| 2 | Mathematical definition matches | Read `evaluate()` and verify it implements the definition from issue item 2 |
103+
| 3 | Problem type matches | Verify optimization direction or satisfaction matches issue item 3 |
104+
| 4 | Type parameters match | Verify struct generics match issue item 4 |
105+
| 5 | Configuration space matches | Verify `dims()` matches issue item 6 |
106+
| 6 | Feasibility check matches | Verify `evaluate()` feasibility logic matches issue item 7 |
107+
| 7 | Objective function matches | Verify `evaluate()` objective logic matches issue item 8 |
108+
| 8 | Complexity matches | Verify `declare_variants!` complexity string matches issue item 9 |
109+
110+
### For Rules (check against issue):
111+
| # | Check | How to verify |
112+
|---|-------|--------------|
113+
| 1 | Source/target match | Compare `ReduceTo` impl against issue items 1-2 |
114+
| 2 | Reduction algorithm matches | Read `reduce_to()` and verify it follows the algorithm from issue item 3 |
115+
| 3 | Solution extraction matches | Read `extract_solution()` and verify it matches issue item 4 |
116+
| 4 | Correctness preserved | Verify the reduction logic is consistent with the correctness argument in issue item 5 |
117+
| 5 | Overhead expressions match | Compare `#[reduction(overhead = {...})]` against issue item 6 |
118+
| 6 | Example matches | Verify the example program uses the instance from issue item 7 |
119+
120+
Flag any deviation as ISSUE -- the implementation must match what was specified in the issue unless there's a documented reason for the change.
121+
87122
## Output Format
88123

89124
You MUST output in this exact format:
@@ -105,7 +140,13 @@ You MUST output in this exact format:
105140
- dims() correctness: OK / ISSUE -- description
106141
- [other checks]: OK / ISSUE -- description
107142
143+
### Issue Compliance (if linked issue found)
144+
| # | Check | Status |
145+
|---|-------|--------|
146+
| 1 | ... | OK / ISSUE -- deviation description |
147+
108148
### Summary
109149
- X/Y structural checks passed
150+
- X/Y issue compliance checks passed (if applicable)
110151
- [list of action items for any failures]
111152
```

0 commit comments

Comments
 (0)